We are trying to create some resources (e.g. a database table), and later delete them after running multiple test collections.
We don't want to create and delete them for *every collection*
We tried overriding the Dispose method of the assembly runner with mixed results. This seems to work in Visual studio, but when running it from the VSTS task "Visual Studio Test" it seems as if the dispose method never gets called, which makes us think that the vstest.console.exe might shut down /timeout before calling our teardown code.
Is there another recommended approach?
We do not officially support assembly-level fixtures in the box, but we have a sample that illustrates how to do it: https://github.com/xunit/samples.xunit/tree/master/AssemblyFixtureExample
Looks promising! BeforeTestAssemblyFinishedAsync is exactly what I was looking for, Ill refactor my project and verify that this resolves my issues in VSTS as well. Will report back here ASAP!
I can confirm that this approach solved my issue!
Most helpful comment
We do not officially support assembly-level fixtures in the box, but we have a sample that illustrates how to do it: https://github.com/xunit/samples.xunit/tree/master/AssemblyFixtureExample