Back to Blog
Postman newman6/1/2023 Running the example-synth-json test collection we exported earlier. In this case we are running Newman with the following configuration options: "test" : "newman run collections/example-synth-tests.json -d envs/all_environments.json -n 4 -insecure -reporters cli,html,junit -reporter-junit-export reports/ -reporter-html-export reports/" Let’s create a simple test in javascript to check a status code of 200 is returned from the endpoint: Add some variables for these by clicking on the gear icon on the top right hand corner:Īfter you have added all the environments you can access them from each request by replacing the base url with the variable you just created: Once you have a collection of requests built up you may want to run these against different environments. Here’s how to do it! Create a collectionįirstly use Postman to start building up a collection of requests for the new endpoint: No additional test framework, and minimal amount of code ( javascript ) needed. However after doing some research and in particular looking up some of Danny Dainton’s excellent guides, I realised it’s much simpler to create the tests in Postman and run these directly as part of the CI/CD pipeline. In the past I’ve used different test frameworks, rest clients and a variety of coding languages for this task. The next step is usually to consider how to automate these checks. I start building up collections of different types of requests and verifying the correct response is returned in each case. Whenever I have to test API endpoints Postman is always my first port of call.
0 Comments
Read More
Leave a Reply. |