Hi,
I created a new Modular Monolith project about a month ago, and I now want to add a test project to my existing solution.
Could you please guide me on how to add a test project to an existing solution? I noticed that the option to add a test project appears when creating a new solution, but I cannot seem to find it for an existing one.
I have attached a screenshot showing the option as it appears in the "New Solution" menu for reference..
Thanks
1 Answer(s)
-
0
- In ABP Studio, the “Include test projects” option exists only in the New Solution wizard. There isn’t a supported “add test projects to an existing solution” wizard/button afterward.
- The recommended way to add tests to an existing modular monolith solution is to create the test projects manually (or scaffold a throwaway solution with tests enabled and copy the test projects into your solution).
What to do (practical approach)
Create new test projects in your existing solution (same naming convention ABP uses):
YourCompany.YourProject.TestBaseYourCompany.YourProject.Domain.TestsYourCompany.YourProject.Application.TestsYourCompany.YourProject.EntityFrameworkCore.Tests(orMongoDB.Testsif applicable)YourCompany.YourProject.Web.Tests(if you have a Web UI / host to integration-test)
Reference the right layers (typical pattern)
*.Domain.Testsreferences:*.Domain*.TestBase
*.Application.Testsreferences:*.Application*.TestBase
*.EntityFrameworkCore.Testsreferences:*.EntityFrameworkCore*.Application.Tests(so it can “implement” abstract tests against a real EF Core provider)
*.Web.Testsreferences:*.Web(or your host/UI project)*.Application.Tests*.EntityFrameworkCore.Tests
Follow ABP’s current recommended test structure
- ABP’s newer approach is to keep many tests in
Domain.Tests/Application.Testsas abstract base tests, then create concrete implementations inEntityFrameworkCore.Tests(orMongoDB.Tests) so tests are less coupled to the DB provider.
- ABP’s newer approach is to keep many tests in
References (verified)
- https://abp.io/docs/latest/testing/unit-tests
- https://abp.io/community/articles/4vvvp2oy
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)