Skip to main content

Generate API tests with AI (beta)

The API test case generator (beta) is an AI-powered feature that enables you to generate test cases based on imported OpenAPI / Swagger specifications. This feature offers a quicker and more efficient method to generate API tests, significantly reducing the time and effort needed compared to manual test case creation. In this beta release, the feature supports generating status code verification.

The test case generator currently supports OpenAPI 2 (Swagger) and OpenAPI 3.

Generate API tests

  • Katalon Studio Enterprise version 9.6.0 onwards.

  • The Account Admin has enabled AI Control for your Account. See: AI Control.

This guide shows you how to use the API test case generator feature (beta) Katalon Studio. Follow these steps:

  1. In Katalon Studio, create or open an API/Web Service project.
  2. In the toolbar, click Import from OpenAPI / Swagger button. You can also right-click Object Repository and select Import > From OpenAPI.
    Import from OpenAPI / Swagger button
  3. In the import dialog, provide the file location or URL of the API specification. Tick Auto-generate test cases for endpoints with AI button, then click OK
    Import specification dialog
    The imported endpoints are automatically stored in Object Repository.
  4. All imported endpoints are then listed for test generation. Select the endpoints to generate test cases, then click Generate tests.
    Select endpoints dialog

    The test case generation process may take a few minutes depending on the number of selected endpoints. You can click hide to let the process run in background while doing other tasks.

  5. Once the test cases are generated, you can select which test cases to save and click Add.
    Select test cases dialog

The generated API test cases are organized in a single folder of Test Cases.

Known limitations

The beta release of API test case generator comes with some limitations:
  • Accuracy: generated test cases might contains made-up code snippet. You need to revise the test cases before executing.
  • Generation time: Test case generation may take a long time. You should click hide to let the generation process in background.
  • Lack of context for test artifacts: The generated test cases do not use available test objects or variables.
  • Limited test case types: Currently the feature only generates status code test cases.

Once the test cases are generated, you need to revise the test scripts to ensure that they can run as expected. For example, the script may use undefined global variable, such as global.baseUrl, you need to create these variables in Global variables and Execution profile.