I recently started using XUnit. I’m still discovering what is possible using this unit test framework.
Before I was using NUnit, although I really liked it I always forgot what exact attribute I needed to control the lifecycle of my tests. I had to look up in the documentation if I needed a SetupFixture, a OneTimeSetup or a Setup attribute.
In XUnit there is a lot less magic going on and you can fallback to standard .NET idioms like the usage of the constructor and the IDisposable.Dispose() method.
With these 2 you can already get quite far, but if necessary you can also use
Before I was using NUnit, although I really liked it I always forgot what exact attribute I needed to control the lifecycle of my tests. I had to look up in the documentation if I needed a SetupFixture, a OneTimeSetup or a Setup attribute.
In XUnit there is a lot less magic going on and you can fallback to standard .NET idioms like the usage of the constructor and the IDisposable.Dispose() method.
With these 2 you can already get quite far, but if necessary you can also use
- Class Fixtures: shared object instance across tests in a single class
- Collection Fixtures: shared object instances across multiple test classes