Only one TestResult folder with MSTest? - mstest

MSTest seems to be creating 25 folders for TestResults, is there a reason for creating 25 and not just 1? If not can I change it to 1?

In Visual studio, go to Tools->Options and look for Test Tools on the left. Under Test Tools, there is a Test Execution option. In there you can change the number of Test Results.
Here's a visual of that process:
http://arcware.net/limit-the-number-of-old-test-results-with-vs2008/
The default is 25.

Related

How do I save test results from Test Explorer in Visual Studio 2017?

I have an issue with Visual Studio 2017. I generally run a set of tests locally on my own computer using Test Explorer and using Microsoft's own Unit Testing tools in the Visual Studio library. This can take quite sometime. Problem is, if I close visual studio at any point, the results of these tests are lost forever: the pass, the fail, the output, everything.
I need a way to save the results of my tests in case this happens. I'd love it if VS didn't just wipe my test results like this.
I have to run many tests in different windows, using the command prompt to do this is incredibly laborious.
You can use the command line tool VSTest.Console.exe command-line options and save the output to file using /Logger: option.
It can be found under
(Visual-Studio-Directory)\(Version-Year)\Common7\IDE\Extensions\TestPlatform
Sample:
vstest.console.exe "C:\TestProjectFolder\TestProject.dll" --logger:trx
You can configure trace logging using a test settings file, documented here.

Test explorer tree view in Visual Studio 2015 (à la SharpDevelop)?

I have just started using Visual Studio 2015 after having used SharpDevelop for several months. One of the things I miss the most is the tree view of the unit tests (Nunit in my case, with the TestAdapter working OK to show the tests in the test explorer). I am used to write the tests a in a separate assembly mirroring the folder and file structure of the project to test, so a tree view in the test explorer should be something natural, the same way a tree view is natural in the solution explorer.
In this way, I could run a single test, or the tests covering a single class, namespace, project or solution, everything from a single view, no need to be regrouping. But Visual Studio just groups the tests according to a few parameters, so I have to constantly change the grouping. Also, in SharpDevelop the tree nodes were preceded by a green/red dot that allowed you to easily find the failing tests.
So, is there any way to have a tree-view-ish window in Visual Studio 2015, showing the unit tests á la SharpDevelop?
I saw this in the ReSharper extension, which is paid.. VS'15' (still in beta https://blogs.msdn.microsoft.com/visualstudioalm/2016/08/05/evolving-the-visual-studio-test-platform-part-2/) appears to be almost there with namespace grouping, but still does not look like a full tree functionality. I am also interested in finding a free alternative.
In Visual Studio 2015 I use AxoCover for running Unit Tests. It provides a nice Tree View of the unit tests, grouping by project and namespace. It works with Visual Studio 2012 - 2017. I haven't heard of a 2019 version of AxoCover though. Hope it helps someone else stuck on old versions of Visual Studio.

VS 2015 Test Explorer is empty

I'm on update 3 with VS2015 and suddenly Test Explorer (for MSTest) doesn't show anything, it's just empty.
I don't have any extensions installed that relate to unit testing, no NUnit stuff, no Resharper etc. Obviously, solution has been compiled. The same for all solutions with unit tests, they all used to show tests in test explorer but suddenly they all are empty.
What does not work:
Rebooting
Restarting VS 2015
Devenv.exe /ResetSettings
Running a test (by right-clicking on test code)
Setting Processor Architecture to X64 in Test Settings
Starting VS in admin mode
Deleting contents of %LocalAppData%\Micr‌​osoft\VisualStudio\12‌.0\ComponentModelCach‌​e
Anyone have a fix?
pom
Please see issue and fix here: https://connect.microsoft.com/VisualStudio/Feedback/Details/2970831. Let us know if this fixed it in your case.

Unit Tests show in Test Explorer but won't run in Visual Studio (2013 & 2015)

I have several ms unit test projects in my solution, when I go to Test Explorer all the unit test projects show up in the list:
When I hit "Run All" there is only one project that is discovered and run.
I can execute the other projects by selecting them individually and hitting "Run Selected Tests" but the Test Projects will not execute together automatically.
These tests use to run fine in the solution but have stopped within the last month or so running when "Run All" is used.
Thanks for any help!
I am using Visual Studio 2015 and faced the same problem few days back - when I clicked on 'Run All', all my Coded UI Tests ran but not my Unit/Integration Tests. Looking at your screenshot, it seems like you are facing the same problem where none of your 264 Unit Tests ran.
In my case -- Clearing my Temp files, resolved the problem for me.
Go to your START Menu and type %temp%
Once your Temp folder opens up, just delete all the contents.
Now go to your Visual Studio IDE, and from your Test Explorer window - click on 'Run All'
You should now see all the test projects(Coded UI, Unit Tests) being identified and executed.
Let me know if this does not solve your problem.

Has anyone integrated NUnit with Visual Studio 2010?

Has anyone integrated NUnit with Visual Studio? I'm trying to set up a build pipeline like this one. But, I'm pretty new to .NET and I'm still understanding how things work. There are many resources in the internet on NUnit + VS, and I'm confused.
I'd recommend you to use Resharper.
As some say, "It just works".
Disadvantages/side effects of this choice in your case could be:
1. Resharper is not free;
2. Running unit-tests is minor part of Resharper - it also includes tons of other features, which you maybe do not need for now(but you can disable most of them in setttings).
Free solution is - Visual Nunit 2010 Visual studio extension. Free and does exactly what you want.
UPDATE
How to add NUnit to your project.
I've found this tutorial. Follow it step-by-step, I've found it helpful and complete for .NET novices.
The only difference is that in Running Unit-Tests section for running tests author uses test runner tool that is distributed within NUnit itself, but you can use ReSharper runner as described in JetBrains' docs
I'm using this:
http://visualstudiogallery.msdn.microsoft.com/c8164c71-0836-4471-80ce-633383031099
Which works quite well for me. You can access it within VS2010 from View->Other Windows->Visual NUnit
I used TestDriven until it was no longer free, I used Resharper but felt it slowed down my machine too much, I tried the VisualNUnit extension but it appeared to spawn multiple processes of itself that would keep a hold on some of my DLLs, I added NUnit itself as a command under Visual Studio Tools (and also with a toolbar button and some macros in Visual Studio to start the current test and attach) but that cost some effort to set up and didn't feel smooth enough after being spoiled with tools like TestDriven. Eventually I tried NCrunch... I am hooked ever since, and I have even started to favor it over TestDriven! the next tool on my "NUnit bucket list" will be the NUnit extension for Visual Studio 11.
PS: NCrunch should work on your Visual Studio 2010 and the homepage has a very decent demo video.
First download and install the NUnit
Step 1: Open Visual studio
Step 2: Open your project
Step 3: Select Properties from Solution Explorer
Step 4: Select Debug option in the properties window
step 5: select 'Start external program' under the section 'Start Action'
Step 6: Select the path of the NUnit file
Step 7: Save it.
After that when you debug your project NUnit will open.
Setting up Visual C#2010 Express with NUnit
The original and still quite ok test runner.
Test Driven .net
Used to be free, but now costs a small fee unless you're a student or open source developer.
Visual Studio 2011(BETA) is compatible with 2010 and provides test runners out of the box. Refer to Visual Studio 11 Beta Unit Testing – What’s New and Visual Studio 11 Beta - Unit Testing Plugins List. For continuous integration (CI) server U can use TeamCity and also run those test on the server.

Resources