Testing ASP.NET Core MVC web apps in-memory

App Center Team

Testing is an important part of the development process of any app. In this blog post we’re going to explore how we can test ASP.NET Core MVC app using an in-memory server. This approach has several advantages:

It’s very fast because it does not start a real server It’s reliable because there is no need to reserve ports or clean up resources after it runs It’s easier than other ways of testing your application, such as using an external test driver It allows testing of traits in your application that are hard to unit test, like ensuring your authorization rules are correct The main shortcoming of this approach is that it’s not well suited to test applications that heavily rely on JavaScript. That said, if you’re writing a traditional web app or an API then all the benefits mentioned above apply.

Feedback usabilla icon