mstest

Has anybody integrated NCover with TFS?

Over the past year my group (some 50 engineers) moved onto Team Foundation Server and are now using it for source control, bug tracking and building. We have tens of thousands of lines of existing NUnit code that we continue to rely on and which we will never convert to MSTest. We have our builds set up such that NUnit posts results wi...

How do I verify that the expected array is the actual array in MSTest?

The following method fails: [TestMethod] public void VerifyArrays() { int[] actualArray = { 1, 3, 7 }; Assert.AreEqual(new int[] { 1, 3, 7 }, actualArray); } How do I make it pass without iterating over the collection? ...

Change Default MsTest Unit Test Wizard Template

My team is using the unit test wizard, but has found the amount of cruft generated annoying. Is there anyway to modify this template? Thanks ...

Is there anything I can do in NUnit that I can't do in MSTest?

This question has been asked in various forms in a number of different forums, but, IMHO, I haven't been able to find a place where it's really answered clearly, so I'm going to reframe it and ask it again. I work in a basically Microsoft Shop. We use TFS, and all of our developers have MSDN subscriptions including the Team Suite editio...

MS Test newbie question

I'm working on an MVC site with an image upload capability, and I want to write a test that will upload an image. Sounds simple. I made an image called TestImage.jpg and set Copy to Output to be "Copy if Newer". In my test I try to load that with the following code: System.Drawing.Image testImage = System.Drawing.Image.FromFile(@"Tes...

Merge several mstest trx files into a single trx file

We use Visual Studio 2008 and MSTest. We have a batch file that the developers use to get latest version, build solution, run database scripts and run all tests. The problem is that we have many test projects. So at the end the developer must open each trx file to check if anything failed. Is there a way to write all test results to a...

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 called from outside the MVC project. I had a look in the auto generated code: public DC(): ...

MSBuild, VS2008 solution and CI - what are the best practices?

I am setting up a CI system for VS2008/C# desktop project, nothing fancy, just a build/test cycle. CI will be running under Hudson using MSBuild/MSTest, but I can't seem to decide on a how to do a few things, maybe you can help me out? My options for running the project in the CI are: Run the .sln directly from MSBuild Run the .csproj...

Unit Testing a Customer's Installation (with NUnit and MSTest)

I've developed a large base of unit tests for my company's application, and dev would like to hand my unit tests over to our support department to help them debug customer installation problems. I wrote my unit tests using mstest, so support would have to install Visual Studio on a customer's machine if they wanted to use my tests out o...

Silverlight Unit Testing

I've searched for this info and see similar questions, but not one that matches very closely to this. If I missed one, I apologize. I was hoping that you'd be able to point me in a direction. I'm working on a Silverlight based project and my team is finally moving toward implementing unit testing. I and another memeber of my team are...

MSTest & Silverlight Unit Test Framework Tutorials

I'm sorry if this appears elsewhere, it may be that my Google-Fu is failing me. I'm in the process of reading Roy Osherove's The Art of Unit Testing and am thrilled to be able to start doing some Test-First work on my current project. Roy's book uses NUnit as the basis for it's training. I find myself in the position of needing to use...

Relative paths with NCover and MSTest.exe

I know this is stupid, but I can't figure it out. In our solution, we specify the relative paths to a file one of our tests needs as - ../../../TestSuite/IniTestFiles/LocalRedir1.xml Now, this works fine when running the testing out of VS with MSTest.exe. However, in NCover all of the tests fail. Does anyone know how I can go about fix...

Why does Resharper 4.5 testrunner sometimes take forever to start my mstests?

I just copied a Visual Studio solution over from another computer. I haven't done any changes, but the Resharper testrunner takes forever to start up my mstests. When the tests are finally running, they run fast. There's a JetBrains.ReSharper.TaskRunner.exe which consumes 48% of my total cpu on my dual core. Visual Studio's internal te...

Running VSTS tests without mstest.exe

From reasons I won't get into, all our unit tests are using the VSTS test framework. I now want to create an MSBuild script that runs the tests, but I don't want to use mstest.exe from various reasons (it's slower, requires Visual Studio installation everywhere, I need to maintain testrunconfig, etc.) I've seen that TestDriven.net and T...

How to use PostSharp with MOQ?

Hello! We are trying to use PostSharp, more specifically the OnMethodInvocationAspect, to intercept the methods of a class. The code runs fine, but when testing it with MOQ, it seems to be messing up with my mocks. If I remove the aspects, all tests succeed. But, if I turn the aspects back on, the expectations on the MOQ mocks are not...

Is there any way to identify if it is a test or not (.NET)?

I want that my application catches the exceptions and e-mail them when running in production, but when I am running my MSTest unit tests I want it to throw the exceptions, so I can debug. My current code always e-mails the exceptions. There is any way to know if the current process was invoked by the unit tests? One way I can think is t...

Categorizing MsTest Cases

I'm looking for the easiest way to categorize my tests so I can run them separately. My organization would be something like the following Units Tests Integrations Tests Systems Test The reasoning for this is all our testing hasn't evolved to be completely automated yet. Most of our unit tests are completely automated, while integ...

Visual Studio Web Test vs. Selenium

This can be a very opinionated question. Please keeps your posts factual. What are the pros and cons of using Microsoft Web Test in Visual Studio? Conversely, what are the pros and cons of Selenium? ...

CustomizableOutDir=true breaks MSTest.exe during Team Build

When using CustomizableOutDir, I'm having problems with TFS Team Build firing off MSTest.exe properly. TFSBuild.rsp /verbosity:diagnostic /p:CustomizableOutDir=true TFSBuild.proj (solutions to build snippet) <!-- code --> <SolutionToBuild Include="$(BuildProjectFolderPath)/../../foo.csproj"> <Properties>OutputPath=$(Bi...

MS Test Project - Accessor not working properly across assemblies

Hi, I have a class 'Job' which takes 3 interfaces as paremters for depedency injection. The first 2 interfaces live in the same assembly / class library as my Job class. The third interface lives in a seperate class library, part of the same solution and references by 'project'. I'm trying to write a unit test using Job_Accessor so th...