- ABP Framework version: v6.0.2
- UI Type: Angular / MVC / Blazor WASM / Blazor Server
- Database System: EF Core (SQL Server)
Hi, I have bunch of sql insert statements store in .sql file. This file is being loaded and executed by the data seeder. when DbMigrator runs and it successfully populated the database. but when I run unit tests, all are getting failed because when sqlite seeds the database for tests. it loads that .sql file I'm getting the following error
because IF EXISTS statement doesn't exist in sqllite but its fine with sql server.
how can I handle this situation. plus, if I don't want unit tests to seed specific data how can I handle that
following is the screenshot of .sql file for your reference
3 Answer(s)
-
0
hi
You can convert your sql server file to SQLite. Then use SQLite statements in unit tests.
-
0
Could you please give me any code example. plus, what if I don't want to seed this data in unit tests, how can I remove this seeding file while running unit tests.
-
0
hi
You can exec your sql on
https://github.com/abpframework/abp/blob/dev/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/AbpEntityFrameworkCoreTestModule.cs#L102-L104
You can remove your
Contributor
fromAbpDataSeedOptions
services.Configure<AbpDataSeedOptions>(options => { options.Contributors.Remove... });