mstest

MSTest + MSBuild + Many test projects

I am responsible for maintaining the msbuild scripts for a large project. The solution contains about 90 projects each having their own test project. As part of the build process all test projects are agregated and mstest is called once: mstest /textcontainer:project1 /testcontainer:project2 ... This is no longer a viable solution as...

cruisecontrol mstest problem wenn tests fail

hi, i use MSTest with CruiseControl. When I run my compile and tests and all tests pass then I can see the mstest results in my dashboard. for example: 5 tests ran. 5 tests passed. 0 tests failed. when tests fail I would expect to see something like this: 5 tests ran. 1 failed. 4 passed. but if one test fails I get this: 0 tests ra...

Is there a way to execute initializer code before each test in Visual Studio Unit Testing (MSTest) for all tests in a project?

Hi everyone, I have a Unit Test project with 20+ .cs files. I want to run some setup code before each individual test. Kinda like how the [TestInitialize] attribute works. However, I'd need to put that attribute on all 20+ of my .cs files. Is there a way to centralize the initializing code in one place for every test in my entire pr...

MSTest stops debugging tests outside test project in 2010

I have no idea how this started so I'm guessing there's a setting somewhere that I've been unable to find. I have a test that calls a method but when I run debug, it simply will NOT step into that dll. At all. Period. Throws an exception just fine, but it's kind of worthless when I can't step into see what's actually going on. When ...

Using MVCContrib.TestHelpers with MsTest - is there any way to get nicer fail messages?

I'm just starting to use MVCContrib, and I'm really liking the syntactic sugar it adds to various test scenarious. For example, I just wrote this assertion: "~/".Route().ShouldMapTo<SpotController>(c => c.List()); It's brilliant! Well, almost... Instead of, as I'd like, seeing the actual reason why the test fails (I've changed nothin...

Setting up MS Tests 2010 on TeamCity?

Hey all, I've recently installed VS 2010 Ultimate, and decided to move a project to TeamCity, The project contains a few *.dlls with unit tests inside. In VS 2008 the setup procedure, at the build runner stage, would consist of : Setting the path to the *.sln file Setting the VS version (2008) Setting the target(s) such as : "Clean B...

Visual Studio 2010 locks up when running unit tests

I'm running MSTest unit tests in VS2010 and whenever I do the VS IDE locks us and goes to '(Not Responding)' if I try to click on it anywhere. The tests run fine on other people's computers with the same OS (Win7) and the same version of VS2010, has anyone run across this before? Any idea how to debug this? Update: Should mention, I ca...

How to correctly display a dialog from a MSTest method in VS 2010?

I recently upgraded an MSTest project to .NET 4.0 and VS 2010. Several of the tests query an outside vendor service and thus prompt the user for necessary credentials to communicate through our corporate web proxy. This used to work fine in vs2008 but after the upgrade the dialog will only display if the user switches focus from VS to ...

how to run MStest as Admin using a batch file

Dear All, I'm trying to run some automated test using a batch file. I have written all these test cases in VSTS 2008. When I run these test cases using VS IDE, it ran succesfully. But once I try to run my test case using a batch file, it throws error "System.ComponentModel.Win32Exception: The requested operation requires elevation." As...

Getting started with automated integration/unit testing in an existing code base

Background: We have been handed over a very large codebase (1.4 million lines) that is primarily in C#. The application consists primarily of asp.net 2.0 style asmx web services accessing data in a SQL server 2008 database and also in various XML files. There are no existing automated tests in place. We have an automated nightly build in...

TypeInitializationException when running mstest from command line

We have a subset of unit tests which until recently have always been run through Visual Studio. I am now working on a continuous integration setup which will run the tests. All of the tests pass when run through Visual Studio but when I attempt to run them from the command line using mstest they fail with a "TypeInitializationException...

TFS Continuous Build - MSBuild - Running Test fails when search Config files

Hi all, I'm having a little problem with Running Test on VS TFS 2008 Continuous Build. The problem is that MSTest.exe search config file under "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\" path, so the error is: C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\MyConfig.config could not be found. Ther...

Build VS2010 solution on Team Build 2008 - MSTest failed to run

Hello folk, I have a weird problem while building VS2010 solution incl. unit tests on a Team Build 2008 server. It builds the solution and also can run the test without an error, but after running the test I get following warning which makes the build breaking: MSBUILD : warning MSB6003: The specified task executable "MSTest.exe" ...

How to prevent expected exceptions from breaking the debug test run?

When running MSTEST unit tests in debug mode, the execution stops in every expected exception that is thrown. My test looks like this [TestMethod()] [ExpectedException(typeof(ArgumentNullException))] public void ShouldThrowExceptionWhenPassingNull() { object data = null; target.CheckNull(data); } the target method looks like t...

Where to place test files for unit testing

I am writing some units tests and I need to be able to access an external file. I assumed I could just place the file in my solution, mark it to be copied to the output directory, and then access it via a relative path. Unfortunately it seems that unit tests are run in a strange directory. So, instead of running from: "[MyUnitTestProj...

Can I use mstest.exe without installing visual studio?

I want to use mstest.exe to run my unit test on build server, but I don't want to install visual studio on the build server. Can I just install mstest without visual studio? ...

Configure timeout for setup script in LocalTestRun.testrunconfig?

Hi, I am trying to run mstest automation which has a setup script which runs before actual test execution begins. The time required for setup script execution is not configurable in the UI and execution fails if setups job does not complete execution in 5 minutes. Does anyone know if it can be configured directly in LocalTestRun.testr...

MSTest - Best way to determine or specify if a test is running on a dev box or on a builder

Is there a built-in way to determine if a test is running on a dev machine (within Visual Studio) or on a builder (within the MSTest runner)? If there isn't has anyone found a good solution to this? I'm using data driven tests and I want to be able to filter the data source on local dev machines, using a home brewed UI, but I want the ...

Converting NUnit Test Project to MS Test

Hello, Has anyone tried to replace NUnit tests with MS Test, and would be willing to share any tips or points about the complexity? I was considering this, but I have a lot of tests, so outside of assembly/type switching/attribute replacement and all, any pointers? Thanks. ...

MSTest, Accessors, Inheritance, and Private Members

I'm trying to write some tests for an MVC application we're developing. We have a BaseController class that contains the following: public class BaseController : Controller { protected string UserRole { get; private set; } We then have a controller that inherits from the BaseController: public class CustomFieldController : BaseCo...