DLuks
14 years agoContributor
TestCase DataLoop with a Jump To Script
Hi, I was wondering how well this test case is supported. Say, I have the following:
DataSource
JumpToScript (GroovyScript)
TestRequest1
TestRequest2
TestRequest3
TestRequest4
DataSourceLoop
The JumpToScript looks like the following:
def methodType = context.expand( '${DataSource#methodType}' )
if(methodType.equalsIgnoreCase("create")) {
testRunner.gotoTestStepByName( "TestRequest1")
} else if (methodType.equalsIgnoreCase("delete")) {
testRunner.gotoTestStepByName( "TestRequest2")
} else if (methodType.equalsIgnoreCase("rate")) {
testRunner.gotoTestStepByName( "TestRequest3")
} else if(methodType.equalsIgnoreCase("query")) {
testRunner.gotoTestStepByName( "TestRequest4")
} else {
assert false;
}
Basically a field within the datasource specifies which test request should be executed. The DataSourceLoop is set up to point at the DataSource and the JumpToScript. Is this a correct way of doing things?
DataSource
JumpToScript (GroovyScript)
TestRequest1
TestRequest2
TestRequest3
TestRequest4
DataSourceLoop
The JumpToScript looks like the following:
def methodType = context.expand( '${DataSource#methodType}' )
if(methodType.equalsIgnoreCase("create")) {
testRunner.gotoTestStepByName( "TestRequest1")
} else if (methodType.equalsIgnoreCase("delete")) {
testRunner.gotoTestStepByName( "TestRequest2")
} else if (methodType.equalsIgnoreCase("rate")) {
testRunner.gotoTestStepByName( "TestRequest3")
} else if(methodType.equalsIgnoreCase("query")) {
testRunner.gotoTestStepByName( "TestRequest4")
} else {
assert false;
}
Basically a field within the datasource specifies which test request should be executed. The DataSourceLoop is set up to point at the DataSource and the JumpToScript. Is this a correct way of doing things?