Integration Test with .Net Core and Docker

Photo by Sigmund on Unsplash

Let’s Create the Project

We will prepare a very simple ToDo WebApi project for demo purposes. Through this WebApi, we will perform the following operations.

  • Creating a ToDo
  • To be able to query ToDo with Id
  • Labeling ToDo values ​​as “Completed” or “Incomplete”

Creating a Test Environment with Docker

We will write our test cases using the xUnit library, a library that will be familiar to those who write unit test. We will run our application on TestServer and test our application via our test cases. Below we can see the code block that creates the version of our application running on TestServer.

Let’s Run Tests on the CI Pipeline

By adding the below yml file into the project, let’s make the tests run on GitHub Actions in every git-push operation. Thus, we can be sure that our application will work as expected with every change we make.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Adem Catamak

Adem Catamak

var software = ConvertFrom(caffeine)