Starts in:
1 DAY
12 HRS
56 MIN
21 SEC
Starts in:
1 D
12 H
56 M
21 S
Open Closed

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


User avatar
0
suraj.kumbhar created

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 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Steps and code to reproduce?

  • User Avatar
    0
    suraj.kumbhar created

    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 created
    Support Team 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 v9.1.0-preview. Updated on November 20, 2024, 13:06