❔ xUnit single setup and teardown
Hello,
So, I'm currently in the progress of switching from NUnit to XUnit and I was wondering how I could achieve this behaviour:
I have a test class containing around 10 integration tests. This class inherits from a base class which prepares test containers for this context.
The goal would be:
There are ways around this with static fields / properties, but I don't feel like this is the clean approach here.
Any advice?
So, I'm currently in the progress of switching from NUnit to XUnit and I was wondering how I could achieve this behaviour:
I have a test class containing around 10 integration tests. This class inherits from a base class which prepares test containers for this context.
The goal would be:
- Call the base classes constructor once, which prepares the testcontainer
- For every test, call an initialize to start the container before the test, and a teardown to stop the container after the test
- After all 10 tests ran, call a single teardown which makes sure the container is gone.
There are ways around this with static fields / properties, but I don't feel like this is the clean approach here.
Any advice?
