فتح مغلق

Integration Testing using SQL Lite : Connection in Efcore module getting null. #3354


User avatar
0
suraj.kumbhar خلقت

We have a commercial microservice template on which we are doing Integration Testing but due to below error not able to move forward.

When we try to debug Test, call goes to below function then on next process it throws error.

`private static SqliteConnection CreateDatabaseAndGetConnection() { var connection = new SqliteConnection("Data Source=:memory:"); connection.Open();

        new TestServiceDbContext(
            new DbContextOptionsBuilder<TestServiceDbContext>().UseSqlite(connection).Options
        ).GetService<IRelationalDatabaseCreator>().CreateTables();

        return connection;
    } 

`

Could you please provide Quick fix on this issue.


3 إجابة (إجابات)
  • User Avatar
    0
    maliming خلقت
    فريق الدعم Fullstack Developer

    hi

    Steps and code to reproduce?

  • User Avatar
    0
    suraj.kumbhar خلقت

    hi

    Steps and code to reproduce?

    Steps to reproduce; Commercial Microservice Version : 5.0.1

    Open any Test case from Efcore Test project

    On any Method like GetlistAsync try to debug.

    Put a breakpoint in CreateDatabaseAndGetConnection()

    Also breakpoint in EfcoreModule as shown in Screenshot. (Here is it throwing an exception)

  • User Avatar
    0
    maliming خلقت
    فريق الدعم Fullstack Developer

    hi

    Commercial Microservice Version : 5.0.1

    Can you try to upgrade to 5.1 or the latest?

    You can also create a new version of Microservice template, and check the code of TestModules

    https://support.abp.io/QA/Questions/2626/The-unit-test-cases-are-not-working-in-the-Abp-IO-Microservice

Made with ❤️ on ABP v8.2.0-preview Updated on مارس 25, 2024, 15:11