AndreW273SK
8 years agoNew Contributor
Running specific test step in SoapUI based on testSuite property
I am new to scripting and have an issues regarding SoapUI groovy script I could use help with.
I need a script that will let me run specific testStep in testCase based on value of testSuite property ('CC1' is name of property) with 5 possibilities. I guess switch/case could be used, but don't know how to write it properly.
I tried using this:
def CC1 = testRunner.testCase.testSuite.getPropertyValue("CC1") switch(CC1) { case ~/^[H1]+$/: testRunner.runTestStepByName( "PT02_H1" ); break; case ~/^[Y5]+$/: testRunner.runTestStepByName( "PT02_Y5" ); break; case ~/^[Q2]+$/: testRunner.runTestStepByName( "PT02_Q2" ); break; case ~/^[T5]+$/: testRunner.runTestStepByName( "PT02_T5" ); break; default : testRunner.runTestStepByName( "PT02_AQ" ); }
But doesn't run the desired step.
Can someone help me with this, please?