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
28
votes
4 answers

Is defining TestMethod's in test base classes not supported by MsTest?

This question concerns a general unit test technique with a potentially very useful wide range of applicable scenarios. But it is easier to understand with an example to illustrate my question better. Let's say I want to test that all types that…
Mahol25
  • 3,131
  • 2
  • 22
  • 20
28
votes
4 answers

Chromedriver is extremely slow on a specific machine using Selenium Grid and .net

Overview: Chromedriver works normally on one machine but extremely slowly on two other identical machines. Setup: Selenium Webdriver using .Net for coding and Selenium Grid for distributing the tests. MSTest is being used from within Visual Studio…
28
votes
6 answers

Simulate a delay in execution in Unit Test using Moq

I'm trying to test the following: protected IHealthStatus VerifyMessage(ISubscriber destination) { var status = new HeartBeatStatus(); var task = new Task(() => { Console.WriteLine("VerifyMessage(Start): {0} - {1}",…
Julian Easterling
  • 830
  • 1
  • 10
  • 21
28
votes
1 answer

Running mstest from command line against Visual Studio 2012 native C++ tests

I have a Visual Studio 2012 Solution with a number of native c++ test projects. I can run all of these correctly and successfully from within Visual Studio 2012 using the Test Explorer tab. However, I cannot get the tests to run when running from…
Windelinckx
  • 871
  • 7
  • 9
26
votes
7 answers

MSTest - Hide some unit tests from build server

I have three unit tests that cannot pass when run from the build server—they rely on the login credentials of the user who is running the tests. Is there any way (attribute???) I can hide these three tests from the build server, and run all the…
Adam Rackis
  • 82,527
  • 56
  • 270
  • 393
26
votes
6 answers

c# Resharper 'No Tests Found in Project' / 'Inconclusive: Test wasn't run'

I've got ReSharper v8.2.1 installed. I have a VS2013 solution that contains several test projects. Most of them work just fine. However, one project is giving me trouble. In the Solution Explorer, I right-click the project and select "Run Unit…
djs
  • 1,660
  • 1
  • 17
  • 35
26
votes
6 answers

Error debugging code in visual studio 2012 - Failed to initialize client proxy: could not connect to

I am having Issues debugging unit tests in visual studio. I can run them fine from test explorer. The issue is that I cannot step into the code and debug. Also, I am able to debug other parts of the code that are not unit tests. When I right click…
user2577788
  • 261
  • 1
  • 3
  • 4
26
votes
5 answers

Teamcity running build steps even when tests fail

I am having problems with Teamcity, where it is proceeding to run build steps even if the previous ones were unsuccessful. The final step of my Build configuration deploys my site, which I do not want it to do if any of my tests fail. Each build…
DevDave
  • 6,700
  • 12
  • 65
  • 99
26
votes
19 answers

Resharper 7: MSTest not working - "Test wasn't run"

Since I upgraded to VS2012 and Resharper 7, my previously working MS Tests are not running anymore. The tests are run in an ASP.NET environment. I use the following Attributes: [TestMethod] [HostType("ASP.NET")] …
magnattic
  • 12,638
  • 13
  • 62
  • 115
26
votes
2 answers

How to fail a test that is stuck in an infinite loop?

I have some code that produces an infinite loop. Now I need to write a test that will fail after about 200ms. 200ms will indicate that the code is in the infinite loop. For example: public void CodeUnderTest() { while(true) { } }
O.O
  • 11,077
  • 18
  • 94
  • 182
25
votes
1 answer

Integration Test for Hosted Service in .NET Core

I have a QueueTask Hosted service (.NET Core's new background service) that I'd like to test. My queuedHosted service looks like so: public QueuedHostedService(IServiceProvider serviceProvider, IBackgroundTaskQueue taskQueue, ILoggerFactory…
johnny 5
  • 19,893
  • 50
  • 121
  • 195
25
votes
3 answers

MSTest: how to increase test time

I have one test that needs to work more then 1 minute (VS2008, MSTest, tests are launched from the VisualStudio): const int TestTimeout = 1; [TestMethod] [Timeout(10*60*1000)] // 10 minutes public void Login_ExpirationFail_Test() …
Budda
  • 18,015
  • 33
  • 124
  • 206
25
votes
5 answers

Is it possible to run code after all tests finish executing in MStest

I am writing coded ui tests and I have the application open if it is not already open. Then if one of them fails I close the application the thing is I have multiple tests in multiple projects is there a way to close the application after all of the…
jgerstle
  • 1,674
  • 5
  • 25
  • 35
24
votes
3 answers

MSTest executing all my tests simultaneously breaks tests - what to do

Ok, this is annoying. MSTest executes all of my tests simultaneously which causes some of them to fail. No this is not because my tests are fragile and susceptible to build order rather it is because this is a demo project in which I use a Db4o…
George Mauer
  • 117,483
  • 131
  • 382
  • 612
24
votes
3 answers

MS Test: Getting executing testlocation?

How do I find the equivalent of a path to the executing assembly when running tests under MS Test in VS 2010? I need to know where the test is running from, so that I can set a relative path to a data file that it needs. I am trying to find the same…
David Veeneman
  • 18,912
  • 32
  • 122
  • 187