Execute and Debug a Test Case

Execute a Test Case

Katalon Studio allows you to run the entire test suite, or an individual test case. Before executing a test case or a test suite, keep in mind the supported execution environments by Katalon Studio.

Open a test case/test suite, then select the environment to run the test case from Run command of the main toolbar. You can also execute the test case using console mode.

If you simply click on the Run button, the test case will be executed using the default browser defined in Execution Settings.

Execution Environments and Instructions

  • Browsers: Simply select to execute your test on one of the supported browsers (Chrome, Firefox, IE, Safari, Edge)

  • Mobile Browsers: Simply select to execute your test on one of the supported devices (Android, iOS)

  • Mobile: Before executing your test, check if you have set up the environment for mobile testing for Windows or for macOS. Select your device among those listed in Katalon Studio.

    Troubleshooting

    If there is no device listed, please make sure the Developer Mode on the phone is turned on, try to unplug and reconnect several times until you are prompted for accepting/trusting this device.

  • Remote: Make sure you have set up default configuration for the remote environment in project settings. Refer to Introduction to Desired Capabilities for more details.

  • Custom: Make sure you have set up default configuration for the remote environment in project settings. Refer to Custom Execution for more details. When you have set up your custom environment, simply select it from the drop-down list.

Job Progress

The Job Progress will be triggered automatically to show the progress while your test case/test suite is being executed.

Troubleshooting

Some factors can affect your execution:

You can also refer to this guide to troubleshoot problems relating to test execution.

Debug a test case

Debug: Execute from a Selected Step

Creating automation test cases is a repetitive task that requires a lot of editing and rerunning test cases. In many automation tools, when the test case fails and users makes certain changes to the script, they usually have to execute the whole script all over again to make sure the test is executed as expected. To save users from the trouble of having to re-run all unnecessary steps, Katalon Studio provides two ways so that users can start the test at their preferred steps:

  • Debug: Execute from selected step
  • Enable/Disable steps

From the Manual view of the test case:

1. Start a browser in Katalon script using 'Open Browser' step. Else, you must have a current session running.

2. Ensure this browser's session is NOT terminated (Go to Project > Settings > Executions > Post-Execution > Terminate... options are unchecked based on your testing needs).

3. Right-click on one of the step you want to execute from, and execute the sesssion.

From the Manual view of the test case, right-click on a step and select Execute from here…. Once this option is selected, all currently running and supported Chrome instances are displayed so that you can select to run the script from the selected step.

If there is no running Chrome browser instances that are previously launched in Katalon Studio, Execute from here... is disabled.

Enable/Disable steps

Katalon Studio also allows users to enable/disable one or more test steps before executing the test case as shown in the screenshot below. Using the shortcuts  Ctrl + D (disable) and Ctrl + E (enable) on selected steps, users can skip unwanted steps when executing the test case.

Enable/Disable steps

As described above, users have two methods to specify steps to be executed. The first method allows users to quickly resume the existing execution, but it only supports Chrome sessions that are launched by Katalon Studio. On the other hand, the "enable/disable steps" method does not have this restriction but users may not be able to execute on specific context as wanted.

Debug mode

Katalon Studio provides the capability for debugging test scripts. Its Debug mode is designed to make debugging easy to use, allowing quickly investigating the issues that cause failure for their automation tests.

The following steps present how to debug a test case:

1. Open a test case and switch to the Script view. Script view Katalon Studio

2. Double-click on the leftmost side of the script editor to mark a breakpoint for the step from which you want to start debugging. mark a breakpoint for the step

3. Choose the browser for Debug from the main toolbar. Choose the browser for Debugging test case

4. Confirm (select Yes) when asked to show the Debug perspective. the Debug perspective.

5. The Debug perspective provides convenient options for debugging purposes. You can:

Navigate execution using commands from the debug toolbar. debug toolbar

Where:

Command Description
  Resume debugging
  Suspend debugging
  Terminate debugging
  Disconnect
  Step into current code block
  Step over current code block
  Return from current code block
  Run to specific line

Track values of variables using Watch utilities. Watch utilitiesWhere:

View Description
Variables You can view all variables associated with the current debugged action using Variables View which is similar to Variables View in Eclipse. Refer to this guide for more details.
Breakpoints You can view all breakpoints using Breakpoints View which is similar to Breakpoints View in Eclipse. Refer to this guide for more details.
Expressions You can inspect data using Expressions View which is similar to Expressions View in Eclipse. Refer to this guide for more details.

6. Stop execution when you complete debugging. Although the debugging mode in Katalon Studio is very similar to that of the popular Eclipse IDE, we manage to retain just enough function to keep the UI clean while providing all the required options to investigate issues when needed. If you have any suggestions or need any support, please send your request here.

Attach Source Code for debugging

Starting from Katalon Studio version 7.0.0, when writing a script or debugging, you can view and interact with the implementation of those components compressed in the com.kms.katalon.core* packages, including:

  • com.kms.katalon.core
  • com.kms.katalon.core.cucumber
  • com.kms.katalon.core.mobile
  • com.kms.katalon.core.webservice
  • com.kms.katalon.core.webui
  • com.kms.katalon.core.windows

You can also go to the source code where you set a breakpoint for debugging test scripts.

Feedback