Coverage during acceptance tests?
I am using WATIN for integration tests, and I really like it. The only problem that I have with it now is that I can't get tests run via WATIN to be covered using NCover. This is understandable, since the tests are excersizing a different appdomain (and process, they are run on IIS). This is really sad, since I now have a great deal of focus on the UI, and this means that I can't get the proper stats about it.
I can't think of any way to make NCover profile another process, but I do think that it is possible to profile another appdomain, which bring up the possibility of hosting ASP.Net myself and running the tests against that. (This is basically what MonoRail TestSupport does, but I never checked it coverage).
I'll give it a try tomorrow, any comments before I try this?
Comments
Hi,
Following a section from the NCoverFAQ.html distributed with the 1.3 version. Haven't tried this myself but it might help you.
--> Start snippet
xmspc got this to work on ASP.NET. See his post on the message board for more information. Here are the basics for getting it to work on Windows XP.
1) Ensure the NCoverLib COM component is registered (setup does this, but you can manually register it with regsvr32 if you wish).
2) Set the machine-wide COR profiling environment variables (or find some other way to get them set in the aspnet_wp.exe's environment):
COR_ENABLE_PROFILING=1
COR_PROFILER=CvrLib.CoverageProfiler
3) Create %windir%\System32\Coverage.log and %windir%\System32\Coverage.xml and grant .\ASPNET read+write+modify permission to these 2 files only.
4) Force a restart of IIS so aspnet_wp.exe picks up the new environment variables. Coverage info will be written to the System32 directory.
All ASP.Net processes (on Windows XP for sure, don't know about Windows 2003) use %windir%\System32 as their working dir, therefore if multiple processes are running they will stomp over the Coverage files.
...would be nice if NCover used AppDomain basedir and/or value from app config file to set output file dir...
<-- End snippet
I've tried this before and ended up with all sorts of problems with PerfMon and IIS so be very careful with it!
Comment preview