6

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?

oligofren
  • 20,744
  • 16
  • 93
  • 180

2 Answers2

8

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.

Volkan Paksoy
  • 6,727
  • 5
  • 29
  • 40
  • 1
    BTW, don't be deceived if you're looking at the docs for VS 2017; Enterprise is still required. I created issue https://github.com/MicrosoftDocs/visualstudio-docs/issues/1932 to fix the docs. – Carl Walsh Nov 20 '18 at 08:50
1

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

Weihui Guo
  • 3,669
  • 5
  • 34
  • 56
  • or the batch file can simply be `dotnet test --logger "console;verbosity=detailed"`, which can [write the output to the command line](https://stackoverflow.com/a/56791987/4271117). – Weihui Guo Nov 07 '20 at 03:50