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 Name must 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

  1. Go to the Test Case Library.
  2. Click the dropdown next to Register test case.
  3. 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:

  1. Review the discovered endpoints.
  2. Select the endpoints or path groups you want to generate.
  3. 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:

  1. In Step 1/2, select the existing generation record.
  2. Upload a new local OpenAPI file.
  3. 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 IDField TypeScenarioRequired ConstraintsSkip Conditions
1.00stringValid string value matching all constraints
1.01stringString value not matching specified formatformat is defined
1.02stringString value not matching specified patternenum is defined
1.03stringString length less than minLengthminLength is definedenum is defined
1.04stringEmpty string when minLength > 0minLength>0enum is defined
1.05stringString length greater than maxLengthenum is defined
1.06stringString value not in enum listenum is defined
1.07stringString value is null when nullable is falsenullable=false
1.08stringValue type is numeric instead of stringtype=string
1.09stringValue type is boolean instead of stringtype=string
1.10stringValue type is array instead of stringtype=string
1.11stringValue type is object instead of stringtype=string
1.21stringThis field is not present in the payloadThe field is required
1.22stringString length equal to minLengthminLength is definedenum is defined
1.23stringString length equal to maxLengthmaxLength is definedenum is defined
2.00integerValid integer value matching all constraints
2.01integerInteger value not matching specified formatformat is definedenum is defined
2.03integerInteger value less than minimumminimum is definedenum is defined
2.05integerInteger value greater than maximummaximum is definedenum is defined
2.06integerInteger value not in enum listenum is definedAny of minimum, maximum, multipleOf is defined
2.07integerInteger value is null when nullable is falsenullable=false
2.09integerValue type is boolean instead of integerformat is defined
2.10integerValue type is array instead of integerformat is defined
2.11integerValue type is object instead of integerformat is defined
2.12integerValue type is float instead of integerformat is defined
2.13integerInteger value equals minimum when exclusiveMinimum is trueexclusiveMinimum=trueenum is defined
2.15integerInteger value equals maximum when exclusiveMaximum is trueexclusiveMaximum=trueenum is defined
2.16integerInteger value not multiple of specified numbermultipleOf is definedAny of enum, minimum, maximum is defined
2.17integerValue type is string instead of integertype=integer
2.21integerThis field is not present in the payloadThe field is required
2.22integerInteger value equal to minimumminimum is definedenum is defined
2.23integerInteger value equal to maximummaximum is definedenum is defined
2.24integerInteger value just above minimum when exclusiveMinimum is trueexclusiveMinimum=trueenum is defined
2.25integerInteger value just below maximum when exclusiveMaximum is trueexclusiveMaximum=trueenum is defined
3.00booleanValid boolean value matching all constraints
3.08booleanValue type is numeric instead of booleantype=boolean
3.10booleanValue type is array instead of booleantype=boolean
3.11booleanValue type is object instead of booleantype=boolean
3.17booleanValue type is string instead of booleantype=boolean
3.21booleanThis field is not present in the payloadThe field is required
4.00numberValid number value matching all constraints
4.01numberNumber value not matching specified formatformat is definedenum is defined
4.03numberNumber value less than minimumminimum is definedenum is defined
4.05numberNumber value greater than maximummaximum is definedenum is defined
4.06numberNumber value not in enum listenum is defineAny of minimum, maximum, multipleOf is defined
4.07numberNumber value is null when nullable is falsenullable=false
4.09numberValue type is boolean instead of numbertype=number
4.10numberValue type is array instead of numbertype=number
4.11numberValue type is object instead of numbertype=number
4.13numberNumber minimum when exclusiveMinimum is trueexclusiveMinimum=trueenum is defined
4.15numberNumber value equals maximum when exclusiveMaximum is trueexclusiveMaximum=trueenum is defined
4.16numberNumber value not multiple of specified numbermultipleOf is definedAny of enum, minimum, maximum is defined
4.17numberValue type is string instead of numbertype=number
4.21numberThis field is not present in the payloadThe field is required
4.22numberNumber value equal to minimumminimum is definedenum is defined
4.23numberNumber value equal to maximummaximum is definedenum is defined
4.24numberNumber value just above minimum when exclusiveMinimum is trueexclusiveMinimum=trueenum is defined
4.25numberNumber value just below maximum when exclusiveMaximum is trueexclusiveMaximum=trueenum is defined
5.00arrayValid array value matching all constraints
5.03arrayArray length less than minItemsminItems is defined
5.04arrayArray is empty when minItems > 0minItems>0
5.05arrayArray length greater than maxItems
5.07arrayArray value is null when nullable is falsenullable=false
5.08arrayValue type is numeric instead of arraytype=array
5.09arrayValue type is boolean instead of arraytype=array
5.11arrayValue type is object instead of arraytype=array
5.17arrayValue type is string instead of arraytype=array
5.18arrayArray has duplicate items when uniqueItems is trueuniqueItems=true
5.21arrayThis field is not present in the payloadThe field is required
5.22arrayArray length equal to minItemsminItems is defined
5.23arrayArray length equal to maxItemsmaxItems is defined
6.00objectValid object value matching all constraints
6.03objectObject has less properties than minPropertiesminProperties is defined
6.04objectObject is empty when minProperties > 0minProperties>0
6.05objectObject has more properties than maxPropertiesmaxProperties is defined
6.07objectObject value is null when nullable is falsenullable=false
6.08objectValue type is numeric instead of objecttype=object
6.09objectValue type is boolean instead of objecttype=object
6.10objectValue type is array instead of objecttype=object
6.17objectValue type is string instead of objecttype=object
6.19objectObject has missing required propertiesThe property is required
6.20objectObject has additional properties when additionalProperties is falseadditionalProperties=false
6.21objectThis field is not present in the payloadThe field is required
6.22objectObject length equal to minItemsminItems is defined
6.23objectObject length equal to maxItemsmaxItems 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.