You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a case where an exception is thrown when initializing my fixture used in ICollectionFixture, ex:
[CollectionDefinition(nameof(MyCollectionFixture))]
public class MyCollectionFixture : ICollectionFixture<MyFixture>
{
}
public class MyFixture : IAsyncLifetime
{
public async Task InitializeAsync()
{
throw new NullReferenceException("TEST");
}
}
[Collection(nameof(MyCollectionFixture))]
public class MyTest
{
public MyTest(MyFixture myFixture)
{
this.fixture = myFixture;
}
[RetryFact]
public When_X_Then_Y()
{
}
}
I the above example MyFixture.InitializeAsync will be only be called once and the code in test "When_X_Then_Y" will be hit twice.
Hi Anders,
Thanks for reporting this, it isn't something I'd considered before now.
I wonder if we should also retry failures creating the fixture, that way a transient failure in the fixture creation would also be retried. I haven't yet looked into whether that would be possible, but would that work for your use-case?
Hi,
I have a case where an exception is thrown when initializing my fixture used in ICollectionFixture, ex:
I the above example MyFixture.InitializeAsync will be only be called once and the code in test "When_X_Then_Y" will be hit twice.
Would it be possible to look at "TestCollectionStarting" and "TestCollectionFinished" in MessageTransformer so the tests are not retried if the test failed between state "TestCollectionStarting" and "TestCollectionFinished":
https://github.com/xamarin/xunit/blob/master/src/xunit.execution/Sdk/Frameworks/Runners/TestCollectionRunner.cs
With the current code the exception in the fixture is hidden.
Best Regards,
Anders Havn
The text was updated successfully, but these errors were encountered: