Table of Contents |
---|
Introduction
SOAtest can automatically create a .tst based on the endpoints found in an OpenAPI/Swagger description. Each .tst generated using the OpenAPI/Swagger wizard will contain REST Clients for all of the defined endpoints.
...
- Swagger 1.0 - 2.0. This includes any Swagger core versions that are compatible with these specs (for example, Swagger core 1.0.0, 1.2.4, 1.3.12, 1.5.0-M1, 1.5.0).
- OpenAPI/Swagger 3.0.
Creating a Test Suite from an OpenAPI/Swagger Definition
Anchor | ||||
---|---|---|---|---|
|
To automatically create a test suite from a valid OpenAPI/Swagger definition:
- Right-click the project in the Test Case Explorer and choose Add New > Test (.tst)...
- Specify a name for the file and click Next.
- Choose the REST > OpenAPI/Swagger option and click Next. For details on accessing the wizards, see Adding a New .tst File to an Existing Project and Adding a New Test Suite.
- Enter the absolute URI for the OpenAPI/Swagger definition file or click Browse to find it on the local machine.
- Choose a Test Suite Type:
- Individual clients: Generates individual test clients grouped by API resource. A test suite is generated for each resource containing test clients for every method available for that resource.
- Test scenarios: Generates test scenarios containing different sequences of API resources. A test suite is generated for each scenario. Uses your LLM provider's REST API with the account information and Chat and Embedding models (be sure you have specified both) configured in your LLM Provider preferences.
- If you choose this option, click Next to advance to the Test Scenario Generation page. Enter brief instructions for the LLM model regarding the test scenarios you would like to create (see Writing AI Prompts; you can also view examples and recent prompts using the menus above the field) and click Generate (this can take a few seconds). If you want the LLM to create more scenarios, click Generate More. If you want the LLM to discard all the scenarios and start over, click Regenerate. You can change the prompt for the LLM before you do either. Enable the scenarios you want to use and disable the ones you don't.
- Note: This feature depends on your provider's LLM, which might produce inaccurate information. Review the results carefully.
- Click Next. The Create Environment page opens.
- (Optional) Specify whether you want to reference an existing environment or create a new one.
- To create a new environment:
- Enable Create a new environment for your project.
- Enter an Environment Name and Variable Prefix.
- To reference an existing environment, enable Reference an existing environment then specify the appropriate environment file.
- For more information on environments, see Configuring Testing in Different Environments.
- To create a new environment:
- Click Finish.
...
Additionally, test scenarios created with OpenAI will automatically have applicable smart test templates applied to them.
Anchor | ||||
---|---|---|---|---|
|
While you can use your LLM provider to help you create a test scenario, there are a few things to keep in mind to get the best results out of the LLM model. For example, when writing a general prompt for an app, it can be helpful to tell the LLM what kind of app it is. For example:
Panel |
---|
Generate test scenarios for this banking app. |
You can also write more detailed prompts for more control over the kinds of test scenarios generated. Here is an example prompt for CRUD:
Panel |
---|
Generate 5 test scenarios that follow the pattern of: 1) GET request on a collection 2) POST request to add to the collection 3) GET request on the collection 4) GET request on specifically the newly added item to the collection 5) PUT request on specifically the newly added item to the collection 6) GET request on specifically the newly added item to the collection 7) DELETE request on specifically the newly added item to the collection 8) GET request on the collection |
If you're having trouble getting the results you want, it might be helpful to use the chat-based AI Assistant to help you create your test scenario.