code coverage with TestApi .. startProcess

Jan 28, 2009 at 5:05 AM
    I am using Test Api to test my UI...but having hard time to find the code coverage.
The scenario is as below
1) my UI code (WPF form) is in a dll.( WPFForm )
2) I got a mock win form exe which invokes the UI in step 1 on the click of a button on the form.( MockExe )
3) I have a dll which has all the tests... in this ... 
            Process appProcess = AutomationHelpers.StartProcess(new ProcessStartInfo(@"\Build\Debug\ManagedHost.exe"), out rootElement);
In this dll, I start the MockExe process & then run different tests...
4) Now, NCover run on this test dll does not give me coverage of the MockExe & WPFForm as they are in a different process...

So my question is how do I get the code coverage of WPFForm in the above scenario.


Jan 29, 2009 at 9:58 PM

Hi Prakash,

A couple thoughts:

  1. Have you considered running your tested application under the same thread as your test? The Visual Verification Test demonstrates testing of an application within the same process, under a separate thread.
  2. With regards to NCover Profiler you mentioned - it looks like it provides flexibility on which process is being profiled. You may get the results you desire by targeting the tested application process, rather than the test. Other profilers may offer better cross-process transparency in this regard. In any case, specifics of profiling a process called outside of the initially invoked process is a question best addressed by your profiler documentation/support/user discussions.

Child Process Profiling
Profiling a process that is launched by another .NET process can be tricky. NCover helps with this by allowing you to specify the name of the process you want to be profiled. NCover will wait until the specified process is launched before attaching the profiler.

I hope that helps,