Table of contents
1.
Introduction
2.
Skip Test Cases
3.
Execute Tests on Multiple Devices in Parallel
4.
Frequently Asked Questions
4.1.
Is it possible to skip a test method from execution?
4.2.
How can we skip a test case conditionally?
4.3.
Is parallel execution possible in Katalon?
5.
Conclusion
Last Updated: Mar 27, 2024
Easy

How to skip test cases and Execute Tests on Multiple Devices in Parallel in Katalon

Author Sanjana Yadav
0 upvote
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

Hello, Readers!! 

As we have already covered a long way with Katalon, let's move ahead and explore yet another feature of Katalon studio. Today, we will see the steps to Skip test cases in a test suite. Along with that, we will also learn to Execute Tests on Multiple devices in parallel in Katalon.

How to skip test cases and Execute Tests on Multiple Devices in Parallel in Katalon

So, let’s get started!!

Skip Test Cases

To skip test cases in a test suite, we will need to preconfigure a Test Listener with the TestCaseContext.skipThisTestCase() method. 

Follow the steps below to create Test Listeners and skip test cases:

  1. Open the Katalon studio, go to the Test Explorer panel, and then right-click on Test Listeners.
    Select New > New Test Listener
create test listener

2. A New Test Listener dialog box will appear.
Give it a name, like SkipTest, in this case. Select Generate sample Before Test Case method and then click Ok. You can also select other methods if you want the samples to be generated. 

New test listener

3. Katalon Studio will generate a sample template having the necessary annotations, libraries, and the supported functions as given below:

import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject

import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testobject.TestObject as TestObject

import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile

import internal.GlobalVariable as GlobalVariable

import com.kms.katalon.core.annotation.BeforeTestCase
import com.kms.katalon.core.annotation.BeforeTestSuite
import com.kms.katalon.core.annotation.AfterTestCase
import com.kms.katalon.core.annotation.AfterTestSuite
import com.kms.katalon.core.context.TestCaseContext
import com.kms.katalon.core.context.TestSuiteContext


class SkipTest {
    /**
     * Executes before every test case starts.
     * @param testCaseContext related information of the executed test case.
     */
    @BeforeTestCase
    def sampleBeforeTestCase(TestCaseContext testCaseContext) {
        println testCaseContext.getTestCaseId()
        println testCaseContext.getTestCaseVariables()
    }
}


4. To skip test cases, use the TestCaseContext.skipThisTestCase() method. 

Inside the Skiptest listener, copy and paste the below code under the generated sample template.

//Checks for the required condition and skips the test case if true.
if(inputyourconditionhere)
{   testCaseContext.skipThisTestCase()
}

Execute Tests on Multiple Devices in Parallel

There are many times when you want to execute tests on different devices at the same time. Below are the steps to do the same:

  1. Create 2 Test Suites.
  2. Create 1 Test Suite Collection.
  3. When a test suite is added to a test suite collection, the execution will be running on the firefox browser by default. You can always change the browser as and when needed.
Execute Tests on Multiple Devices in Parallel

4. Next, click on the Run with column. A dialog containing the execution environment will appear. You can also change your browser according to your convenience.

Execute Tests on Multiple Devices in Parallel

5. Select Andriod.

Execute Tests on Multiple Devices in Parallel

6. In order to select a device, you need to double-click on the Run Configuration column and select the connected device.

executive information

7. Select from the devices that are listed in the appeared dialog box.

8. Since we need two different devices, repeat steps 4 to 7.

9. In the above Execution Information section, select the radio button Parallel.

10. Finally, save the Test suite collection and then click on Execute. You will see the tests running parallelly on your selected devices.

Frequently Asked Questions

Is it possible to skip a test method from execution?

Yes, the user may choose whether to skip a test entirely without running it or just if a certain condition is met, depending on the requirement. The remaining code in the test is skipped if the condition is true at the time it is executed. 

How can we skip a test case conditionally?

We can do this using throw new SkipException(String message). Conditional Skip - A conditional check is an option for the user. The remaining code will be skipped if the condition is satisfied, and a SkipException will be thrown.

Is parallel execution possible in Katalon?

You can run tests parallelly in Katalon TestOps. The load-balancing of Test Runs happens automatically during parallel execution. This results in a Test Run being sent to a ready-to-use local test environment each time it is launched, shortening execution time.

Conclusion

To sum up the article, we learned to skip test cases in Katalon Studio. We also learned to execute tests on multiple devices in parallel.

We hope that this blog has helped you understand the Katalon Studio and its working. To learn more about Katalon and its several features, you can refer to

You can also visit our website to read more such blogs. Make sure you enroll in the courses we provide, take mock tests, solve problems, and interview puzzles. Also, you can prepare for interviews with interview experiences and an interview bundle.

Keep learning and keep growing, Ninjas!

Thank you
Live masterclass