Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integration testing C# WebAPI asp.NET Framework 4.6.1

I am trying to write integration tests in C# for my C# asp.NET Framework 4.6.1 WebAPI which contains simple CRUD functionalities.

I have found little to no documentation on making automated integration tests for .NET Framework 4.6.1 using Microsoft.AspNet.WebApi 5.2.4. I've only found relatively old articles and video's on making integration tests for .NET Core using Xunit and Nunit, but ran into a lot of compatibility issues while trying to somehow make them work on .NET Framework 4.6.1 and WebApi 5.2.4.

I know this question could be considered primarily opinion based, but I would really appreciate any help on the matter.

How to write automated tests for an .NET Framework 4.6.1 Microsoft.AspNet.WebApi 5.2.4 application?

  • Which packages could I use?
  • How do I configure these packages properly?
  • How should I use these packages?

I currently do not use Owin for hosting my application, but invoke my configurations in Global.asax, but I could create a solution configuration which builds the project using Owin if needed.

like image 364
Joas Avatar asked Jul 24 '18 18:07

Joas


People also ask

What is integration testing in CI CD?

Continuous Integration Testing is testing that is focused and executed during the CI process. Testing in the CI process allows for rapid feedback, and by design, stops the progression of the artifact if the minimum quality is not met.

What is integration testing with example?

This type of testing follows the natural control flow hierarchy, i.e., top to bottom. For example, you have a fitness app with four modules – A login page, a profile page, a workout page, and a payment page. The testing of the application will start from the crucial top-level module.

What is meant by integration testing?

Integration testing -- also known as integration and testing (I&T) -- is a type of software testing in which the different units, modules or components of a software application are tested as a combined entity.


1 Answers

After reading the comments it sounds like you’re looking for owin TestServer.

https://www.strathweb.com/2012/06/asp-net-web-api-integration-testing-with-in-memory-hosting/

like image 127
Shane Ray Avatar answered Sep 20 '22 17:09

Shane Ray