How to Mock MVC4 application when UI testing with Watin?

155 Views Asked by At

What Im trying to achieve is to write UI tests for my MVC4 web application using Watin. Now I create a Browser object and open on URL localhost:xxxxx.

Problem is that the code running on localhost:xxxx using IIS Express is using production code which I dont want to be doing during test. In test I want for instance my IAuth and IDataProvider implementations to behave differently.

How do you UI test on a mocked instance of your application?

Ideas? :)

1

There are 1 best solutions below

0
On BEST ANSWER

Solution was to make a bat file which runs a msbuild command which deploy to my local IIS. This works like a charm.

C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe C:\Source\...\ProjectName.csproj       /p:DeployOnBuild=true /p:PublishProfile="UnitTest" /p:Platform="Any CPU" /p:OutputPath="C:\inetpub\web" /p:VisualStudioVersion=11.0