Forum Discussion

d4vke's avatar
d4vke
Occasional Contributor
6 years ago

Groovy script - How to run a teststep from another testsuite in your testsuite teardown script?

I'm able to run a testcase teardown script in my testsuite TS1 that runs a teststep from another testsuite TS2.

 

testRunner.testCase.testSuite.project.testSuites["TS2"].testCases["TC2"].testSteps["STEP2"].run(testRunner, context);

But as this teststep should run for all my testcases in TS1, I need to add the teardown script for each testcase.

I want to know if I could achieve the same thing directly from the testsuite teardown script, which would save me a lot of script maintenance.

 

Unfortunately the testrunner object is not available at testsuite level, but I don't know how (or if it's possible) to do it using the runner object.

 

Any help is much appreciated!

9 Replies

    • d4vke's avatar
      d4vke
      Occasional Contributor

      Sorry, but it is not helping for me.

      Looks like this is not an easy one to solve :-(

  • I have set up TearDown Script for TestSuite(TS2) :

    With this TearDown Script, run all TestSteps of all TestCases of TestSuite(TS1)

    Please see attach screenshot for more details.

    In error log I am getting this error:

    Wed Oct 10 12:10:25 IST 2018:ERROR:groovy.lang.MissingPropertyException: No such property: testRunner for class: Script2

    But I check response of TestSteps of TestSuite(TS1), and see I am getting response properly.

     

    Please have a look screenshot and I think it help you.

    • d4vke's avatar
      d4vke
      Occasional Contributor

      Hi ranjit96,

       

      Could you attach the code of the teardown script in a txt file rather then the screenshot, as I'm not able to see all the code in the screenshot.

       

      Thanks!