A few API Testing tools were explored and findings were recorded here.
Examples available here
Export the Collection from Postman in v2.1 Exported format is not easy to maintain.
Steps to run the tests,
- Install newman CLI
npm install -g newman
- run the test using httpyac with the below command
newman run .\PostmanTests\todos.postman_collection.json
Files with .http extensions that allows to send http requests It supports,
- running scripts to set variables
- Asserting the response status code, fields etc
- Visual Studio
- Intellj HTTP Client
- VSCode Extensions,
Examples available here
There are three tests,
- Fetch all Todos from API
- Asserts on the response status code,
- Sets the variable todoId to be used in the next tests
- Fetch Todo Items based on Id saved from previous test
- Asserts on the response status code
- Fetch Todo Items based with invalid url to get 404 to simulate failure
> {%
// Set todoId as global variable to use it in subsequent request
client.global.set("todoId", response.body[2].id);
%}
//Assert status code
client.test('status code 200', () => {
client.assert(response.status === 200, "Response status is not 200");
});
I tried to run these tests with httpyac CLI. Steps to run the tests,
- Install Httpyac CLI
npm install -g httpyac
- run the test using httpyac with the below command
httpyac Tests.http -all -o response -v
https://playwright.dev/dotnet/docs/api-testing
Example available here
API Requests can be made using .Net Http Client and results can be verified
Example available here
This is my default CLI tool to send API requests,
curl --location 'https://jsonplaceholder.typicode.com/todos/1'
curl --location 'https://jsonplaceholder.typicode.com/todos' | jq '.[].title'
choco install httpie
http https://jsonplaceholder.typicode.com/todos/1
http POST pie.dev/post < files/data.json
This is my favourite tool to fire a quick performace tests on an API.
https://github.com/codesenberg/bombardier
bombardier -c 2 -n 10 https://jsonplaceholder.typicode.com/todos/1