How to iterate test data over a single test case in a test suit?

I know similar questions have already been asked
here
http://forum.katalon.com/discussion/2265/using-same-browser-instance-when-iterating-through-test-suites-of-a-test-suite-collection
and here
http://forum.katalon.com/discussion/4031/how-to-handle-login-page-on-every-test-cases-in-test-suite

but I don’t know whether there is a workable solution for the above scenarios. None of the solutions already posted,works.

My case is similar. I am trying to iterate test data(3 test data with many to many relationships) over a webpage containing reports, but all the test cases(including login and logout) are running for every iteration.
I have 3 test cases

- Login Test Case

- Test case for downloading reports with test data

- Sign out test case

I want the Test Suite to iterate only the second test case with all test data rows and finally when there are no more combinations to run, run the Sign out test case and exist the browser.

Maybe you could do something with Call test case:
https://docs.katalon.com/display/KD/Call+test+case

WebUI.callTestCase(findTestCase('Login Test Case'), [key1:value1, key2:value2, … , keyN:valueN], FailureHandling.option)
//do something with your other test cases, e.g.
loop that iterates according to (logic){
    WebUI.callTestCase(findTestCase('Test case for downloading reports with test data'), [key1:value1, key2:value2, … , keyN:valueN], FailureHandling.option)
}
WebUI.callTestCase(findTestCase('Sign out test case'), [key1:value1, key2:value2, … , keyN:valueN], FailureHandling.option)
2 Likes

Mate Mrse said:

Maybe you could do something with Call test case:
https://docs.katalon.com/display/KD/Call+test+case

WebUI.callTestCase(findTestCase('Login Test Case'), [key1:value1, key2:value2, … , keyN:valueN], FailureHandling.option)

//do something with your other test cases, e.g.
loop that iterates according to (logic){
WebUI.callTestCase(findTestCase(‘Test case for downloading reports with test data’), [key1:value1, key2:value2, … , keyN:valueN], FailureHandling.option)
}
WebUI.callTestCase(findTestCase(‘Sign out test case’), [key1:value1, key2:value2, … , keyN:valueN], FailureHandling.option)


  

  

Thanks!! This led me to more than half of the solution to my problem.

-I made boolean flag for login as a global variable.

-Set it to true after login.

-Checked if already logged in and continued through all “many to many” relationship mappings for downloading

I am just unable to call logout script now.

I tried adding a dummy value in Test Data, so that whenever that dummy value is encountered Test suite should sign out. But I guess Katalon Studio runs relationships randomly, which is causing uneven logout (without completing all Test Data rows)

Mate Mrse said:

Maybe you could do something with Call test case:
https://docs.katalon.com/display/KD/Call+test+case

WebUI.callTestCase(findTestCase('Login Test Case'), [key1:value1, key2:value2, … , keyN:valueN], FailureHandling.option)

//do something with your other test cases, e.g.
loop that iterates according to (logic){
WebUI.callTestCase(findTestCase(‘Test case for downloading reports with test data’), [key1:value1, key2:value2, … , keyN:valueN], FailureHandling.option)
}
WebUI.callTestCase(findTestCase(‘Sign out test case’), [key1:value1, key2:value2, … , keyN:valueN], FailureHandling.option)


  

  

Thanks Mate Mrse, I finally solved my problem. Added a listener and called login and logout test cases through the listener.

Glad you made it!