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
2
votes
1 answer

TFS/MSTest Administrator privileges

I have tests, written in C#, that are run in an automated TFS build. One of the tests requires admin privileges (to access a certificate) so it fails every time in an automated build/test. If I run visual studio as administrator the test passes. I…
Kyle Preiksa
  • 516
  • 2
  • 7
  • 23
2
votes
1 answer

MSBuild and MSTest in non-TFS Build tool with MSBuild Outdir

I've been charged with coming up with a workflow in a non-TFS build tool that will build a solution, run unit test projects in the solution, then package the final output of the build for deployment. I originally had constructed a workflow that used…
Richard Schaefer
  • 525
  • 3
  • 13
  • 45
2
votes
2 answers

How to shim HttpWebRequest

I have a problem trying to shim HttpWebRequest. If you just add a fakes assembly of the System assembly it doesn't work instantly. However if you change the fakes file and add the specific namespace it works.
Ruben-J
  • 2,663
  • 15
  • 33
2
votes
3 answers

MSTest hangs when executing web tests

I'm working on a test migration of a TFS server from 2010 to 2012. We've taken a proof-of-concept server and successfully upgraded it to TFS2012. Now we're trying to repurpose an older build controller, running TFS2010 on Windows 2003 , to run the…
Daniel Mann
  • 57,011
  • 13
  • 100
  • 120
2
votes
0 answers

Testing components of the asynchronous work

We have components encapsulates asynchronous logic. Now my question is, how can I test this, since my assert's time to run properly but honest too early? Give it something like a global on-all-Thread's-wait command? How you do go about it? I Use MS…
2
votes
1 answer

Data Driven Test Removes Whitespace

I am writing a unit test to test the following method. public void MyMethod(string parm1) { // Validate parm1. string[] invalidTokens = new string[] { "/", "{", "}", ".", "--", ";", " ", ",", "=", "(", ")", "\"", "'", "?" }; foreach…
Timothy Schoonover
  • 3,195
  • 4
  • 29
  • 44
2
votes
1 answer

MSTest Results "In Progress"

Once in a while we are getting strange results from MSTEST. All Unit Tests seem to started at the same time - MSTest is just triggering them and moving on. After all of them are started the test run is aborted. What seems strange is the Result "In…
devdimi
  • 2,432
  • 19
  • 18
2
votes
0 answers

End a MSTEST test as passing prematurely

Is there a way to end a mstest as passing prematurely and not run the rest of the test code? Assert.Inconclusive comes the closest, but marks the test as inconclusive, which causes other issues for me (emails are generated based on the status of the…
Seth Micalizzi
  • 449
  • 6
  • 17
2
votes
3 answers

TDD - Why does this Assert.AreSame pass?

I have a test method... [TestMethod] public void MainViewModel_PropertiesReflectDataEntityProperties() { // Arrange var facilityDataEntity = MockRepository.GenerateStub(); var shopOrderDataEntity =…
Riegardt Steyn
  • 5,431
  • 2
  • 34
  • 49
2
votes
0 answers

Running MSTest tests from C#

Is it possible to run all tests of a TestClass class using C# code only ? I found that it is possible to run tests using a command line tool called MSTest, but this is not what I am looking for. I want to run all tests defined in a class, change…
Boris
  • 371
  • 1
  • 10
2
votes
1 answer

MVC Unit Testing with Linq to Sql

I have a controller that is working in my site but failing during unit testing. It is pretty simple and depends on Linq to Sql to return a collection of JSON objects. The Test fails because the DataContext can't find the connection string when…
John Hoge
  • 396
  • 1
  • 3
  • 13
2
votes
1 answer

Visual Studio 2010 throws exception on running unit tests

When I run the unit tests, Visual Studio throws following exception Exception of type 'System.Exception' was thrown. Even it's not possible to run any of the tests, which means it's a setup issue with Visual Studio. Any workaround/solution for…
sarat
  • 10,512
  • 7
  • 43
  • 74
2
votes
1 answer

Is there a way to control of DataCollector calling sequence in MsTest

We use MsTest and Tfs as testing infrastructure. Several custom dataCollectors was installed onto test machine. But I would like to control the process of calling these collectors. Is there a way to configure the scheme of how QtAgent will load and…
DotNetter
  • 426
  • 2
  • 6
  • 19
2
votes
1 answer

Resetting a Static Variable at the Beginning of each MSTest Test Method

I have a N number of MSTest test classes and methods in the same test assembly in the following manner (which makes use of the same static variable). [TestClass] public class TestClass1 { [TestMethod] public void TestMethod1A() { …
Harindaka
  • 4,658
  • 8
  • 43
  • 62
2
votes
2 answers

Is it possible to wrap up Outlook as singleton and test it with MS UnitTesting?

Ok, it seemed like a good idea to make myself a MailService class as a singleton to work with the Outlook class (which itself is a singleton afaik). It worked great at first, but as soon as I tried setting up unit tests (MS Unit Testing) for this…
AardVark71
  • 3,928
  • 2
  • 30
  • 50