Forum Discussion

DAPurcey's avatar
DAPurcey
New Contributor
4 years ago
Solved

testrunner.bat command to disable a particular TestCase from a TestSuite

Hello when using testrunner with the following batch command lines

CD C:\Users\UserName\AppData\Local\SmartBear\ReadyAPI-3.5.0\bin
call testrunner.bat "-sTestSuite 1" "C:\GPS-API\TestScripts\REST-GPS-soapui-project.xml"

TestSuite 1 has 2 TestCases that I do not want to run at the TestCase level

SingleSetup and SingleTearDown

how can I ignore these 2 TestCases or set them to disabled and when done re-enable them.

 

Also If I run 

call testrunner.bat "-sTestSuite 1" "-cSingleSetup" "C:\GPS-API\TestScripts\REST-GPS-soapui-project.xml"

call testrunner.bat "-sTestSuite 1" "-cSmokeTest" "C:\GPS-API\TestScripts\REST-GPS-soapui-project.xml"

call testrunner.bat "-sTestSuite 1" "-cSingleTearDown" "C:\GPS-API\TestScripts\REST-GPS-soapui-project.xml"

how can ensure they are enabled

The SingleSetup TestCase only contains a Setup Script

The SingleTearDown TestCase only contains a Teardown Script

  • Event scripting may be a good fit but does require enabling/disabling testcases, which in the case of an error or more granular runs could cause unexpected results.

     

    An alternative could be to use the TestCase tags that can be configured at a TestSuite level. These can be set within the TestSuite Editor and you could either tag the 'must run' cases, or 'optional' ones. Using testrunner.bat, one or many of these tags can be specified at run time using the -T argument along with operators for more complex conditionals. This will avoid enabling/disabling a testcase on the fly but should provide the flexibility required on what to run.

     

    These can also be used at a project level to tag specific testsuites that should share groupings.

2 Replies

  • DAPurcey : You can add a grovy script and try to enable and disable accordingly

     

    def ts=testRunner.testCase.getTestStepByName("TestStepName")
    
    if (ts.disabled == false) {
    step.disabled = true
    }

     

  • nathan_wright's avatar
    nathan_wright
    SmartBear Alumni (Retired)

    Event scripting may be a good fit but does require enabling/disabling testcases, which in the case of an error or more granular runs could cause unexpected results.

     

    An alternative could be to use the TestCase tags that can be configured at a TestSuite level. These can be set within the TestSuite Editor and you could either tag the 'must run' cases, or 'optional' ones. Using testrunner.bat, one or many of these tags can be specified at run time using the -T argument along with operators for more complex conditionals. This will avoid enabling/disabling a testcase on the fly but should provide the flexibility required on what to run.

     

    These can also be used at a project level to tag specific testsuites that should share groupings.