mstest

MS Test Inconsistent failing tests after changes when project is under source control?

I have noticed that if I have a set of regression tests and decide to change a property on one of my objects (DTO) from int to decimal for example - i make all the other changes and the tests pass like normal. But if this project is under source control (VSS specifically) this small change will cause something strange to happen... Simi...

Passing a parameter to MSTests using MSBuild

I've got an issue that was wondering if could be solved in a particular way. I would like to be able to pass a parameter or set some kind of variable in an MSBuild script that will be run on a TeamBuild server. This parameter would be used as a condition in the setup of a TestFixture in MSTest to decided which concrete implementation o...

mstest failing to start...

The run.mstest command is inititated but the following error message displays. No logs are generated nor are any tests run, but the build is reported as successful. [exec] 'C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\MSTest.exe' failed to start. What does this mean? ...

Using a base class for unit test setup and teardown

Assuming Visual Studio.NET 2008 and MsTest are used to run unit tests. When a system is based on a service container and dependency injection unit testing would naturally require the setting up of services. Should these services rather be setup in a base class that all unit tests derive from or in each unit test class. If they should b...

MSTest.exe not finding app.config

I'm currently trying to run MSTest.exe from NCover, but I believe the question could apply generally to running MSTest.exe from the command line. If I have the "/noisolation" argument, then MSTest.exe appears to find and use the app.config as expected. Without it, NCover doesn't capture any coverage information. From my research so fa...

Why does Microsoft.VisualStudio.TestTools.UnitTesting.Assert.Equals() exist?

Description for Assert.Equals() from the MSDN Documentation: Do not use this method. That's it, the full explanation. Uh.. ok, but then ... why is it there? Is it a deprecated method from an earlier version of the framework? Something that's supposed to be used only by other Microsoft Assemblies? It just makes me want to use it all ...

Using Post-Build Event To Execute Unit Tests With MS Test in .NET 2.0+

I'm trying to setup a post-build event in .NET 3.5 that will run a suite of unit tests w/ MS test. I found this post that shows how to call a bat file using MbUnit but I'm wanting to see if anyone has done this type of thing w/ MS Test? If so, I would be interested in a sample of what the bat file would look like ...

Why does MSTest and TestDriven.NET behave differently using this code?

Check out this code: internal static readonly Dictionary<Type, Func<IModel>> typeToCreator = new Dictionary<Type, Func<IModel>>(); protected static object _lock; public virtual void Register<T>(Func<IModel> creator) { lock (_lock) { if (typeToCreator.ContainsKey(typeof(T))) typeToCreator[typeof(T)] = creato...

How can I turn off cached requests in Visual Studio load test

When running a load test I want to turn off cached requests. My web test has the Cache Control setting turned off, which is supposed to mean don't cache. However, it looks like it is caching the images etc; which I don't want. How can I do this? Thanks ...

Data Driven Validation Rules in VSTS 2008 Test Edition

We are using VSTS 2008 to perform some relatively simple web testing of a web application that we have under development. We have data sources defined to provide input data to the tests, and would like to perform our validations based on this data source also. The problem that I have is the VS GUI does not allow me to bind values in vali...

MSTest - Executing Tests Multiple Times

I'm using MSTest to drive Selenium, and I'd like to execute tests against multiple browsers in the same test run. Is there any way to do this? Thanks, Nathan ...

Data driven unit tests with MSTest

I'm working on a project that uses MSTest for unit testing and I need to write some unit tests for a model class thats fairly tightly coupled to the data source. We maintain the source code for the database that the model classes are dependent on in a Database Project (.dbproj). What I was thinking of doing was writing a ClassInitialize ...

Why does the MSTest wizard the F suffix for doubles instead of D?

When I create a test using MS Visual Studio's builtin unit test wizard it creates code with lines like the below: double number = 0F; In C# "F" stands for float, case-independent, and "D" for double. Using "F" suffix instead of "D" leads to precision lost. If it's a bug, where can I report it to Microsoft? ...

Is there a way to get a test results and coverage html report from MSTest

I'd like to be able to produce a HTML based report from the Results.trx and data.coverage files that MSTest creates. Ideally this would just list any failures, and show some basic coverage stats. Does anyone know of a tool that does this? ...

Setup of TFS 2008 for automated testing.

I'm confused. I have TFS installed on my development server, which also doubles as the build machine. The builds work fine when I check-in code, but when the build attempts to run the tests I get an error: MSBUILD : warning MSB6004: The specified task executable location "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\MSTest....

MSTEST/VSTS Reflection Tool

Does anyone know of a tool that will spit out a list of all methods with the [TestMethod] attribute within a solution? What we're trying to accomplish is a review, with the customer, of our Unit Tests (names, not pass/fail status) against the Requirements. We are using VSTS 2008 and Scrum for Team Systems, so I wasn't sure if this wa...

NUnit doesn't find tests in assembly

Hi, I inherited an assembly with MSTest, but these tests were run using nunit-console on the build machine (not sure how it worked). So I decided to sort it out and change them to proper NUnit tests, but now nunit-console (or gui) can't find any tests. They run just fine using ReSharper test runner though. Any idea what could be missing...

How to load web.config while using MS Test

I am testing some business object's Save() method. In order to save object, I need to read connection string from Configuration Manager. But all I get is null value. My settings are in web site web.config. How can I obtain during test runtime. Do I need additional configuration. ...

Mocking objects when using MSTest

I'm just getting started with MSTest (or at least the VS 2008 testing tools, is there a difference?) I'm wanting to test code that uses a session object. Obviously I don't have an HttpContext and I can't simply create one, so the code fails with a NullReferenceException. Is this code simply un-testable? ...

MsTest - executing method before each test

Is it possible to run specific method before each test? I know about TestInitialize attribute but this attribute has "class scope". If it's defined in Test class it will be execute before each test from this class. I want to define method that will be executed before each test defined in assembly. ...