Today, we are going to learn how to integrate swagger with .NET Core Web API application. In addition, when we host this API and we want to test the API with automation, we use Postman. To get this automated, we use Newman.
Postman is widely used for API testing. This is one of the best and most easily available tools.
You can download the latest version of Postman from here.
You can install Newman from here. Here, all the instructions are given for ease of the users.
Let’s start demo of implementation of swagger and testing with Postman, with Newman automation.
First, we will create a .NET Core Web API application.

If we run this application, it should be successfully running.
You can read more about swagger and Open API Specification from here. Now, I am considering you have the basic idea of swagger definition.
Let’s integrate Swagger in the Web API application. I am going to use the swashbuckle NuGet package for creating swagger in Web API.
You can get more info on installing which package version and how to configure Web API with swagger at the below link.
Now, considering that project is up and running with mentioned code changes and Swagger is being generated, it should be accessible using swagger URL, as mentioned below.

We can import this swagger in postman using the import functionality of postman tool.

Paste swagger JSON inside Paste Raw text box. Click on Import.

After importing Swagger it will create test cases, as below.

Now, we will add an environment to automate your APIs for different environments, like “Local”, ”Dev”, ” QA”, ”UAT”, and ”PROD”.
Click the “Settings” button in the top-right corner highlighted with yellow color.











Gerson MachadoPosted Aug 1, 2019, 5:57 AM
Your link to source code is broken
Jayesh SonawanePosted Jul 30, 2019, 2:01 PM
thanks alot