In article we looked at configuring Swagger UI in ASP.NET Core application, this article looks at using postman and Swagger UI for testing debugging Web API. The sample source code can be found in Git and for demonstration purposes will be using SEIS.Registration.Api project.
Swagger UI:
From the sample source set SEIS.Registration.Api as start up project and the UI rendered in IIS Express will be as shown below:
We will debug two API methods viz., POST to Create a Record and GET to Read/Retrieve a Record
To validate the end points for both POST and GET methods are accessible ensure that there is a HTTP Status Code of 200
Testing POST (aka Create Record)
Run the API project in Visual Studio and attach the Swagger UI process via Debug > Attach to Process
Add the values in the Request under Post and click on Execute
The debugging step within Controller method and the Model passed in can be seen as below:
After creating record with POST method, debugging the GET method will display the record created.
In the next article we will look at using postman for debugging WebAPI.