Numerous of unit tests failing

Topics: General
Mar 28, 2012 at 12:47 PM
Edited Mar 28, 2012 at 12:48 PM

I have successfully build all Runtime.sln artifacts. But a lot of unit tests are failing and hanging. 

I read in docs that there might be problems if .NET 4.5 and MVC4 is already installed (this is exactly my case). 

I'm not able to re-run all of them, in particular I have failures in:

 - System.Web.Mvc.Asyn.Test : hangs up

 - System.Web.Razor.Test : multiple faulires

 - System.Web.WebPages.Deployment.Test: hangs up

I'm running in VS studio (run as administrator) via Resharper test runner. Almost the same with build.cmd.

Is it only me or anyone else having the same? Any workarounds for that?

Mar 28, 2012 at 2:07 PM

You will not be able to successfully run the tests on a box with .NET 4.5 Beta or MVC 4 installed, because of GAC conflicts.

The "can't build/run tests with .NET 4.5" problem is really a temporary one, because we've back-ported an assembly from .NET 4.5 into Web API, but when the 4.5 version is on your box it always takes precedence -- even if it contains older code, which is the case.

The "can't run tests with MVC installed" problem is probably not going away. In general, the MVC installation GACs the exact assemblies that you're working on, and they have the exact same assembly version, so the GAC copy will win -- again, even if it contains older code. Historically speaking, we don't ever leave MVC v.Current installed on our development machines while working on MVC v.Current. (And of course, everything in this sentence that says "MVC" applies equally to Web Pages and Web API.)

Mar 28, 2012 at 2:37 PM

Thanks Brad,

Is it possible to un-install .NET 4.5 and MVC from GAC somehow, will it be anyhow helpful.. ? Or it's just cheeper to setup new 'clean' box for project?

Mar 28, 2012 at 3:55 PM

Standard un-installation through the Programs item in Control Panel should be sufficient.

Mar 28, 2012 at 6:33 PM

Brad,

Any way around the .NET 4.5 conflict when running Windows 8 Consumer Preview (where .NET 4.5 can't be uninstalled afaik)?

Mar 28, 2012 at 6:39 PM

Hi Brad

I've followed all the guidance and I still have a few issues.

(I'm using the resharper test runner)

The SPA.Test project fails to run. Resharper says the project hasn't been built even after specifically building it. I know resharper supports qunit so don't quite know what's wrong there. This may be due to the _Scripts\qunit folder not being present. Should this have come down with the other nuget pagackes? Solution: remove from test run.

1 test will crash the test runner. System.Net.Http.Formatting.Test.Integration JsonNetValidationTest.HittingMaxDepthRaisesOnlyOneValidationError. Probably some stack overflow. Solution: remove from test run.

Many, many tests will fail if the git config option core.autocrlf is not set to true. You should maybe add something to that effect to the Getting and Building Code page! Otherwise, you could use a helper method to compare strings which ignores line ending differences.

Finally, 3 tests in ODataQueryDeserializerTests will fail outside of the USA. Solution: set thread to a known Culture. probably the InvariantCulture?

Hope that helps

James

Mar 28, 2012 at 6:47 PM

I'm having  autocrlf = false and also see that multiple failures with wrong string comparison.

Mar 28, 2012 at 7:03 PM

I knew I'd forget something.

For some reason the resharper test runner is ignoring 69 tests. It seems to be due to there being 2 test classes with the same name. ApiControllerActionSelectorTest and DefaultActionValueBinderTest are defined in 2 test projects.

Solution: don't run both test classes in the same test run OR rename them so there is no duplication OR fix the xunit resharper test runner ;)

Mar 28, 2012 at 7:06 PM

@alexander you will have to do a clean checkout (or a hard reset) with the autocrlf setting set to true. it will then bring everything out with \r\n

Mar 28, 2012 at 7:19 PM

@tgmdbm I would not do that, since it's global change and will bring issues for my other projects.

I think the fix is already pull requested, so let's wait till that is accepted :)

http://aspnetwebstack.codeplex.com/SourceControl/network/forks/xpaulbettsx/gitattributes/contribution/2031

Mar 28, 2012 at 9:14 PM

Cool.

BTW it doesn't have to be a global change.

git config --local core.autocrlf true

This will only affect the current repo.

Mar 29, 2012 at 12:48 PM
dcstraw wrote:

Brad,

Any way around the .NET 4.5 conflict when running Windows 8 Consumer Preview (where .NET 4.5 can't be uninstalled afaik)?

Unfortunately, no. You cannot build or test today on Windows 8.

Mar 29, 2012 at 12:50 PM
tgmdbm wrote:

The SPA.Test project fails to run. Resharper says the project hasn't been built even after specifically building it. I know resharper supports qunit so don't quite know what's wrong there. This may be due to the _Scripts\qunit folder not being present. Should this have come down with the other nuget pagackes? Solution: remove from test run.

1 test will crash the test runner. System.Net.Http.Formatting.Test.Integration JsonNetValidationTest.HittingMaxDepthRaisesOnlyOneValidationError. Probably some stack overflow. Solution: remove from test run.

Many, many tests will fail if the git config option core.autocrlf is not set to true. You should maybe add something to that effect to the Getting and Building Code page! Otherwise, you could use a helper method to compare strings which ignores line ending differences.

Finally, 3 tests in ODataQueryDeserializerTests will fail outside of the USA. Solution: set thread to a known Culture. probably the InvariantCulture?

Hope that helps

James

SPA.Test is a web site with QUnit tests in it. It will not run in R#.

We will be integrating a .gitattributes file that should hopefully resolve the autocrlf issue.

I'll take a look at the other issues.

Thanks!

Mar 31, 2012 at 12:15 PM

http://blogs.jetbrains.com/dotnet/2011/03/resharper-6-introduces-support-for-javascript-unit-testing/

The Resharper Test Explorer displays the tests so there mustn't be much to do to get it working?