Run particular groovyscript teststeps and ignore other
My requirement is...if i have 5 groovy script (Gs) teststeps and want to run only Gs1, Gs2 & Gs5 and ignore Gs3 & Gs4 using external Batch File (say testRunner), how can i do that?
I tried the following, but not achieved what i want...
testRunner.gotoStepByName( "nameofteststep" )
testRunner.runTestStepByName( "nameofteststep" )
Specific Solutions & Suggestions are welcome. Thanks in advance...
I am thinking that you have couple of options here:
1) You pass in parameters to Global|System|Project parameters via test runner and handle inputs from your groovy scripts
2) You create a text file that will contain which scripts to run.
With both cases, all 5 scripts will execute, but you can handle whether each scripts completes or terminates at the entry.
*** EDIT ***
I'm assuming that you are trying to run your scripts using command line utility testrunner.bat/sh
Hope this helps.
Last edited by dimaj; 03-28-2014 at 07:01 AM.
Thanks for your valuable inputs, but if you can send me some sample code then i will b very thankful...
I tried lots of options, but still facing probs...
As you said, yes, i am trying to run the groovy scripts thr' command line only....as per our requirement...
Sorry for the late response Manishddeshmukh,
I never got an email that you have replied.
Please find attached project file with the demo of what you want.
Here's sample output with given project parameters of values="2,3"
Command line is as follows:
/path/to/your/testrunner.sh -sDemoTS -c5Scripts -R"TestSuite Report" -EDefault -Pvalues="2,3" /path/to/project_file/SQAForumsDemo-soapui-project.xml
As you can see, all 5 scripts have been executed, but only Gs2 and Gs3 have any output.
Running SoapUI TestRunner for [SQAForumsDemo]
command: sh -c ./testrunner.sh -sDemoTS -c5Scripts -R"TestSuite Report" -EDefault -Pvalues="2,3" /Users/djerusalimsky/tmp/SQAForumsDemo-soapui-project.xml
= SOAPUI_HOME = /Applications/SoapUI-Pro-4.6.4.app/Contents/java/app
SoapUI Pro 4.6.4 TestCase Runner
Configuring log4j from [/Applications/SoapUI-Pro-4.6.4.app/Contents/java/app/bin/soapui-log4j.xml]
18:39:44,167 INFO [DefaultSoapUICore] initialized soapui-settings from [/Users/djerusalimsky/soapui-settings.xml]
18:39:44,442 WARN [SoapUIProGroovyScriptEngineFactory] Missing scripts folder [/Applications/SoapUI-Pro-4.6.1.app/Contents/java/app/bin/scripts]
18:39:44,443 INFO [DefaultSoapUICore] Adding listeners from [/Applications/SoapUI-Pro-4.6.4.app/Contents/java/app/bin/listeners/demo-listeners.xml]
18:39:45,587 INFO [WsdlProject] Loaded project from [file:/Users/djerusalimsky/tmp/SQAForumsDemo-soapui-project.xml]
18:39:45,675 WARN [SoapUIProGroovyScriptEngineFactory] Missing scripts folder [/Applications/SoapUI-Pro-4.6.1.app/Contents/java/app/bin/scripts]
18:39:46,067 INFO [SoapUIProTestCaseRunner] Setting project property [values] to [2,3]
18:39:46,071 INFO [SoapUIProTestCaseRunner] Running SoapUI tests in project [SQAForumsDemo]
18:39:46,099 INFO [SoapUIProTestCaseRunner] Running TestCase [5Scripts]
18:39:46,105 INFO [SoapUIProTestCaseRunner] Running SoapUI testcase [5Scripts]
18:39:46,127 INFO [SoapUIProTestCaseRunner] running step [Gs1]
18:39:46,571 INFO [SoapUIProTestCaseRunner] running step [Gs2]
******* I'm in Script 2
18:39:46,607 INFO [SoapUIProTestCaseRunner] running step [Gs3]
******* I'm in Script 3
18:39:46,632 INFO [SoapUIProTestCaseRunner] running step [Gs4]
18:39:46,655 INFO [SoapUIProTestCaseRunner] running step [Gs5]
18:39:46,678 INFO [SoapUIProTestCaseRunner] Finished running SoapUI testcase [5Scripts], time taken: 539ms, status: FINISHED
18:39:46,681 INFO [SoapUIProTestCaseRunner] TestCase [5Scripts] finished with status [FINISHED] in 539ms
Hope this helps.
Glad I could help!
Appreciate for your best solution on my query ! once again thanks...
One more thing i would like to know like if we have some webservices (imported project with WSDL), if there are 2 Test(Soap) Requests testSteps, say TR1 & TR2 in between those five groovy scripts, then can we also able to control the execution of those requests through the command line batch file?
Say........... Gs1, TR1, Gs2, TR2, Gs3, Gs4, Gs5 (2 TestRequests & 5 GroovyScripts).
I will try my best as per the solution you have provide, but still if you have any other option please let me know. Thanks.
Last edited by manishddeshmukh; 03-31-2014 at 10:02 AM.
Ok, will look into that...thanks
Hello Dimaj / Manishddeshmukh,
I am also looking for a solution to an identical situation in my work.
Could any of you folks kindly send me the SQAForumsDemo-soapui-project.xml.zip file to me OR how can I download this file ?
I have registered this site a couple of minutes ago, hence am not completely aware of the 'How to' on this site.
Also I am a new to using SoapUI automation.