Forum Discussion

mcbootus's avatar
mcbootus
Contributor
14 years ago

[Res] Calling test cases and test steps

Dear Support,

I want to setup a global groovy script which calls test steps from other test cases - below is an example structure:

TESTSUITE1
-----TESTCASE1
-------TESTSTEP6

-----TESTCASE2
--------TESTSTEP8

-----TESTCASE3
--------TESTSTEP2

TESTSUITE2
-----TESTCASE1
-------TESTSTEP3



I want to be able to call these scripts as follows:

Call TESTSUITE1 / TESTCASE1 / TESTSTEP6
Call TESTSUITE1 / TESTCASE2 / TESTSTEP8
Call TESTSUITE1 / TESTCASE3 / TESTSTEP2
Call TESTSUITE2 / TESTCASE1 / TESTSTEP3


I already use the command " testRunner.runTestStepByName("TESTSTEP1") " but this only works within the testcase - is it possible to call other testsuites / testcases / teststeps from a groovy script?


Thank you in advance,
Armen
  • Hi Armen,

    you can run a TestCase with

    runner = testRunner.runTestStep( project.testSuites['TestSuite1'].testCases['TestCase2'].run( null, true )
    runner.waitUntilFinished()
    etc..

    Does that work ok?

    regards,

    /Ole
    eviware.com
  • Hi Ole,

    Thanks again for your help - this time it worked! I created a runner per testcase - here is the full code:




    def project = testRunner.testCase.testSuite.project

    def runner = project.testSuites['E-GREFFE XML STRUCTURE'].testCases['eventList'].run( null, true )
    runner.waitUntilFinished()

    def runner2 = project.testSuites['E-GREFFE XML STRUCTURE'].testCases['procedureIdentification'].run( null, true )
    runner2.waitUntilFinished()

    def runner3 = project.testSuites['E-GREFFE XML STRUCTURE'].testCases['tfueArticleList'].run( null, true )
    runner3.waitUntilFinished()

    etc........






    Best regards,

    Armen