Forum Discussion
CrazyFrog
11 years agoContributor
Here is an example how you can change de endpoint of each testStep.
note: this is test code
note: this is test code
@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);
}
}
}
}