Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
UxKjaer
Product and Topic Expert
Product and Topic Expert
1,547
Hello again.

This is the last blog in my small blog series about using Postman for API testing.

You can find the other blogs here:

  1. Using Postman for Odata development

  2. Using environment and variables in Postman [Since dj.adams.sap have already covered environment and variables in this blog. I won’t repeat his.]

  3. How to record http requests to be used in Postman

  4. Using Postman collections in your CI


In this last blog we will look into using the requests you've collected using postman and export them from postman to be used in a potential CI process.

I'm using the tool called Newman which can be grabbed from NPM.

So first thing you need is to make sure you have Node.JS installed on your computer.

Now open your terminal or command prompt and write the following command.

npm install -g newman

This will install newman in a global manner on your pc to be used and referenced from anywhere.

Ok, go into postman and export your collection by clicking the ... icon on the collection and choose export. Use the v2 version.



 

When you've done the export use the terminal / Command prompt to navigate to your folder where you stored the JSON file.

Now write the command newman run <Name of your collection file>

In my case it's

newman run ./Blog.postman_collection 


as I've named my collection Blog.

You will see a series of requests coming from your command line and lastly a summary of whether everything went as planned.



If you want to use this method to create testdata, you can use the option -n and the number of times you want to reexecute the same collection. For example

newman run ./Blog.postman_collection -n 10

Will execute the collection 10 times.

If you have written tests to validate or pre-request scrips, these will also show in the summary.

 

This way you can now add the newman npm module to your package.json file and add as a step into your CI pipeline.

For an example on how to write such a pipeline, have a look at c3d1947136cd4c748a7aa794001af496excellent blog

That's all from me folks. I'll soon write another blog series on how to write Selenium scripts. Stay tuned!

 

 
Labels in this area