I have a problem very similar to this one[1], but since that is quite
old (sept '09) and basically only says "upgrade your build runners",
I'm not sure my problem has the same cause.
[1]:
http://groups.google.com/group/mvccontrib-discuss/browse_frm/thread/d682a65f81b9334e/39230b03864d8422?lnk=gst&q=route+tests+on+build+server#39230b03864d8422
I have a bunch of tests that make use of the .ShouldMapTo<T>()
extension (see code below) that all pass on my machine, but fail on
the build server. We have the NUnit console runner checked into the
version control system, so it shouldn't be a versioning problem,
unless the TeamCity task to run NUnit grabs a console runner from
somewhere else on its own. (But all the other tests work, so it
definitely has a consolerunner *somewhere*...)
I don't know how to troubleshoot this further, so any help is greatly
appreciated.
I'm running NUnit-2.5.10, and the msbuild script has the following (in
suitable places):
<PropertyGroup>
<NUnitPath Condition="'$(NUnitPath)' == ''">$(RootPath)/packages/
NUnit.2.5.10.11092/Tools</NUnitPath>
</PropertyGroup>
<NUnitTeamCity
Assemblies="@(TestAssemblies)"
NUnitVersion="NUnit-2.5.10"
Condition=" '$(teamcity_dotnet_nunitlauncher_msbuild_task)' !=
'' " />
This is a sample test that passes on my machine, but fails on the
build server:
[TestFixture]
public class SampleTests
{
[SetUp]
public void Init()
{
// MvcApplication is my application type, defined in
Global.asax.cs
MvcApplication.RegisterRoutes(RouteTable.Routes);
}
[TearDown]
public void Exit()
{
RouteTable.Routes.Clear();
}
[Test]
public void AddObjectIsRouted()
{
"~/Inspection/
AddObject/".Should().MapTo<InspectionController>(c =>
c.AddObject(null, null));
}
}