Open Closed

How to add "test Projects" for Unit and integration tests #10924


User avatar
0
bpdeveloper created

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

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

1 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent
    • 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)

    1. Create new test projects in your existing solution (same naming convention ABP uses):

      • YourCompany.YourProject.TestBase
      • YourCompany.YourProject.Domain.Tests
      • YourCompany.YourProject.Application.Tests
      • YourCompany.YourProject.EntityFrameworkCore.Tests (or MongoDB.Tests if applicable)
      • YourCompany.YourProject.Web.Tests (if you have a Web UI / host to integration-test)
    2. Reference the right layers (typical pattern)

      • *.Domain.Tests references:
        • *.Domain
        • *.TestBase
      • *.Application.Tests references:
        • *.Application
        • *.TestBase
      • *.EntityFrameworkCore.Tests references:
        • *.EntityFrameworkCore
        • *.Application.Tests (so it can “implement” abstract tests against a real EF Core provider)
      • *.Web.Tests references:
        • *.Web (or your host/UI project)
        • *.Application.Tests
        • *.EntityFrameworkCore.Tests
    3. Follow ABP’s current recommended test structure

      • ABP’s newer approach is to keep many tests in Domain.Tests / Application.Tests as abstract base tests, then create concrete implementations in EntityFrameworkCore.Tests (or MongoDB.Tests) so tests are less coupled to the DB provider.

    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)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on October 16, 2026, 14:19
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.