efcore icon indicating copy to clipboard operation
efcore copied to clipboard

RevEng: Add end to end tests which checks from database script to generated code

Open smitpatel opened this issue 4 years ago • 5 comments
trafficstars

smitpatel avatar Aug 16 '21 21:08 smitpatel

(#29105)

Every time I work in scaffolding area, I miss this so much!

smitpatel avatar Sep 15 '22 01:09 smitpatel

@ajcvickers @bricelam @smitpatel Wonder if I could help here?

Could a SQL Server Database project => generated code path add value?

ErikEJ avatar Sep 15 '22 06:09 ErikEJ

I think best way to handle this with the current pattern/infra we have is to have a class which is combination of https://github.com/dotnet/efcore/blob/release/7.0/test/EFCore.SqlServer.FunctionalTests/Scaffolding/SqlServerDatabaseModelFactoryTest.cs https://github.com/dotnet/efcore/blob/release/7.0/test/EFCore.Design.Tests/Scaffolding/Internal/RelationalScaffoldingModelFactoryTest.cs https://github.com/dotnet/efcore/blob/release/7.0/test/EFCore.Design.Tests/Scaffolding/Internal/CSharpEntityTypeGeneratorTest.cs

So we can test e2e from database script to generate code. It may require some refactoring to account for provider specific tests. I think one of the main reason I had filed this issue because the model we generate to verify generated code is not going to be same as model scaffolder would generate from facets perspective (like no hierarchy or shadow property or value converter etc)

smitpatel avatar Sep 15 '22 06:09 smitpatel

@smitpatel Got it

ErikEJ avatar Sep 15 '22 06:09 ErikEJ

Yeah... We should definitely avoid SQL Server-specific mechanisms here, since we'd want these e2e tests to work on other databases.

roji avatar Sep 15 '22 08:09 roji