Open Closed

Unit Tests crush after ABP 5.0 update #2309


User avatar
0
mustafasezgin created

After updating to ABP 5.0, our unit tests started to give exceptions about related project's (Domain project which has RabbitMQ connection configuration) RabbitMQ broker connection if it is not connected to broker. In the previous versions unit tests didn't crush when this connection was not established. As a note: Our unit tests don't have any configuration about broker. It crushes because they are using the Domain project.

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

5 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    What is your previous version?

    Is there an error just because of upgrading to 5.0?

    You should exclude Rabbitmq from your unit tests.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    mustafasezgin created

    What is your previous version?

    Is there an error just because of upgrading to 5.0?

    You should exclude Rabbitmq from your unit tests.

    Previous version was 4.4.2.

    Unit Test projects have reference to Domain project and Domain project is trying to connect to broker(RabbitMQ). In the previous version, the failure of Domain project connection, did not prevent the unit tests from passing.

    I did not change anything besides version update.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Domain project is trying to connect to broker(RabbitMQ)

    You can try to prevent it from connecting in the unit test. eg: Create a service to connecting then mock it in the unit test.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    mustafasezgin created

    Domain project is trying to connect to broker(RabbitMQ)

    You can try to prevent it from connecting in the unit test.eg: Create a service to connecting then mock it in the unit test.

    Can you explain a little more, please?

    My project's DomainModule looks like below, and I configure the broker from here.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can add a service to configure AbpRabbitMqOptions. Remove this service from DI in the unit test.

    https://andrewlock.net/simplifying-dependency-injection-for-iconfigureoptions-with-the-configureoptions-helper/

    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 05, 2026, 11:32
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.