I want to get rid of the dialog saying
There were build errors. Would you like to continue and run tests from the last successful build
when I am running unit tests (I use test -> run -> all tests
).
How do I do that? I already know how to disable it when running a normal project.
I also want to know how this can ever be a useful feature?
In Visual Studio 2019 Update 16.5 or later you can go to Tools > Options > Projects and Solutions > Build and Run and set 'On Run, when build or deployment error occurs' to one of the options below. Once this is set, running and debugging tests will honor this option as well.
Unit testing is the first testing phase and it is practiced before moving to the phase of integration testing. Hence, before moving for the next testing level, make sure to fix all the identified bugs in the unit testing phase.
You need to close the Test Explorer Window to prevent automatic running.
How do I do that?
You can't.
I also want to know how this can ever be a useful feature?
I find it useful when I am working closely with someone who is configuring test data. I can re-run tests to ensure new test data is valid, without having to worry about compiling any changes that I have done in the meantime.
For example if someone has changed some data in a database, I want to be able to run my tests to ensure that this new data is valid, and I want to be able to run the tests whether the current state of my code compiles or not.
For Visual Studio 2017 / MSTestV2 you can do:
Tools > Options > Project and Solutions > Build and Run
"On Run, when build or deployment errors occur:" "Do not launch"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With