How can i run a project in other workspace using groovy script?
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How can i run a project in other workspace using groovy script?
I have project1 in workspace1 and project2 in workspace2. From project2 i want to run a test suite in project1 using groovy script.
Your help is appreciated.
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My use case is that I wanted to put two projects in two different workspace. From project 1 I wanted to be able to run project 2. Is it possible to do that?
Thanks for your suggestion. I will definitely do as you said if what I planned is not possible.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm not totally sure if this is what you are needing but I use this to run another project after the first project has completed. I add this code as the teardown script of the project suite.
import com.eviware.soapui.impl.wsdl.WsdlProject
def project = null
projectPath=context.expand('${projectDir}')
def workspace = testSuite.project.getWorkspace();
try{
if(workspace != null){
project = workspace.getProjectByName("Project2")
project = new WsdlProject(projectPath+"/Project2-soapui-project.xml");
}
//if running in Jenkins/Hudson
else{
project = new WsdlProject(projectPath+"/Project2-soapui-project.xml");
}
}
catch(Exception e)
{
log.error("Service Exception desc : " + e.getMessage());
}
try{
if(project.open && project.name == "Project2" ) {
def properties = new com.eviware.soapui.support.types.StringToObjectMap ()
def testCase = project.getTestSuiteByName("Project2_TestSuite").getTestCaseByName("Project2Case");
if(testCase == null)
{
throw new RuntimeException("Could not locate testcase 'Project2Case'! ");
}
else{
testCase.setPropertyValue("projectPath_1", projectPath )
def runner = testCase.run(properties, false);
}
}
else{
throw new RuntimeException("Could not find project 'Project2' !")
}
}
catch(Exception e)
{
log.error("Service Exception desc : " + e.getMessage());
}
project = null
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Bagochips, I did it from the command line as nmrao suggest.
