I am writing integration tests for my API application.
I have used WebApplicationFactory to create an instance of the API in memory and now I am writing multiple tests (using XUnit) that follow in sequence to test end to end.
I was able to sort the ordering of the tests using the following: https://learn.microsoft.com/en-us/dotnet/core/testing/order-unit-tests?pivots=xunit
Which works quite nicely.
The issue I am having is can I stop the tests if one fails? as the previous test will be required to pass in order to complete the next...
example...
//GET call to get a date from the DB
Test1()
//POST call to change the date and update in DB
Test2()
//New GET call to get new date, and compare new to original to confirm success
Test3()
If Test2() fails I want to stop all other tests (within that collection - XUnit)
I came across this exact question from an old post but it doesnt seem like it was possible back then?
https://github.com/xunit/xunit/issues/856
Has anyone any idea on this? or can point me in the right direction, ThankYou for any replies