Generating Test Scripts by OpenAPI Test Generator
1. Overview
The OpenAPI Test Generator creates API test scripts from an OpenAPI 3.x specification and registers the generated cases directly in Testany.
The current implementation uses the same managed Git mirror foundation as Import from Git V2. You do not need to configure a GitHub connection, repository URL, branch, or repository token when using OpenAPI Generate.
Key benefits
- Rapid generation: create positive, positive-boundary, and negative test scripts from the OpenAPI contract with much less manual work.
- Managed storage model: generated artifacts are stored in a Testany-managed mirror, so users no longer maintain a separate target repository for this workflow.
- Traceable generation records: each run is attached to a generation record that you can update, reuse, or delete later.
- Standardized coverage: generated cases follow a consistent scenario model. For the supported scenario matrix, see Appendix.
2. Before You Start
2.1 Prepare a Valid OpenAPI File
- The current UI uses local file upload.
- OpenAPI 3.x and above are supported.
- It is strongly recommended to audit the specification first with an API quality or security tool such as 42Crunch so that generation is based on a stable contract.
2.2 Choose an Available Runtime
- Each generation record belongs to one Runtime.
- The selected runtime is where the generated scripts will be executed.
- Runtimes that are unavailable or unhealthy appear greyed out in the UI and cannot be selected.
2.3 Plan the Generation Record
- The generation record
Namemust be unique and cannot be changed after creation. - When you update an existing record later, that record keeps using its existing runtime.
- The record becomes the lifecycle anchor for the generated cases: future updates and deletion behavior are all scoped to this record.
3. Create a Generation Record
3.1 Open the Generator
- Go to the Test Case Library.
- Click the dropdown next to Register test case.
- Select Generate from OpenAPI.
3.2 Create a New Record
In Step 1/2, click Create new generation record.
3.2.1 Configure the Record
In Step 2/2, provide:
- Name: a unique generation record name. It cannot be changed later.
- Runtime: the runtime that will execute the generated scripts.
- OpenAPI file: upload the local OpenAPI file.
After the file is parsed successfully, Testany shows a confirmation message and lets you continue to endpoint selection.
3.2.2 Select Endpoints and Generate
After parsing:
- Review the discovered endpoints.
- Select the endpoints or path groups you want to generate.
- Click Generate Test Scripts.
When generation succeeds, the success dialog shows the number of selected endpoints and the total number of generated scripts, and provides a shortcut to the Case Library.
3.2.3 Find the Generated Cases
After generation finishes:
- the generated test cases appear in the Test Case Library
- Testany records them as OpenAPI-generated cases under the selected generation record
- you manage them through the generation record and the Case Library, not through a user-owned Git branch
3.2.4 Understand Where the Generated Scripts Live
Generated scripts and support files are stored in a Testany-managed mirror repository behind the scenes.
This means:
- there is no repository URL field in the wizard
- there is no branch field in the wizard
- there is no repository credential field in the wizard
Operationally, this aligns OpenAPI Generate with the Git V2 mirror model while keeping the authoring workflow simpler for end users.
4. Update or Delete a Generation Record
4.1 Update an Existing Record
To update an existing record:
- In Step 1/2, select the existing generation record.
- Upload a new local OpenAPI file.
- Review the parsed endpoints and choose what to generate again.
When you update a record:
- the existing record name and runtime stay unchanged
- the currently selected endpoints are generated or regenerated from the latest uploaded file
- endpoints that were previously generated but are now unselected or no longer exist in the updated file are handled according to their current usage
For previously generated endpoints that are now removed:
- if the corresponding case is not used in any pipeline, it is deleted
- if the corresponding case is already used in a pipeline, it is retained to preserve pipeline integrity, but it is unlinked from the generation record
Retained-but-unlinked cases may later fail if their previously generated source script is no longer present in the managed mirror. Review and replace those cases promptly after the update.
4.2 Delete a Generation Record
Deleting a generation record removes the association between that record and the cases it created.
After deletion:
- cases not assembled into any test pipeline are permanently deleted
- cases already assembled into pipelines are retained, but unlinked from the deleted generation record
If you want those retained cases deleted as well, remove them from pipelines first and then delete them manually from the Case Library.
Because this workflow does not use a user-owned Git repository, there is no external branch or repository for you to clean up after deleting the record.
5. Frequently Asked Questions (FAQ)
ā Question: Why don't I see repository URL, branch, or repository token fields anymore?
š” Answer: The OpenAPI Test Generator now uses a Testany-managed mirror repository internally. The platform owns the storage and synchronization path for this workflow, so end users no longer provide Git repository details in the wizard.
ā Question: What happens if I remove an endpoint from the selection, or the endpoint disappears from the updated OpenAPI file?
š” Answer: The generated case is deleted if it is not used by any pipeline. If it is already used by a pipeline, Testany keeps the case to avoid breaking that pipeline, but removes its association with the generation record.
ā Question: Why can't I delete some generated test cases?
š” Answer: Generated cases that are already assembled into one or more pipelines are protected by the same pipeline-integrity rule. Remove them from pipelines first if you need them deleted permanently.
ā Question: How should I update generated output now?
š” Answer: Reuse the same generation record, upload a new local OpenAPI file, and select the endpoints you want to regenerate. Do not plan around editing a user-owned Git branch, because this workflow no longer uses one.
Appendix
The following table catalogs all supported test scenarios in Testany's generation process. For each scenario, the table specifies:
- Scenario ID: Unique identifier for the test scenario
- Field Type: Data type the scenario applies to
- Scenario: Description of the positive, negative, positive boundary test case
- Required Constraints: OpenAPI specification constraints that must be defined
- Skip Conditions: Circumstances under which the scenario is not generated
| Scenario ID | Field Type | Scenario | Required Constraints | Skip Conditions |
|---|---|---|---|---|
| 1.00 | string | Valid string value matching all constraints | ||
| 1.01 | string | String value not matching specified format | format is defined | |
| 1.02 | string | String value not matching specified pattern | enum is defined | |
| 1.03 | string | String length less than minLength | minLength is defined | enum is defined |
| 1.04 | string | Empty string when minLength > 0 | minLength>0 | enum is defined |
| 1.05 | string | String length greater than maxLength | enum is defined | |
| 1.06 | string | String value not in enum list | enum is defined | |
| 1.07 | string | String value is null when nullable is false | nullable=false | |
| 1.08 | string | Value type is numeric instead of string | type=string | |
| 1.09 | string | Value type is boolean instead of string | type=string | |
| 1.10 | string | Value type is array instead of string | type=string | |
| 1.11 | string | Value type is object instead of string | type=string | |
| 1.21 | string | This field is not present in the payload | The field is required | |
| 1.22 | string | String length equal to minLength | minLength is defined | enum is defined |
| 1.23 | string | String length equal to maxLength | maxLength is defined | enum is defined |
| 2.00 | integer | Valid integer value matching all constraints | ||
| 2.01 | integer | Integer value not matching specified format | format is defined | enum is defined |
| 2.03 | integer | Integer value less than minimum | minimum is defined | enum is defined |
| 2.05 | integer | Integer value greater than maximum | maximum is defined | enum is defined |
| 2.06 | integer | Integer value not in enum list | enum is defined | Any of minimum, maximum, multipleOf is defined |
| 2.07 | integer | Integer value is null when nullable is false | nullable=false | |
| 2.09 | integer | Value type is boolean instead of integer | format is defined | |
| 2.10 | integer | Value type is array instead of integer | format is defined | |
| 2.11 | integer | Value type is object instead of integer | format is defined | |
| 2.12 | integer | Value type is float instead of integer | format is defined | |
| 2.13 | integer | Integer value equals minimum when exclusiveMinimum is true | exclusiveMinimum=true | enum is defined |
| 2.15 | integer | Integer value equals maximum when exclusiveMaximum is true | exclusiveMaximum=true | enum is defined |
| 2.16 | integer | Integer value not multiple of specified number | multipleOf is defined | Any of enum, minimum, maximum is defined |
| 2.17 | integer | Value type is string instead of integer | type=integer | |
| 2.21 | integer | This field is not present in the payload | The field is required | |
| 2.22 | integer | Integer value equal to minimum | minimum is defined | enum is defined |
| 2.23 | integer | Integer value equal to maximum | maximum is defined | enum is defined |
| 2.24 | integer | Integer value just above minimum when exclusiveMinimum is true | exclusiveMinimum=true | enum is defined |
| 2.25 | integer | Integer value just below maximum when exclusiveMaximum is true | exclusiveMaximum=true | enum is defined |
| 3.00 | boolean | Valid boolean value matching all constraints | ||
| 3.08 | boolean | Value type is numeric instead of boolean | type=boolean | |
| 3.10 | boolean | Value type is array instead of boolean | type=boolean | |
| 3.11 | boolean | Value type is object instead of boolean | type=boolean | |
| 3.17 | boolean | Value type is string instead of boolean | type=boolean | |
| 3.21 | boolean | This field is not present in the payload | The field is required | |
| 4.00 | number | Valid number value matching all constraints | ||
| 4.01 | number | Number value not matching specified format | format is defined | enum is defined |
| 4.03 | number | Number value less than minimum | minimum is defined | enum is defined |
| 4.05 | number | Number value greater than maximum | maximum is defined | enum is defined |
| 4.06 | number | Number value not in enum list | enum is define | Any of minimum, maximum, multipleOf is defined |
| 4.07 | number | Number value is null when nullable is false | nullable=false | |
| 4.09 | number | Value type is boolean instead of number | type=number | |
| 4.10 | number | Value type is array instead of number | type=number | |
| 4.11 | number | Value type is object instead of number | type=number | |
| 4.13 | number | Number minimum when exclusiveMinimum is true | exclusiveMinimum=true | enum is defined |
| 4.15 | number | Number value equals maximum when exclusiveMaximum is true | exclusiveMaximum=true | enum is defined |
| 4.16 | number | Number value not multiple of specified number | multipleOf is defined | Any of enum, minimum, maximum is defined |
| 4.17 | number | Value type is string instead of number | type=number | |
| 4.21 | number | This field is not present in the payload | The field is required | |
| 4.22 | number | Number value equal to minimum | minimum is defined | enum is defined |
| 4.23 | number | Number value equal to maximum | maximum is defined | enum is defined |
| 4.24 | number | Number value just above minimum when exclusiveMinimum is true | exclusiveMinimum=true | enum is defined |
| 4.25 | number | Number value just below maximum when exclusiveMaximum is true | exclusiveMaximum=true | enum is defined |
| 5.00 | array | Valid array value matching all constraints | ||
| 5.03 | array | Array length less than minItems | minItems is defined | |
| 5.04 | array | Array is empty when minItems > 0 | minItems>0 | |
| 5.05 | array | Array length greater than maxItems | ||
| 5.07 | array | Array value is null when nullable is false | nullable=false | |
| 5.08 | array | Value type is numeric instead of array | type=array | |
| 5.09 | array | Value type is boolean instead of array | type=array | |
| 5.11 | array | Value type is object instead of array | type=array | |
| 5.17 | array | Value type is string instead of array | type=array | |
| 5.18 | array | Array has duplicate items when uniqueItems is true | uniqueItems=true | |
| 5.21 | array | This field is not present in the payload | The field is required | |
| 5.22 | array | Array length equal to minItems | minItems is defined | |
| 5.23 | array | Array length equal to maxItems | maxItems is defined | |
| 6.00 | object | Valid object value matching all constraints | ||
| 6.03 | object | Object has less properties than minProperties | minProperties is defined | |
| 6.04 | object | Object is empty when minProperties > 0 | minProperties>0 | |
| 6.05 | object | Object has more properties than maxProperties | maxProperties is defined | |
| 6.07 | object | Object value is null when nullable is false | nullable=false | |
| 6.08 | object | Value type is numeric instead of object | type=object | |
| 6.09 | object | Value type is boolean instead of object | type=object | |
| 6.10 | object | Value type is array instead of object | type=object | |
| 6.17 | object | Value type is string instead of object | type=object | |
| 6.19 | object | Object has missing required properties | The property is required | |
| 6.20 | object | Object has additional properties when additionalProperties is false | additionalProperties=false | |
| 6.21 | object | This field is not present in the payload | The field is required | |
| 6.22 | object | Object length equal to minItems | minItems is defined | |
| 6.23 | object | Object length equal to maxItems | maxItems is defined |
Example using test_post_pet_petId_negative_body_status.py:
If the OpenAPI definition for the status field in the POST /pet/{petId} request body is a string with specific constraints (e.g., an enum), the generated script test_post_pet_petId_negative_body_status.py will include tests corresponding to the applicable scenarios from the table above based on those constraints. For instance, if status is defined as a string enum, scenarios like 1.02 (not matching pattern, if pattern defined), 1.05 (length greater than maxLength, if maxLength defined), 1.06 (not in enum list), and type mismatches (1.08, 1.09, 1.10, 1.11) could be generated if relevant constraints are present.
Still have questions?
Our team is here to help. Get in touch and we'll get back to you as soon as possible.