Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run tests after build not showing in test explorer

According to this Microsoft article on VS2015 there should be a "Run tests after every build" option in the test explorer. There is not. Any idea how to enable it?

vs 2015 test explorer

I am running VS2015 Update 2, but perhaps there are some additional settings I need to enable?

like image 339
oligofren Avatar asked Jun 07 '16 08:06

oligofren


2 Answers

The referred article in your question has a note on the availability on that feature:

Warning

Running unit tests after every build is supported in Visual Studio Enterprise.

I use Community at home and Professional at work and don't have that feature in either of them.

like image 105
Volkan Paksoy Avatar answered Nov 10 '22 14:11

Volkan Paksoy


I am using Visual Studio 2017 Professional and I really want to run tests after build, a feature is only available in Visual Studio Enterprise and currently in Visual Studio 2019 Professional Preview as well. Visual Studio 2019's IntelliSense doesn't do "code completion" well, so I still mainly use Visual Studio 2017.

A work-around to run tests after build in VS 2017 is to run the test from the command line using dotnet vstest.

Simply create a batch file to run dotnet vstest [Your Test Project].dll and add to Project Properties > Build Events > Post-build event command line: call $(ProjectDir)YourBatchFile.bat > Run the post-build event: On successful build.

Below is a sample Output after the build:

enter image description here

like image 1
Weihui Guo Avatar answered Nov 10 '22 14:11

Weihui Guo