Questions tagged [mstest]

Microsoft .NET Unit Testing Framework (MSTest)

Microsoft .NET Unit Testing Framework - MSTest to integrate unit testing (also load testing, coded UI testing, etc.) into Visual Studio.

MSTestv2 contains a command-line utility that helps you run automated tests. You can run all or specific tests contained in a test assembly or event categorize them by:

  • Test Categories
  • Test Type
  • Test Lists

It also has an option to publish the test results in a Team Project on Tfs.

3252 questions
75
votes
9 answers

Where is mstest.exe located?

I need to run mstest from the command line - where in the world is this exe located? Can anyone give me a clue? Edit: I only have Visual Studio 2010 installed
George Mauer
  • 117,483
  • 131
  • 382
  • 612
75
votes
6 answers

MSTest Equivalent for NUnit's Parameterized Tests?

NUnit supports a feature where you can specify a set of data inputs for a unit test to be run multiple times. [RowTest] [Row(1001,1,2,3)] [Row(1,1001,2,3)] [Row(1,2,1001,3)] public void SumTests(int x, int y, int z, int expected) { ... } What's…
blaster
  • 8,876
  • 11
  • 48
  • 77
72
votes
13 answers

Can't read app.config in C# .NET Core unit test project with ConfigurationManager

I've created a simple unit test project to read an app.config file. Target framework is Core 2.0. I also created a Core 2.0 console app, to sanity-check myself to make sure I wasn't doing anything weird (same test passed as expected in a .NET 4.6.1…
Broots Waymb
  • 4,713
  • 3
  • 28
  • 51
71
votes
2 answers

Visual Studio 2013 MSTest vs NUnit

My company is upgrading our Visual Studio 2012 to 2013 Premium. In the midst of this, we are also looking to start automating our tests using Visual Studio Team Services I have read a couple of MSTest vs nUnit posts and articles in the past but most…
Null Reference
  • 11,260
  • 40
  • 107
  • 184
65
votes
18 answers

MSTest: No tests are run because no tests are loaded or the selected tests are disabled

I have a c# solution with the following structure: mySolution myProject myProject.MSTests References Microsoft.VisualStudio.QualityTools.UnitTestFramework sutMSTests.cs sutMSTests.cs: [TestClass()] public class sutMSTests { …
gerryLowry
  • 2,626
  • 5
  • 35
  • 44
64
votes
12 answers

Visual Studio 15.8.1 not running MS unit tests

When I updated Visual Studio to the latest version, 1 of my test projects stopped running tests and outputted this message: Test project {} does not reference any .NET NuGet adapter. Test discovery or execution might not work for this project. It…
csharpsql
  • 2,190
  • 1
  • 19
  • 24
63
votes
4 answers

Why does Visual Studio create a new .vsmdi file?

If I open a solution in Visual Studio 2008 and run a unit test then VS creates a new .vsmdi file in the Solution Items folder and gives it the next number available e.g. My Solution2.vsmdi. Any idea why VS is doing this and how I can get it to stop…
Guy
  • 65,082
  • 97
  • 254
  • 325
63
votes
3 answers

DataTestMethod and DataRow attributes in MSTEST

I have seen in a Microsoft video about Visual Studio update 2 regarding these attributes. However, I can't find any other information about them and can't get a project to build with them. Does anyone know anything about these attributes or how to…
Simon Vane
  • 1,914
  • 3
  • 19
  • 23
62
votes
10 answers

MSTest run fails because source assembly is not trusted

I just added xUnit to our test project (for the Asserts, we're still using MSTest as the framework) and immediately the test runs refused to execute any of the tests. This is the error message: Failed to queue test run '{ .... }' Test run…
Jedidja
  • 16,610
  • 17
  • 73
  • 112
62
votes
5 answers

How to set up LocalDb for unit tests in Visual Studio 2012 and Entity Framework 5

We have a Visual Studio 2012 ASP.NET MVC project using Entity Framework 5. There are some unit tests that depend on a database. Setting up the app.config file in the test project to use a central SQL Server database works fine. However, it would be…
61
votes
8 answers

Stepping through and debugging code in Unit tests

I have not been able to debug or step through unit test. Here is my sample test code... using System; using System.Text; using System.Collections.Generic; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; using…
dotnet-practitioner
  • 13,968
  • 36
  • 127
  • 200
59
votes
3 answers

xUnit Equivalent of MSTest's Assert.Inconclusive

What is the xUnit equivalent of the following MSTest code: Assert.Inconclusive("Reason"); This gives a yellow test result instead of the usual green or red. I want to assert that the test could not be run due to certain conditions and that the test…
Muhammad Rehan Saeed
  • 35,627
  • 39
  • 202
  • 311
55
votes
4 answers

Ignore IgnoreAttribute

We have MSTest tests which automatically run in hourly production. One of these tests is marked with [Ignore] attribute because it is not yet ready to run it in our production environment. Now I want to start that test (only) on my local environment…
brgerner
  • 4,287
  • 4
  • 23
  • 38
54
votes
11 answers

Error when running unit tests in visual studio: Test-case objects missing

I'm getting the following error when running unit tests from visual studio using resharper: Test-case objects missing for the following elements: ... Rebuild the project and try again In the tooltip next to the unit test method it says:…
goku_da_master
  • 4,257
  • 1
  • 41
  • 43
52
votes
7 answers

How do I use MSTest without Visual Studio?

Does MSTest have standalone GUI similar to nUnit that lets me use it and run test without visual studio? What is the official site for MSTest where I can learn more about how to use it?
bitbonk
  • 48,890
  • 37
  • 186
  • 278