Forum Discussion

sergeykh's avatar
sergeykh
Occasional Contributor
13 years ago

Use the calling step name in the called test case

Hi
I`m new to this forum
Have been using soapUI for several months.
I have created a generic project where all the test cases are being used as functions, and with them the user can create almost any functional test just using call to test, and without the need to write any code (sort of frameWork for writing tests for our product, where the main goal is reuse and redability)

In wach called test case I try to write to the log as much as possible for easy debuging.
What I wanted to add to all the called test cases is to write the testCase name which called them.
But if I`m using "log.info testRunner.testCase.getName()" It writes the called test case name and not the calling.
I`ve looked in the API`s and could not find nothing on how to refrence to the calling test case object.

Thanks in advance.

1 Reply

  • sergeykh's avatar
    sergeykh
    Occasional Contributor
    After more digging around I found the solution.

    In the called test case you can the calling step name, or the test case name with this code:

    if(context.hasProperty("#CallingRunTestCaseStep#")){
    log.info context.getProperty("#CallingRunTestCaseStep#").getLabel();
    log.info context.getProperty("#CallingRunTestCaseStep#").getTestCase().getLabel();
    }

    Using this params the trace will be much more readble