Skip to main content

Sample StudioAssist project

This sample project helps you get familiarized with StudioAssist's two features: Generate code and Explain code. These features aim to reduce your time and effort when developing and maintaining test scripts, as well as increase your productivity and improve your experience with Katalon Studio overall.

To learn more about StudioAssist, you can refer to StudioAssist in Katalon Studio.

Important:
  • You have an active KSE license.

Open the StudioAssist sample project

To open the project, go to File > New Sample Project and select Sample StudioAssist Tests Project.

The New Sample StudioAssist Test Project option.

Alternatively, you can download the StudioAssist sample project from our GitHub repository: StudioAssist sample.

Once opened, go to Tests Explorer panel > Test Cases. Here you will find the Explain Code and Generate Code folders, corresponding with the two features.

Explain code

The Explain Code folder contains two test cases: Explain Basic Script and Explain Regular Expression. This section shows you how to use the code explaining feature with the Explain Basic Script test case.
  1. Open the Explain Basic Script test case and switch to the Script view.
  2. Select the script, then right-click > StudioAssist (Beta) > Explain Code.
    The Explain Basic Script test case
StudioAssist generates an explanation for the selected script:

The explanation generated by StudioAssist.

Repeat the above steps with Explain Regular Expression test case to see the following result:The explanation generated by StudioAssist.

Generate basic scripts

The Generate Basic Script 1 and Generate Basic Script 2 test cases demonstrate two different ways you can write prompts to generate the same code.

In the Generate Basic Script 1, the prompt lists out the actions in steps with corresponding test objects and variables.

The Generate Basic Script 1 test case in Katalon Studio.

In the Generate Basic Script 2 test case, the list of test steps is separating with the list of test objects and variables.

The Generate Basic Script 2 test case in Katalon Studio.

The test objects are defined in the Object Repository, and the variables are defined in the Variables tab.

This section shows you how to generate code with Generate Basic Script 1 test case.

  1. Open Generate Basic Script 1 in the Script view.
  2. Select the prompt, right-click > StudioAssist (Beta) > Generate Code.
    Generate code from selected prompt of the test case
    StudioAssist generates the test script from the prompt accordingly.

    Generated test script of the Generate Basic Script 1 test case

  3. Click Run from the main toolbar to execute the test script.

Generate call test case script

In Katalon Studio, you can call another test case as a test step in manual and script view. To learn more about this function, see Call test case in Katalon Studio.

This section demonstrates how to generate a call test case script with StudioAssist.

  1. Open the Generate Script Calling Other Test Case in Script view.
  2. Select the prompt, right-click > StudioAssist (Beta) > Generate Code.
    StudioAssist generates a test script with a Call test case step:

    The generated code with a Call test case step in Katalon Studio.

  3. Click Run from the main toolbar to execute the test script.

Generate script and custom keyword

This section demonstrates generate a custom keyword and script containing that keyword with the Generate Script Containing Custom Keyword test case.

To learn more about custom keywords, you can refer to Introduction to custom keywords in Katalon Studio.

Generate custom keyword:
  1. Go to Keywords > com.example. Open the MyCustomKeyword.groovy file.
    The MyCustomKeyword file in Katalon Studio
  2. Select the prompt, right-click > StudioAssist (Beta) > Generate Code.
    StudioAssist generates the following clickElement keyword.

    Custom keyword generated by StudioAssist

Generate test case script containing custom keyword
  1. Open the Generate Script Containing Custom Keyword in the Script view.
  2. Select the prompt and generate the following test script:
    The generated script containing the custom keyword.
  3. Click Run from the main toolbar to execute the test script.

Data-driven testing with StudioAssist

Data-driven testing (DDT) is a testing method that allows you to run a test script with various data sets. To learn more about DDT with Katalon Studio, see Data-driven testing with Katalon Studio.

You can use StudioAssist to generate test script that creates a CSV data file and data-driven script to perform data-driven testing. Do as follows:

Generate CSV data file
  1. Open the Generate Script Creating CSV data test case in Script view.
  2. Select the prompt, right-click > StudioAssist (Beta) > Generate Code.
    StudioAssist generates a test script that creates a CSV data file.

    The test script that creates a CSV data file generated by StudioAssist

  3. Run the generated test script.
    The CSV data file will be saved in the project folder on your machine.
  4. In the Tests Explorer panel, right-click Data Files > New > Test Data.
    1. In the New Test Data dialog, enter a name and select Data Type as CSV File. Then click OK.
      The new test data dialog in Katalon Studio
  5. Click Browse and select the test_data.csv file to import to Katalon Studio.
Generate Data-Driven script
  1. Open the Generate Data-Driven Script in the Script view.
  2. Generate code from the prompt to get the following result:
    Data-driven test script generated by StudioAssist

    StudioAsisst fetches the predefined variables in the Variables tab of the test case.

Perform data binding
  1. Switch to the Data Binding tab.
  2. In the Test Data section, click Add and select the CSV Test Data file.
    The Test Data Browser dialog.
    Then click OK.
  3. Click Map All to quickly match the variables with the data file column headers that share the same name.
    The Map All option in the Data Binding tab.
  4. Click Run from the main toolbar to execute the test script.
Was this page helpful?