Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2017 Enterprise won't stop running all tests on build

I have a project, composed of a 3 C#/.NET Core class libraries, targeting .NET Standard 2.0. In addition, I have a XUnit test project, where I use FluentAssertions.

When working on the project, I use Visual Studio 2017 Enterprise, with Resharper Ultimate installed.

When running the full suite of tests, my SQL Server 2016 Express database is hit around 8100 times. If I leave my profiler running while working in Visual Studio, I can see that the full suite of tests is executed, whenever I change code and do a build. It's a bit of a nuisance, since it takes a good 1-1½ minute for the tests to finish, and often, I will only want to run a specific subset of the tests, when making incremental changes.

My problem: I can't seem to stop the tests running from running on build.

What puzzles me the most is, that I can't cancel the tests from Test explorer or Resharpers Test window, as they appear not to be running at all. Also, the Test pane of the output window does not show anything except "....Discovering unittests" without progressing any further. My impressions is, that from Visual Studios perspective, the tests are not running at all.

Getting the primary suspects out of the way:

  • The "Run tests after build" button in test explorer is not toggled on.
  • Live unit testing appears to be disabled (The only option from the menu is "Start")

I've spent hours browsing the net trying to figure out what is going on, with no luck. I'm hoping someone here can help me find out why the tests are running, and how to stop them.

This is my first ever StackOverflow question. I hope my questions meets the requirements for asking. If not, please let me know what to do better.

like image 596
Mads Avatar asked Mar 22 '18 09:03

Mads


People also ask

How do you stop a test run in Visual Studio 2017?

You need to close the Test Explorer Window to prevent automatic running.

What is xUnit runner Visualstudio?

xunit.runner.visualstudio. This package contains the VSTest runner. This runner is capable of running . NET Framework projects from xUnit.net v1 and v2, and . NET Core and UWP projects projects from xUnit.net v2.


1 Answers

First I would advise you update VS. There was an issue in test discovery taking long time that was fixed in update 15.7 (See here)

If that doesn't do the trick I advise you try disabling this option in Tools > Options > Test: enter image description here

As this might be attempting to analyse all assemblies in build output folder to discover tests.

like image 182
Mohammad Avatar answered Nov 05 '22 20:11

Mohammad