Testing is an essential part of developing any application. There are various types of tests. Unit tests are used to check if the output of blocks or units of code conforms to the desired results. Integration tests are used to check if the different parts of the application work as expected when they are assembled together. In this article I will discuss how we can write and execute integration tests using ASP.Net Core.
Create a new ASP.Net Core project
First off, let’s create an ASP.Net Core project in Visual Studio. Assuming that .Net Core is already installed on your system, follow these steps to create an ASP.Net Core application in Visual Studio 2017.
- In the Visual Studio IDE, click on File > New > Project.
- Select “ASP.Net Core Web Application (.Net Core)” from the list of the templates displayed.
- Specify a name for the project.
- Click OK to save the project.
- In the “New .Net Core Web Application…” window, select “Web API.”
- Ensure that “Enable Docker Support” is unchecked.
- Select “No Authentication” as we won’t be using authentication in this example
- Click OK.
A new ASP.Net Core project will then be created with an example
Controller to build and execute RESTful HTTP services.