ASP.NET MVC 2, MSpec and Watin
Yesterday evening I was facing an issue in my base class WebBaseSpec which led to really strange side effects. Basically when I was running one unit test alone it was Green, running all or more than one unit test will fail miserably with the well known STA issue of Watin.
So I thought that I had an issue with the ReSharper MSpec plugin but after some discussion with Alexander GroßI realized that the second failing test was showing another issue than the STA issue.
Going further I realized that when I was checking the following
First I needed to call the ASP.NET MVC RegisterRoutes
which was done in the constructor of my WebBaseSpec class.
That’s was the problem, I was registering the routes several time, one time per test. So first one was ok, second one was failing…
So I modified it to the following, ensuring that the routes were registered only one time!
Now I can run all my functional tests again