Forum Discussion
The setUp script of the suite is executed when the test suite is launched. Similarly a test case setUp script is started when a test case is started. So if you launch the test case or a test step, the test suite setuUp script is not executed.
If you open the setUp script (via test suite editor), you can execute the setUp script manually (by the green arrow button). If you want to do the same with scripting, you can use the API:
testSuite.runSetupScript(context, runner)
I suggest either to launch the whole test suite or to use a more suitable place where to put the script (on test case level, Groovy script test step or other option).
Thanks, that helps.
Could you please let me know how to set context and runner arguments here ?
- nmrao8 years agoChampion Level 3
In the test suite setup both variables are available.
Like KarelHusa rightly suggested, please the execute test case / suite appropriately.- ankush8 years agoOccasional Contributor
Hi,
Can't seem to get around this:
com.eviware.soapui.SoapUI.setSoapUICore(new StandaloneSoapUICore(true));
WsdlProject project = new WsdlProject(path);
suiteList = project.getTestSuiteList();
TestSuite suite = suiteList.get(0);
//run the set up script
TestSuiteRunContext context = null;
TestSuiteRunner testSuiteRunner = null;
try {
System.out.println("-- run setup script");
((WsdlTestSuite) suite).runSetupScript(context, testSuiteRunner);
} catch (Exception e) {
// TODO Auto-generated catch block
System.out.println("Error from run setup script");
e.printStackTrace();
}
how do I initialize the following :
TestSuiteRunContext context
TestSuiteRunner testSuiteRunner
- KarelHusa8 years agoChampion Level 2
You can use the following code:
import com.eviware.soapui.impl.wsdl.testcase.WsdlTestSuiteRunner import com.eviware.soapui.support.types.StringToObjectMap def suite = testRunner.testCase.testSuite def runner = new WsdlTestSuiteRunner(suite, new StringToObjectMap()) suite.runSetupScript(runner.getRunContext(), runner)
Please consider that executing a test suite script from its test cases or test steps is not a standard way of using it. You may need to prevent multiple executions when running the test suite etc.
Related Content
- 2 years ago
Recent Discussions
- 3 days ago