How to run testcase in certain order?

i have a folder in testcase which contains several testcases and i want to run them in certain order.
structure of my testcase is:

Test Cases

So what i want run testcase1_runner which will execute:

Is there a way to do it with a loop?

im trying with this:

//1- run testcase1
WebUI.callTestCase(findTestCase(‘Folder1/testcase1’), [:], FailureHandling.STOP_ON_FAILURE)

//2- execute testcase2
WebUI.callTestCase(findTestCase(‘Folder1/testcase2’), [:], FailureHandling.STOP_ON_FAILURE)

//3- execute testcase_final
WebUI.callTestCase(findTestCase(‘Folder1/testcase_final’), [:], FailureHandling.STOP_ON_FAILURE)

Thank you

You’re probably already taking the best approach. Here’s why…

A Test Case needs to be READABLE. It should be very clear, even to the casual reader, what it is trying to achieve.

Could you (or anyone) write a super intelligent procedure that computes “what is next” and stick it in a loop? Absolutely. But would it be readable?

Now think about the only constant in testing (or anything for that matter)… the requirements will change. Change, as we all know, is a constant.

When you come to modify your chosen structure and approach, which one do you think is the easiest to modify? What if the person making the change is not you?

The only other thing you might consider is to add the tests, in the order you wish them to execute, to a suite. But really, there’s nothing wrong with callTestCase() and a master test case.

Aside: There has been talk about ad hoc suite creation where a suite is created in memory (via code) and executed. I haven’t heard when that might appear but I live in hope. (hint hint @ThanhTo)

1 Like

If you get rid of your existing instance of Junit, and download JUnit 4.11 or greater in the build path, the following code will execute the test methods in the order of their names, sorted in ascending order:

public class SampleTest {

public void testAcreate() {
public void testBupdate() {
public void testCdelete() {

@Lewis-H Can you please explain what JUnit has to do with Katalon Test Cases?