Integration Tests for ASP.NET Core #39
Labels
Area: Web
Relates to the `AspNetCore` or other web-related functionality.
Priority: 2
Severity 0: Nice to have
Status 5: Complete
Task is considered complete, and ready for deployment.
Type: Improvement
Improves the functionality or interface of an existing feature.
Milestone
ASP.NET Core relies on a number of framework conventions that make it cumbersome to unit test—and which, in some cases, might even limit the benefits of unit testing. This makes them well-suited for integration tests.
Scope
In particular, the following are areas that are difficult to meaningfully unit test but trivial to setup integration tests for:
Performance
The most expensive part of this process is loading a comprehensive database. Given that, the optimal solution will be to establish a stub
ITopicRepository
with hard-coded data which can be loaded into memory.Host
Integration testing works hand in-hand with a host project. We already have a host project. But it typically operates off of a live
SqlTopicRepository
in order to evaluate against real-world conditions. Can this be modified to conditionally use a stub repository, possibly by selecting an alternateStartup
? Or should it be a separate, lighter weight project intended exclusively as a test harness? Likely the latter.Tests
/Views/ContentTypes/{ContentType}[.{View}].cshtml
/Views/{ContentType}/{ContentType|View}.cshtml
/Views/{Controller}/{Action}.cshtml
/Views/Shared/{View}.cshtml
/{rootTopic}/{path}
/{area}/{path}
/{area?}/{controller}/{action?}/{id?}
/{area}/{action?}/{id?}
Git Repository
If we combine the core library, the hosts, the unit tests, and the integration tests, we’re looking at 3-5 projects which are closely related, but only loosely dependent on the other core projects. Does it make sense to move these to a new git repository? That makes good organizational sense, but makes it harder to coordinate versioning, metapackage inclusion, deeply integrated features, and testing. The latter might be solvable with conditional local project dependencies, possibly via a separate reference host repository.
The text was updated successfully, but these errors were encountered: