List<TestSuite> testSuites = project.getTestSuiteList();
for( TestSuite suite : testSuites ) {
List<TestCase> testCases = suite.getTestCaseList();
for( TestCase testCase : testCases ) {
System.out.println("Running SoapUI test [" + testCase.getName() + "]");
TestCaseRunner runner = testCase.run(new PropertiesMap(), false);
}
}
String projectFile = String.format("src/main/resources/%s-soapui-project.xml", projectName);
project = (WsdlProject)ProjectFactoryRegistry.getProjectFactory("wsdl").createNew(projectFile);
Interface i = project.getInterfaceAt(0);
for(String existingEndpoint : i.getEndpoints()) {
i.changeEndpoint(existingEndpoint, endpoint);
}
@Test
public void fullControl() throws Exception {
WsdlProject project = new WsdlProject("my-soapui-project.xml");
List<TestSuite> testSuites = project.getTestSuiteList();
for( TestSuite suite : testSuites ) {
System.out.println("Running SoapUI TestSuite [" + suite.getName() + "]");
List<TestCase> testCases = suite.getTestCaseList();
for( TestCase testCase : testCases ) {
System.out.println("TestStep count [" + testCase.getTestStepCount() + "]");
for (TestStep testStep : testCase.getTestStepList()) {
System.out.println("TestSteps [" + testStep.getName() + "]");
//get the current endpoint of this testStep
System.out.println("endpoint:" + testStep.getPropertyValue("Endpoint"));
//Change the endpoint property of this testStep
testStep.setPropertyValue("EndPoint", "http://www.java.com");
//Check if the endpoint property is changed
System.out.println("endpoint:" + testStep.getPropertyValue("Endpoint"));
//Save the project
//project.save();
TestSuite testSuite = project.getTestSuiteByName(suite.getName());
TestCase testCase1 = testSuite.getTestCaseByName(testCase.getName());
TestStep testStep1 = testCase.getTestStepByName(testStep.getName());
TestCaseRunner testCaseRunner = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner((WsdlTestCase)testCase1, null);
TestCaseRunContext testStepContext = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext(testStep1);
//testStep.run(testCaseRunner, testStepContext);
}
}
}
}
Subject | Author | Latest Post |
---|---|---|