views:

319

answers:

4

Hi,

I've been using MSTest so far for my unit-tests, and found that it would sometimes randomly break my builds for no reason. The builds would fail in VS but compile fine in MSBuild - with error like 'option strict does not allow IFoo to cast to type IFoo'. I believe I have finally fixed it, but after the bug coming back and struggling to make it go away again, and little help from MS, it left a bad taste in my mouth. I also noticed when looking at this forum and other blogs and such, that most people are using NUnit, xUnit, or MBUnit.. We are on VS2008 at work BTW.. So now I am looking to explore other options..

I'm working on moving our team to start doing TDD and real unit testing and have some training planned, but first would like to come up with a set of standard tools & best practices. To this end I've been looking online to come up with the right infrastructure for both a build server and dev machines...I was looking at the typemock website as I've heard great things about their mocking framework, and noticed that it seems like they promote MSTest, and even have some links of people moving TO MSTest from NUnit..

This is making me re-think my decision.. so I guess I'm asking - is anyone using MSTest as part of their TDD infrastructure? Any known limitiations it has, if I want to integrate with a build / CI server, or code coverage or any other kind of TDD tool I may need? I did search these forums and mostly find people comparing the 3rd party frameworks to eachother and not even giving MSTest much of a chance... Is there a good reason why.. ?

Thanks for the advice

EDIT: Thanks to the replies in this thread, I've confirmed MSTest works for my purposes and integreated gracefully with CI tools and build servers.

But does anyone have any experience with FinalBuilder?? This is the tool that I'd like us to use for the build scripts to prevent having to write a ton of XML compared to other build tools. Any limitiations here that I should be aware of before committing to MS Test?

I should also note - we are using VSS =(. I'm hoping we can ax this soon - hopefully as part of, maybe even the first step, of setting up all of this infrastructure. Thanks very much again to everyone for your help.

+1  A: 

At Safewhere we currently use MSTest for TDD, and it works out okay.

Personally, I love the IDE integration, but dislike the API. If it ever becomes possible to integrate xUnit.NET with the VS test runner, we will migrate very soon thereafter.

At least with TFS, MSTest works pretty well as part of our CI.

All in all I find that MSTest works adequately for me, but I don't cling to it.

If you are evaluating mock libraries, take a look at this comparison.

Mark Seemann
According to Channel 9 MSTest in VS2010 will let you integrate other test frameworks into the GUI runner. Should be awesome!
Finglas
Thanks for the note. @Mark - any idea of limitations of using MSTest / TeamCity with VS2008 Dev edition? I'm worried it might limiting since we are not on TFS... And what are you using for your build scripts? I was hoping to use FinalBuilder, and am hoping that it plays nice with MSTest / VS2008 Dev..
dferraro
We previously used TeamCity and the limitation with that is that there's no built-in support for MSTest, so you will have to program your own MSBuild task that executes the test suites.
Mark Seemann
+1  A: 

I've been using MS Test since VS 2008 came out, but I haven't managed to strong-arm anything like TDD or CI here at work, although I've messed with Cruise Control a little in an attempt to build a CI server on my local box.

In general I've found MS Test to be pretty decent for testing locally, but there are some pain points for institutional use.

First, MS Test adds quite a few things that probably don't belong in source control. The .VSMDI files are particularly annoying; just running MS Test creates anywhere from 1 to 5 of them and adds them to the solution file. Which means churn on your .SLN in source control, and churn of that sort is bad.

I understand the supposed point behind these extra files -- tracking test run history and such -- but I don't find them particularly useful for anything but a single developer. You should use your build service and CI for that sort of thing!

Second, you either must have Team Foundation Server to run your unit tests as part of CI, or you have to have a copy of Visual Studio installed on your build server if you use, for example, Cruise Control.NET. See this Stack Overflow question for details.

In general, there's nothing wrong with MS Test. But going CI will not be as smooth as it could be.

Randolpho
+1  A: 

I have been using MSTest very successfully in our company. We are currently setting up standardised build processes within our company and so far, we have had good success with TeamCity. For Continuous integration, we use out the box TeamCity configurations. For the actual release builds, we set up large msbuild scripts that automate the entire process.

I really like mstest because of the IDE integration and also that all our devs automatically can use it without installing any 3rd party dependencies. I would not recommend switching just because of the problem you are experiencing. I have come full circle, where we went over to nunit and then came back again. These frameworks are all the same at the end of the day so pick the one that is easiest for most your devs to get access to and start using.

What I suspect your problem might be... sounds like an obscure problem I have had before where incorrect references of dll's (eg: adding explicit references (via browse) to projects in your solution, and not using the project reference) leads to out-of-date problems that only come up after clean checkouts or builds.

The other really suspect issue that I have found before is if you have some visual component or control that has a public property of some custom type that is being serialised in the forms .resx file. I typically need to flag them with an attribute that says SerializationVisibility.Hidden. This means that the IDE will not try to generate setters for the property value (which is typically some object graph). Just a thought. Could be way out.

I trust the tools and they don't really lie about there being a genuine problem. They only misrepresent them or report them as something completely obscure. It sounds to me like you have this. I suspect this because the error message doesn't make sense if all is in order, but it does make sense if some piece of code has loaded up an out of date or modified version of the dll at that point.

Luke Machowski
Thanks for confirming that CI and build servers work fine with MSTest. Why are you using ms build scripts if you have TeamCity though?? And what about FinalBuilder - have you looked into it? It's a high level tool that replaces nAnt/Ant/MSBuild and removes the need for complicated / time consuming manually created scripts. Or does FinalBuilder not play well with MSTest? Can anyone confirm it does play well with it, or if theres some issues, and if so how limiting? I was planning on using FinalBuilder - i'll also edit my original post to include this question. Thanks again for the help all
dferraro
Oh - and this is very important - are you using VS2008?? As we don't have the luxury of Team Foundation - and doubt that it's feasable for the budget...
dferraro
A: 

I have successfully deployed several FinalBuilder installations and the customers have been very happy with the outcome. I can highly recommend it.

Andy