dweakley
11 years agoOccasional Contributor
Project ActiveEnvironment
I'm creating a JUnit test to run some test suites I have in a soapUI pro project file.
My function is below. Even after setting the project's activeEnvironment, the next line prints "Default" to the console.
What's happening is my environments contain specific endpoints, and when I run the code below, the console states no endpoint could be found for the request.
also, the code below regarding ignoring disabled suites doesn;t seem to work.
I looped through and printed out suite names to the console and the disabled suites were listed, as well.
My function is below. Even after setting the project's activeEnvironment, the next line prints "Default" to the console.
What's happening is my environments contain specific endpoints, and when I run the code below, the console states no endpoint could be found for the request.
also, the code below regarding ignoring disabled suites doesn;t seem to work.
I looped through and printed out suite names to the console and the disabled suites were listed, as well.

@Test
public void runSoapUITestSuite4() throws Exception {
WsdlProject project = new WsdlProject(SoapUIConfiguration.PROJECT_FILE);
project.setPropertyValue("activeEnvironment", "PRODUCTION");
System.out.println("Project Propeties activeEnvironment: " + project.getActiveEnvironment().getName());
List<TestSuite> testSuites = project.getTestSuiteList();
for (TestSuite suite:testSuites) {
if (!suite.isDisabled()) {
List<TestCase> testCases = suite.getTestCaseList();
for (TestCase testCase:testCases) {
if (!testCase.isDisabled()) {
System.out.println("Preparing to run TestSuite: " + suite.getName() + " TestCase: " + testCase.getName());
TestRunner runner = testCase.run(new PropertiesMap(), false);
assertEquals(Status.FINISHED, runner.getStatus());
}
}
}
}
}