-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sunday project: update xUnit conditional test execution #16014
Conversation
So you want the tests to potentially fail more? Refers to: test/EFCore.SqlServer.FunctionalTests/TestUtilities/TestEnvironment.cs:28 in 399e618. [](commit_id = 399e618, deletion_comment = False) |
test/EFCore.Relational.Tests/Utilities/DbParameterCollectionExtensionsTest.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re:
|
@AndriySvyryd It could be a static method--isn't that true for any extension method? What's the reason you're suggesting this? |
399e618
to
17eec52
Compare
It seems to only be useful for these implementations so we can avoid having it popup in any referencing projects. |
@AndriySvyryd That's reasonable. Will do. |
The main changes here are: * Fix attributes that were pointing at non-existent classes * Move conditional check execution to when the tests are running, rather than as part of discovery. This is for two reasons: * Code execution during discovery to, for example, attempt to connect to a database is not ideal. Discovery runs in the background and hence discovery code shouldn't do expensive or fragile things. * Test runners are free to discover tests without those tests having been built. For example, some test runners do discovery based on an AST. The xUnit metadata model handles this, but only if code doesn't attempt to use actual types when it shouldn't. * Be as close to the way xUnit natively works. In other words, remove as much test execution logic as possible and extend only when really necessary. Assembly level condition attributes are problematic for this, since they should apply to all tests in the assembly. That means that all tests need to be `ConditionalFact` or `ConditionalTheory`. This allows every test to determine if it should run, even if it's only disabled at the assembly level. Tested with: * Command-line runner * VS runner * Another one
17eec52
to
ed5a4c6
Compare
The main changes here are:
Assembly level condition attributes are problematic for this, since they should apply to all tests in the assembly. That means that all tests need to be
ConditionalFact
orConditionalTheory
. This allows every test to determine if it should run, even if it's only disabled at the assembly level.Tested with: