Open Closed

Unit test are not working without modification if generate entity with required navigation property #1983


User avatar
0
christophe.baille created

If you're creating a bug/problem report, please include followings:

  • ABP Framework version: v4.4.3

  • UI type: Angular

  • DB provider: EF Core

  • Tiered (MVC) or Identity Server Separated (Angular): no

  • Steps to reproduce the issue:"

If I generatean entity with a required navigation property I get errors when running unit tests

All unit tests fail and get the error Microsoft.Data.Sqlite.SqliteException : SQLite Error 19: 'FOREIGN KEY constraint failed'.

I fixed the issue by adding the required field on my entity test files, but anytime I regenerate my entity I need to fix it again in both test files MyEntitySetAppServiceTests.cs and MyEntitySetDataSeedContributor.cs by adding a value for this required navigation property.

Will it be possible to fix the test generation to add it automatically? Because of this issue, I do not put navigation property required in any of my entities (even if they should), as it will need too much extra work anytimes we regenerate entities. Otherwise, is there any other way to make it works without having to change it after each generation?

Thanks


3 Answer(s)
  • User Avatar
    0
    alper created
    Support Team Director

    this has been addressed and fixed in v5.0. v5.0.0-beta.1 is now online but you can wait for the v5-rc version to update your project. until your update, you can manually fix the case

  • User Avatar
    0
    christophe.baille created

    Good to know, thank for the update.

    I will close the issue once I will have tried it then

  • User Avatar
    0
    alper created
    Support Team Director

    ok thank you. we can keep this open.

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11