Intro to Writing Tests
Number of APIs: 6
About this collection
Qodex's powerful scripting feature helps you to write a range of API tests in JavaScript, including integration, regression, and contract tests.
Using the collection
Step 1: Send the sample requests and view the response and test results.
Step 2: Replace the sample request URLs with your desired API endpoints.
Step 3: Customize the tests in the Tests
tab if needed. Don't forget to save your changes.
Quick tips for writing tests
- Organize your test scenarios by grouping your requests in collections and folders, and naming them descriptively
- Document your API’s requirements using markdown in the descriptions
- Use variables to simulate more sophisticated user flows
- Common tests that will be run after every request can be added to collection-level tests or folder-level tests
Resources
API testing tips from a Qodex professional
-
API tests - Functional2 DELETE https://postman-echo.com/delete
-
Basic test syntax - pm.expect and pm.response GET https://postman-echo.com/get?foo1=bar1&foo2=bar2
-
API tests - JSON schema v4 validation GET https://postman-echo.com/get?foo1=bar1&foo2=bar2
-
API tests - SQL injection security check POST https://postman-echo.com/post