Forum Discussion

DLuks's avatar
DLuks
Contributor
14 years ago

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?

2 Replies

  • Ah yes, I was able to get this to run properly. I just disabled all the TestRequests and instead use the jump to script to perform runTestStepByName("")
  • DLuks wrote:
    Ah yes, I was able to get this to run properly. I just disabled all the TestRequests and instead use the jump to script to perform runTestStepByName("")

    Yeah, there's a difference between gotoTestStepByName and runTestStepByName. The API documentation explains it briefly.


    Glad it works for you now!

    Henrik
    eviware.com