Reputation: 55
I wrote a groovy script for running parallel projects in SoapUI and placed it in a test step in a project named 'Project1'. I am able to run the projects parallely but when i use a batch file for the purpose of scheduling the execution, it fails. It says
"Cannot get property 'projects' on null object"
for the line defining 'project1'. Still it executes the first project as the groovy script is in the 'Project1'.
The groovy script for parallel execution of projects:
import com.eviware.soapui.model.propertyexpansion.DefaultPropertyExpansionContext
def project1=testRunner.testCase.testSuite.project.workspace.projects["Project1"]
def project2=testRunner.testCase.testSuite.project.workspace.projects["Project2"]
DefaultPropertyExpansionContext con1=new DefaultPropertyExpansionContext(project1)
DefaultPropertyExpansionContext con2=new DefaultPropertyExpansionContext(project2)
project1.run( con1,true)
project2.run( con2,true)
Upvotes: 0
Views: 2721
Reputation: 18517
If you run SOAPUI
projects using testrunner.bat
you've to note that you run the projects individually so you can't access to testRunner.testCase.testSuite.project.workspace
property.
Looking at testrunner.bat
properties on documentation doesn't seems that there is no parameter that fits your requirements.
Maybe I'm wrong and there is something for this case (I'm not an expert using testrunner.bat
), however a possible workaround to run both projects in parallel is to avoid call your groovy testStep
an instead invoke testrunner.bat
twice, specifying the correct project xml
file for each one invocation.
Another possible workaround (which is basically the same) is to modify your groovy
script to execute the both commands (instead of you call it from command line). So you execute using testrunner.bat
a project with the follow groovy testStep
script which execute the other projects. Try modifying your groovy script for something like:
def project1 = ["$SOAPUI_HOME/testrunner.bat","-sServiceAPIs","-j","-f",..].execute()
def project2 = ["$SOAPUI_HOME/testrunner.bat","-sServiceAPIs","-j","-f",..].execute()
Note that a String is needed for each param in your command and execute()
don't wait for command finish so your projects run in parallel.
If you want more info about groovy
command execution take a look at documentation.
Hope this helps,
Upvotes: 1