Skip to main content

StudioAssist in Katalon Studio

StudioAssist is an AI-powered assistant in Katalon Studio that enables testers to write automated tests more effectively and efficiently. StudioAssist is built based on OpenAI GPT API and capable of intelligent code generation and explanation.

StudioAssist is built directly into Katalon Studio, offering testers two capabilities:

  • Code generation: StudioAssist can generate automation test code based on user prompt in the form of code comments.

  • Code explanation: You can select a code block and ask StudioAssist to explain it.

Important:
  • You have an active KSE license.
  • The AI features settings is enabled for the Account. If disabled, you can opt for either a personal OpenAI key, or Azure OpenAI API key. For more details, see StudioAssist Preferences.

Generate code

StudioAssist can generate intelligent automation test code suggestion based on a prompt.

To generate code with StudioAssist, follow these steps:

  1. Open a test case in Script mode.
  2. Provide your code prompt in terms of code comments, single line or block comment.
    For example, the prompt can be:

    /* Write a Katalon Studio test case to perform the following steps.
    * 1. Open browser to the URL stored in G_SiteURL
    * 2. Click the make appointment button
    * 3. Fill in the username and password fields based on the variables
    * 4. Click the login button
    * 5. Verify that the appointment div exists
    * 6. Close the browser
    * */
  3. Select the prompt text. Right-click and select StudioAssist > Generate Code. You can also use the hotkeys, Ctrl + Shift + C for Windows or ^ + + C for macOS.

    Generate Code button

StudioAssist then generates the test script below the prompt text:

StudioAssist Code generation results

Explain code

You can select a code snippet and use StudioAssist to explain the code.

To generate code explanation, follow these steps:
  1. Open a test case with existing test steps in Script mode.
  2. Select the the desired code snippet. Right-click and select StudioAssist > Explain Code. You can also use the hotkeys, Ctrl + Shift + E for Windows or ^ + + E for macOS.
    Explain Code button

StudioAssist then generates the code explanation below the selected script:

StudioAssist code explanation results

Known limitations

As a proof of concept, StudioAssist comes with some limitations:

  • Possible AI hallucinations: StudioAssist might generate code with made-up built-in keywords. You need to double-check the generated code and revise with the valid equivalent.
  • Lack of project context: StudioAssist is not aware of test object library, global variables, custom keywords, other test cases, test data, etc. To make sure that the code is generated with proper variables and locators, you should specify them in the prompt.
  • Requirements for programming and debugging experience: the lack of context awareness leads to incorrect code generation and explanation. Therefore, you might need programming experience and Katalon Studio keyword knowledge for debugging.

Tips to use StudioAssist

To generate desirable results with StudioAssist, you can provide prompt text in certain format and with specific context. The following are some tips to use StudioAssist effectively.

  1. When you need to perform multiple actions, write each action in a bullet point.

    For example, instead of writing a prompt in one paragraph:
    /* Write me a test case that open a browser to a URL, log in to a website, click the login button, input the username and password, then close the browser */
    You can provide a list of actions:
    /* Write me a test case that:
    * 1. Open a browser to a URL
    * 2. Log in to the website
    * 3. Click the login button
    * 4. Input username and password
    * 5. Clock the browser
    */
  2. Break complex tasks into smaller tasks and use StudioAssist on each small task.

  3. To produce output in a specific format, you can provide the context in your comment.

    For example, to generate a custom keyword, you should provide details about the method template, data type, and possible exceptions:
    /*
    * Write me a clickElement method that receives a test object id as a string and does as follows:
    *
    * 1. Find a web element
    * 2. Click the element
    * 3. If cannot click the element, catch WebElementNotFoundException exception and use KeywordUtil.markFailed to say that you cannot find the element
    * 4. If other errors, catch Exception saying that you failed to click the element with the KeywordUtil.markFailed
    * 5. Otherwise, mark the keyword as succeed
    *
    * The clickElement method should have the following format
    *
    * @Keyword
    * def clickElement(<test object string>) {
    * <content of the method>
    * }
    */

StudioAssist FAQs

This section answers some Frequent Asked Questions (FAQs) regarding the use cases and capabilities of StudioAssist.

  1. Can I use StudioAssist without inputting my own OpenAI key?

    When first introduced in 9.0.0, StudioAssist required you to input your own OpenAI API key. With the change in 9.4.0, you can use StudioAssist with a KSE license directly without having to input your own key.

  2. Can I use hotkeys for easy access to StudioAssist?

    You can highlight a piece of code or comment on the script editor and use these shortcuts for StudioAssist quicker:

    On macOS:
    • Generate code: ^ + + C
    • Explain code: ^ + + E
    On Windows:
    • Generate code: Ctrl + Shift + C
    • Explain code: Ctrl + Shift + E
  3. What should I do when the generated test scripts do not run?

    If you are using StudioAssist to generate a script in a test case, make sure that you capture the test object in the Object Repository, define the variables, and list out the actions in steps with corresponding test objects and variables.

  4. Why can't I use StudioAssist?

    If you cannot use StudioAssist, please check the following possible reasons:

    • Your company turned off AI features at the Account level of Katalon. You might see a warning message when trying to use StudioAssist in this case. You will need to contact the Account Owner and turn AI features on to use StudioAssist again.
    • You are not using an Enterprise license. StudioAssist has become an Enterprise feature since version 9.4.0. You need to upgrade your license to continue using it.
    • You are logging in via License Server. StudioAssist is not available when using License Server to log in.
    • You might be behind a proxy. If setting proxy does not work for you, make sure that you are using StudioAssist on Studio version 9.4.0 onwards, where we fixed this issue.
    • If you encountered this error message: The OpenAI secret key is missing. Please provide your key and try again. You might need to:
      • Input your own OpenAI key if you are using Studio in version prior to 9.4.0.

      • Or, upgrade to 9.4.0 onwards and make sure you have a KSE license.

    • If you encounter this error message: {"error":"invalid _grant", "error _description": "Session not active"}. You might log in from 2 machines at the same time, so you need to log out and log in again.