arcus-azure / arcus.testing

Reusable testing components used during Arcus testing.
https://testing.arcus-azure.net/
MIT License
5 stars 2 forks source link

`SetupCollection` test core functionality to revert actions during setup #172

Closed stijnmoreels closed 1 day ago

stijnmoreels commented 1 month ago

Is your feature request related to a problem? Please describe. We have a DisposableCollection that takes care when the test fixture is disposed and should revert all the things it set up, but when a test fixture (like a temporary state) has several dependent test fixtures it sets up during its setup, and there is a failure during the setup - we are also left with a corrupt state.

Describe the solution you'd like Introduce a SetupCollection that let's you 'revert' any added setup code previously added.

Describe alternatives you've considered How I usually handled those scenarios, is by try/catching in the 'setup' code and dispose yourself in any kind of factory method where the test fixture is set up.

Additional context Highly related to the already DisposableCollection, but this collection is not really disposable.

stijnmoreels commented 1 month ago

Food for thought, as I'm not sure yet how to come up with the best approach to recommend in this case.

stijnmoreels commented 1 day ago

Actually, the DisposableCollection can be used for this fairly easy. Closing for now.