Forum Discussion

Jasper175's avatar
Jasper175
Frequent Contributor
15 years ago

Disable TestCase or Skip

Hello - I need help to disable a TestCase based on a condition.
Below is a snippet idea of what I want to accomplish - where I use an IF statement where if it's "true" then I need a particular TC to be disabled OR not be ignored when running a full project.

def response = context.expand( '${getCustomerFullInfo - Request 1#Response#declare namespace m=\'http://cleveland.vonage.com/services/servicelayer\'; //m:GetCustomerFullInfoResponse[1]/m:customer[1]/m:customerId[1]}' )

if((response > ''))

{
// Here I need to disable a TC named "TC-1"
}

Example Setup:
1. Groovy Script w/ IF statements
2. TC-1
3. TC-2
New TestSuite

If the condition is true 'TC-1' will be skipped or disabled and run TC-2.
I have the IF statements working but when running at the project level - SoapUI wants to run everything anyway.

Thank you,
Rob

2 Replies

  • Jasper175's avatar
    Jasper175
    Frequent Contributor
    Found my answer again:

    def testCase1 = testRunner.testCase.testSuite.project.getTestSuiteByName("Test-Verify").getTestCaseByName("TC-1")
    TC-1.setDisabled(true);
  • Great!

    for the sake of groovyness, you can just write

    testCase1.disabled = true

    cheers!

    /Ole
    eviware.com