Forum Discussion

roryLIT's avatar
roryLIT
Contributor
11 years ago

Get testcase name using Groovy?

I have a testcase 1. Within this testcase 1 I have a Run TestCase step which consists of a groovy step. In this groovy step I want to get the name of the testcase 1. How would I do this using groovy?

I've tried testRunner.testCase.name in the groovy step but that gives me the name of the Run TestCase step

Thanks

Rory

3 Replies

  • PaulDonny's avatar
    PaulDonny
    Regular Contributor
    I am not understanding your issue and can not replicate it. What version of SoapUI are you using?

    testRunner.testCase.setPropertyValue("Here",testRunner.testCase.getName());


    That puts the name of the testCase being ran by Run Test Case (The one it directs to) into a testCase level property variable in it.
  • I'm using 4.6.0

    I don't want the name of the testCase being ran by Run Test Case. I want the name of the testcase that contains the Run Test Case step. I want to be able to get this using groovy within the testcase that the Run TestCase is pointing to. Does this make sense? Sorry for any confusion

    Thanks
  • PaulDonny's avatar
    PaulDonny
    Regular Contributor
    I am not sure of a good way to perform this action.

    You could store it as a project level property and that would probably be your best option. The main issue would be you would have to set something up to store it.

    Since I have never attempted such a feat, there might be better options built into SoapUI. It will be a slightly more difficult task to perform though.