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, and 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 click on the Run button, the test case will be executed using the default browser defined in Execution Settings.

Test Environments

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

  • Mobile Browsers: 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 to accept/trust this device.

  • Remote: Make sure you have set up a 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 a default configuration for the remote environment in project settings. Refer to Custom Execution for more details. When you have set up your custom environment, select it from the drop-down list.

Job Progress

The Job Progress is 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 document for troubleshooting issues relating to web test execution.

Debug a test case

Creating automation test cases is a repetitive task that requires a lot of editing and re-running test cases. In many automation tools, when a test case fails and you make certain changes to the script, you usually have to execute the whole script all over again to make sure the test is executed as expected.

To save your precious time from tedious repetitive re-running all unnecessary steps for debugging and to make debugging easier, Katalon Studio provides the following utilities:

  • Debug: Run from here
  • Debug: Enable/Disable steps
  • Debug mode
  • Debug from here
  • Attach source code for debugging

Requirements

  • An active Katalon Studio Enterprise license
  • Katalon Studio version 7.0+

Debug: Run from here

With this feature, you can resume the existing execution quickly. Katalon Studio currently supports Run from here with Chrome, Firefox, and Edge Chromium (Edge Chromium is supported from version 7.3.0+) only. To use it, from the Manual view of a test case:

  1. Start a browser with the Open Browser step, or you must have a currently running browser

  2. Make sure this browser's session is NOT terminated when the execution finishes (Go to Project/Settings/Execution and uncheck the Terminate... options in Post-Execution Options based on your testing needs)

  3. In the Manual view of the test case, right-click on a step, select Run from here and select one of the currently running browser instances to execute your test.

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

Debug: Enable/Disable steps

Katalon Studio allows you to enable/disable one or more test steps before executing the test case to skip unwanted steps during execution. You can use the provided keyboard shortcuts to perform the actions.

  • For Windows:  Ctrl+D (disable) and Ctrl+E (enable) on selected steps.
  • For macOS: command+/ (disable) and option+command+/

Debug mode

The Debug mode is designed to make debugging easy to use, allowing investigating the root causes more quickly. 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. A breakpoint is where Katalon Studio pauses the test execution for you to start debugging.

    mark a breakpoint for the step

  3. Choose a browser for Debug from the main toolbar.

  4. Confirm (select Yes) when being asked to display 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 the current code block
      Step over the current code block
      Return from the current code block
      Run to a specific line
    • Track values of variables using Watch utilities.**

    Watch utilities

    Where:

    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.

Debug from here

From version 7.5.5, Katalon Studio provides Debug from here with Chrome, Firefox, and Edge Chromium. To use it, do as follows:

  1. Start a browser with the Open Browser step, or you must have a currently running browser

  2. Make sure this browser's session is NOT terminated when the execution finishes (Go to Project/Settings/Execution and uncheck the Terminate... options in Post-Execution Options based on your testing needs)

  3. Open a test case in its Script view and double-click on the leftmost side of the script editor to mark a breakpoint. A breakpoint is where Katalon Studio pauses the test execution for you to debug.

  4. Switch to the test case's Manual view, right-click on a step, select Debug from here and select one of the currently running browser instances to execute your test.

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

Attach Source Code for debugging

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