Running Tests/Test Lists from NCover Explorer

CHALLENGE

You're looking to execute Tests and/or TestLists directly from the NCover Explorer. You want to add some automation to the process - code coverage should stop and results should be generated as soon as your test or test list finishes executing without any intervention.

SOLUTION

Note: Test Studio has no Code Coverage capabilities per se. Instead, we integrate our product with NCover, which is a .NET Code coverage tool. NCover is distributed under proprietary license separately from Test Studio. Visit NCover.com for more information.

 

If you're new to using Test Studio in combination with NCover, please read this KB article first.

Setup everything you need for getting Code Coverage:

  • Create a test or test list to test your application
  • Deploy your application on your IIS server
  • Create a new NCover project in Project Explorer

 

NCover and your IIS serve need to be running on the same machine. ArtOfTest.Runner.exe and your test or test list need to be accessible from this machine. This means that they either have to be on the same machine or at least in the same network. Make sure they're accessible before you proceed.

 

In NCover Explorer, open "Application Options".

 

 

The "Project Settings" Menu loads. Check both "Run an application" and "Cover a service". In the Application section you can see two fields:

 

  • Path to Application to profile - input the location of ArtOfTest.Runner.exe here. In the below screenshot you can see I've given it as: C:\Program Files (x86)\Telerik\Test Studio 2011.1\Bin\ArtOfTest.Runner.exe
  • Arguments for the application to profile - input the path to your test or test list. You'll need to format it as either tstest="c:\....\MyTest.tstest" for a test or list="c:\...\MyList.aiilist" for a test list, since we're feeding this to the ArtOfTest.Runner.exe.

 

 

Close the Settings. Now you're ready to run your test and get Code Coverage. Click on "Run Coverage" to start executing and getting Code Coverage:

 

 

The Output console will output information. For instance, my test list contains 2 tests, named "1" and "2". Here's how the Output looks:

 

******************* Program Output *******************
Starting Service 'World Wide Web Publishing Service'...
The profiler will not connect until you load an ASP.NET page.
No Compilation needed: 
ExecuteTestFromList: Executing test: '1'
Process 'w3wp' [PID 5344] has begun profiling.
ExecuteTestFromList: Executing test: '2'
CompleteRunResult: Result saved with path: 'C:\Users\stoichev\Documents\WebUI Test Studio Projects\TestProject10\Results\test 129403656206545719.aiiresult'.
Stopping Service 'World Wide Web Publishing Service'...
Process 'w3wp' [PID 5344] has finished profiling.
***************** End Program Output *****************

 

When your test finishes Code Coverage for your IIS server, it will terminate automatically and you'll be able to see the Code Coverage data you just gathered in NCover Exporer:

 

 

It works the same way if you execute a single test instead of a test list. The drawback to this approach is that you can only execute one test or test list at a time. A work-around using a batch file that executes multiple test lists might be possible, but has not been tested.

 

Note: Keep in mind that NCover Explorer was not intended to be used this way. This is a creative solution put together to run Test Studio tests with NCover. If you experience any issues with this configuration we'd like to know, but please ensure you log this with NCover as well.