API Tests
API tests check your application's endpoints directly, without a browser. You import an OpenAPI specification, pick the user stories and endpoints to cover, and TestFlair generates the tests. You then refine them in an editor and export them to Postman or Excel.
TestFlair doesn't run API tests yet. Generate and edit them here, then export them as a Postman collection to run in Postman or your own tooling.
- Who can generate and edit Project Admin, QA Manager, Tester (and workspace Owners and Coordinators). Everyone on the project can view them
- Costs Generation uses Flairs
- Where Project → API Tests
- You need User stories, and an OpenAPI specification (JSON or YAML, up to 10 MB)
- YouSelect user stories
- YouImport OpenAPI spec and select endpoints
- AIAI generates API tests
- YouReview and refine in the editor
- Export to Postman or Excel
- Your toolsRun in Postman or your CI
Importing an OpenAPI specification
TestFlair reads your endpoints from an OpenAPI specification instead of asking you to type them in.
- Open API Tests and click the ⋯ button in the header.
- Choose Import OpenApi Spec.
- Drop or browse for your specification file (
.jsonor.yaml, up to 10 MB).
TestFlair parses the file and groups its endpoints. Each endpoint keeps its method: GET, POST, PUT, PATCH or DELETE. Choose View OpenApi Spec from the same menu to browse the endpoints of the most recently imported specification.
Specifications are versioned: importing again adds a new version rather than overwriting the old one, and tests generated earlier keep pointing at the endpoints they were built from.
You can also import a specification during generation, in the wizard's second step.
Generating API tests
- Click Generate APIs (or Generate on the empty page).
- Select user stories: tick the user stories the tests should cover. Use the eye icon to read a story.
- Click Next.
- Select endpoints: import a specification if the project has none, then tick the endpoints that relate to those stories. Import OpenAPI loads a newer specification.
- Click Generate APIs.
Keep the window open while Generating API Tests... is shown. When it finishes, it tells you how many tests were generated.
Functional and end-to-end tests
| Type | What it is | Editor tabs |
|---|---|---|
| Functional | One request to one endpoint | Overview, Parameters, Header, Body, Scripts, Variables |
| E2E | An ordered chain of requests, for a flow across several endpoints | Overview, Steps, Header, Scripts, Variables |
In an E2E test, the Header, Scripts and Variables tabs apply to the whole test, and each step has its own endpoint, Parameters, Header, Body, Scripts and Variables.
What a request is made of
- Variables
- Pre-request script
- Requestmethod, URL, parameters, headers, body
- Post-request script
- Assertion
| Part | What you set |
|---|---|
| Overview | Title (required), Description and the Assertion: what a correct response looks like |
| Parameters | Query parameters as key/value pairs |
| Header | Request headers as key/value pairs |
| Body | The request body, in a JSON editor |
| Scripts | A Pre-request and a Post-request script in JavaScript. The editor autocompletes Postman's pm scripting API, so the scripts carry over to Postman |
| Variables | Key/value pairs used across the request. Values the AI produced carry an AI Generated badge |
Classification
Each test has a Category (Positive, Negative or Edge), a Type (Functional or E2E) and a Priority (Low, Medium or High), shown as badges on the test.
Working with the list
The list shows Total API Tests, Positive Tests, Negative Tests and Edge Cases at the top, with columns Test Name, Method, Type, Category and Priority.
- Switch between Functional, E2E and All with the toggle.
- Search by name, or filter by type, method, category and priority.
- Each row's menu has Edit, Export, Duplicate and Delete.
- Select rows to delete, export or duplicate several at once. Duplicating is a quick way to build a negative test from a positive one.
Editing a test
Click a row to open the test in a drawer. Click Edit, make your changes, then Save. If you close with unsaved changes, TestFlair asks before discarding them. The drawer's ⋯ menu has Duplicate and Delete, and Export downloads the test as a Postman collection.
Maximize the drawer to open the test as a full page, with more room for long bodies and scripts and a comments panel beside the editor. See Collaboration.
Exporting
Click Export in the header and pick a format:
| Format | What you get |
|---|---|
| Excel file | All the project's API tests in a spreadsheet, for review or sharing |
| JSON file | A Postman Collection (v2.1) you can import into Postman and run |
Troubleshooting
My import was rejected
- The file must be a valid OpenAPI specification in JSON or YAML, under 10 MB. Validate it first: a spec that a viewer renders may still be missing fields TestFlair needs.
Generation produced few or no tests
- Make sure the user stories you picked describe behaviour the selected endpoints actually cover. Generation works from the story text, so vague stories produce little.
Generate APIs or Import OpenApi Spec is disabled
- Your role can view API tests but not create them, or import specifications. Ask a Project Admin.
Next Steps
- User Stories — The requirements API tests are generated from
- Test Cases — Browser-level tests for the same project
- Collaboration — Comment on an API test with your team
- Billing — Check your Flair balance