我们可以在 soapui 中使用闭包为每个测试用例执行测试吗
Can we get test execution for each test case using closure in soapui
我在 soapui 中有大约 400 个测试用例。它没有开始时间和结束时间,或者自定义报告中没有添加测试用例的总执行时间。我可以通过在每个测试用例的拆卸脚本中添加一个脚本来实现这一点。但是因为我有 400 个测试用例,所以花的时间很少。有什么办法可以通过在 groovy..
中使用闭包来实现
谢谢
这是在整个项目中设置拆卸的示例
def project = testRunner.getTestCase().getTestSuite().getProject().getWorkspace().getProjectByName("MyProject");
//TearDownTemplate
def tearDownTemplate = """
/*BEGINNING CUSTOM TEARDOWN FOR THIS TESTCASE ONLY*/
//Reserved for this testcase only, because the teardown is populated automaticly, we don't want to loose some work if we need specials things.
/*END OF CUSTOM TEARDOWN HERE £££*/
// Common teardown for all testcases Here
// Here do the stuff for your time execution
""";
//Loop through each Test Suite in the project
for(suite in project.getTestSuiteList()) {
//Loop through each Test Case
for(tcase in suite.getTestCaseList()) {
teardown = tcase.getTearDownScript();
if(teardown != null){
// we split the teardownTemplate and the teardown already set by our delimiter '£££'
def fields = teardown.tokenize("£££");
def fieldsTemplate = tearDownTemplate.tokenize("£££");
//teardown replacement
tcase.setTearDownScript(fields[0] + "£££" + fieldsTemplate[1]);
}else{
tcase.setTearDownScript(tearDownTemplate);
}
}
}
log.info 'finished'
我在 soapui 中有大约 400 个测试用例。它没有开始时间和结束时间,或者自定义报告中没有添加测试用例的总执行时间。我可以通过在每个测试用例的拆卸脚本中添加一个脚本来实现这一点。但是因为我有 400 个测试用例,所以花的时间很少。有什么办法可以通过在 groovy..
中使用闭包来实现谢谢
这是在整个项目中设置拆卸的示例
def project = testRunner.getTestCase().getTestSuite().getProject().getWorkspace().getProjectByName("MyProject");
//TearDownTemplate
def tearDownTemplate = """
/*BEGINNING CUSTOM TEARDOWN FOR THIS TESTCASE ONLY*/
//Reserved for this testcase only, because the teardown is populated automaticly, we don't want to loose some work if we need specials things.
/*END OF CUSTOM TEARDOWN HERE £££*/
// Common teardown for all testcases Here
// Here do the stuff for your time execution
""";
//Loop through each Test Suite in the project
for(suite in project.getTestSuiteList()) {
//Loop through each Test Case
for(tcase in suite.getTestCaseList()) {
teardown = tcase.getTearDownScript();
if(teardown != null){
// we split the teardownTemplate and the teardown already set by our delimiter '£££'
def fields = teardown.tokenize("£££");
def fieldsTemplate = tearDownTemplate.tokenize("£££");
//teardown replacement
tcase.setTearDownScript(fields[0] + "£££" + fieldsTemplate[1]);
}else{
tcase.setTearDownScript(tearDownTemplate);
}
}
}
log.info 'finished'