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

Can I use dynamically generated XML file in Data Driven Testing

I am trying to use an dynamically generated XML file with Data Driven test. I am using Visual Studio 2010 and .NET 4.0 . [TestMethod] [DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", @"|DataDirectory|\StudentData.xml", "Student",…
skjcyber
  • 5,759
  • 12
  • 40
  • 60
2
votes
1 answer

Unit testing Windows store app - MSBuild, MSTest and TeamCity

I'm trying to setup CI server (TeamCity 7) and run daily build and smoke test on it for Windows store app. The smoke test should just launch the app, wait for 5 seconds and exit. I created MSBuild script that compiles the code (after watching…
Max JSwing
  • 33
  • 7
2
votes
1 answer

Are there MSTest collection constraints that are similar to NUnits

I am working on a project utilizing MSTest and I need similar constraints for testing arrays/lists that NUnit provides (http://www.nunit.org/index.php?p=collectionConstraints&r=2.4.8) Is there anything similar built-in or as an add-on to the MSTest…
Jon Erickson
  • 112,242
  • 44
  • 136
  • 174
2
votes
1 answer

c# unit test with common code repeated

Possible Duplicate: What would be an alternate to [SetUp] and [TearDown] in MSTest? I'm learning how to use Unit Testing and automated testing in general and have a few questions I can't figure out/find the answer to I currently test by having…
Josh R
  • 1,970
  • 3
  • 27
  • 45
2
votes
3 answers

MSTest for huge legacy codebase

we have a huge codebase with about 1000k lines of native/unmanaged legacy c++ - code and we are going to provide the code with unit tests and MSTest would fit perfectly in our current development environment (TFS, VS 2010, ...). I know that MSTest…
lakai
  • 209
  • 1
  • 4
  • 14
2
votes
1 answer

How to resolve dll binding in MSTest Visual Studio 2012

When trying to right click on a test on Visual Studio 2012 -> Run Tests, I am getting error messages that dlls were not found. "System.IO.FileNotFoundException: Could not load file or assembly 'Recipe.API, Version=1.0.0.0, Culture=neutral,…
Delashmate
  • 2,344
  • 5
  • 26
  • 40
2
votes
2 answers

Timeout in c# tests

Can anyone tell if finally is always executed after a test times out or not. [Timeout(1000)][TestMethod] public void test() { try { System.Threading.Thread.Sleep(2000); } finally { //do something } }
waterbear
  • 69
  • 1
  • 11
2
votes
1 answer

Visual Studio test, Process.Start, SQLCMD and Windows Command Processor error

I'm working with Visual Studio 2012 and I'm developing some integration tests using Visual Studio's test framework (mstest). Some days ago I found some info regarding that now Visual Studio 2012 can execute tests in the output directory (i.e.…
Matías Fidemraizer
  • 63,804
  • 18
  • 124
  • 206
2
votes
2 answers

Relative path inside tests with TeamCity

Inside my MsTests I have to reach and use a file in my project. So I am using Path.GetFullPath(@"......\name_of_file") But when running the build I get a file not found error because the context of the path is the temp directory…
thitemple
  • 5,833
  • 4
  • 42
  • 67
2
votes
2 answers

How can I disable code coverage / assembly instrumentation in Visual Studio 2012?

I have a project upgraded from Visual Studio 2010 to 2012 and the .testrunconfig file was included in the upgrade process. I noticed that it was possible to click "Analyze code coverage" on any of the unit tests that I had run and it would…
2
votes
1 answer

Developer Licence error when running WinRT unit tests using vstest.console.exe from the command line

I'm getting the following error when I try to execute WinRT MSTests from the command line: EXEC : error : Could not start test run for unit tests for Windows Store app: No valid developer license found for running unit tests for Windows Store apps.…
Jon Rea
  • 9,337
  • 4
  • 32
  • 35
2
votes
1 answer

Any way to enable stacktraces in MsTest?

Sometimes I get errors in a MsTest run and there is to little context to track down the problem, for example: Unit Test Adapter threw exception: Type is not resolved for member…
Konstantin
  • 3,626
  • 2
  • 33
  • 45
2
votes
1 answer

New line character is not preserved when I retrieve from xml file. I have used cdata

I am new to unit test case writing using mstest framework and I am stuck in retrieving new line character from the xml file as an input to expected value. Below is the piece of test method public void ExtractNewLineTest() { MathLibraray target…
vasujc
  • 21
  • 2
2
votes
1 answer

Unhide Test Explorer in Visual Studio when running MsTest

In VS2012 my Test Explorer window is set to Auto Hide How to make this window appear when I run tests eg: Ctrl+R, T I am keen to just use the VS test runner.
Dave Mateer
  • 6,588
  • 15
  • 76
  • 125
2
votes
3 answers

How to initialize some tests and not others?

Using TestInitialize(), I can initialize all the tests in the TestClass. But if I want only some tests to be initialize and not others, how can I achieve this?