Forum Discussion

kllingesh's avatar
12 years ago

Can we call gotoStepByName("teststepname") from teardown scr

Hi,

I want to execute a testcase with more than one set of test data. so i kept all the test case in xls. I thought of use setup script and tear down script of testcase for iterate and calling the teststep.

In SETUP SCRIPT testcase,

ArrayList<ArrayList<NameValuePair>>testdata =getTCTestData(sDataSheetName,projectdir,TestCaseName, sheetName);
context.setProperty("testdata", testdata)
testRunner.testCase.setPropertyValue("Pointer", "1")
ArrayList<NameValuePair> nv = testdata.get(0);

for (NameValuePair nvp : nv) {
String prop = nvp.getName();
String value = nvp.getValue();
testCase.properties["${prop}"].value = value
}
}

In TEARDOWN SCRIPT,

//Set the testdata values in testcase custom properties
ArrayList<NameValuePair> nv = testdata.get(pointer);
for (NameValuePair nvp : nv) {
String prop = nvp.getName();
String value = nvp.getValue();
testCase.properties["${prop}"].value = value
}
pointer = pointer+1
testRunner.testCase.setPropertyValue("pointer", pointer.toString())
testRunner.gotoStepByName("teststep request")
log.info("end of else loop")

After setting the next row test data in xls sheet, i tried to call gotoStepByName(). I am not getting any responses for this call. I even checked the error log and soapui log. I didnt get any error for this script.
Is there any other way to loop/call the teststep from teardown script?
Please help me in fixing this issue.

Thank you

1 Reply

  • PaulDonny's avatar
    PaulDonny
    Regular Contributor
    I want to say I could. I am not near my work computer (thankfully) but if you contact me regarding this tomorrow or Friday, or just post here again. I will find out the answer for you and help find a solution.

    I did have a situation where I had to put a groovy script into the last test step but I for the life of me can not remember why I had to do that. I do know that my teardown script was set up as a logger and I want to say that it used gotoTestStep.

    Some things to possibly look into:

    A return statement might break the teardown script. runTestCase might be a better option. I know with SoapUI that it will parse the script and finish the testCase which might be the issue since at the end of the test case it is closing the test case completely.

    Again, these are theories since I can not currently test anything.