NCover Documentation

Whether you're looking to gather coverage while you perform manual testing, or whether you want coverage on automated tests, NCover works with AutomatedQA's TestComplete to give you that coverage. Once you have your tests set up in TestComplete, adding NCover to the mix for coverage is very straightforward. This article uses the C# version of the sample Orders program that comes with your TestComplete install to show you how to set up NCover to gather coverage on programs tested with TestComplete.

Setting up NCover is similar in both the automated and the manual testing situtations; in both cases, NCover needs to start the TestComplete executable to gather coverage on the program that TestComplete tests, and NCover needs to use the //pn argument so that it gathers coverage for the tested program and not for TestComplete. First we'll walk through setting up NCover to gather coverage on manual tests.

Manual Testing

During manual testing, TestComplete starts the application under test and then a tester follows a test script to verify the application. To set NCover up in this scenario, open NCover Explorer and create a new project by pressing CTRL+N. You are covering a Windows application, so leave the first radio button selected, and give the project a name that you can rememeber.

Next, the "Path to aplication to profile" field should contain the full path to the TestComplete executable. For TestComplete 7, this is typically "C:\Program Files\Automated QA\TestComplete 7\Bin\TestComplete.exe"

The "Working folder" should be set to the directory that TestComplete is installed in. You can do this by checking the "Keep working folder in sync with Application Path" checkbox.

You may want to change the location of the coverage file, since by default it will be placed in the working folder.

Finally, you need to go to the "Output Options" page, and in the "Child Process Name" field, enter the filename of the executable file that TestComplete will test. In this case, we're gathering coverage on the sample Orders program, so I've entered "orders.exe" into the field. (Case doesn't matter.)

Note for 64-bit systems

If the program tested by TestComplete is an x86 program, then you'll also need to go to the "NCover Path" page and point it to the installation of NCover that supports x86 programs on x64 bit systems. Typically, the x86 version of NCover is installed in "C:\Program Files (x86)\NCover\"

Once you're done, close the "Project Options" window and press the green "Run Coverage" button to start TestComplete and your manual tests. Once you're done testing, close TestComplete and NCover will collect and display the coverage data.

Automated Testing

Once you have TestComplete and NCover set up for manual testing, setting them up for automated testing is simple. TestComplete accepts command line arguments that tell it to run all the tests in a single TestComplete project without any user interaction. The first step is to set up the command line arguments for TestComplete and get them working; you can find the documentation by searching the TestComplete help for "TestComplete Command Line". Essentially though, the TestComplete command line should be constructed something like this.

First, you need to tell TestComplete which project (.mds file) or project suite (.pjs) file to load and execute tests in. To do this, just pass in the fully qualified path to the project or project suite file as the first parameter. We're using the sample Orders application, so the final TestComplete command line looks like this

testcomplete.exe
"C:\Users\Public\Documents\TestComplete 7 Samples\Open Apps\OrdersDemo\C#\TCProject\Orders.pjs"
/run
/project:Orders_C#_VBScript
/exit /SilentMode

The first argument to the TestComplete executable is the filename of the project or project suite that we would like to run tests from. The /run argument tells TestComplete that we would like to run some of the tests in the project suite, and the /project argument tells TestComplete that we only want to run the tests in that project, instead of all the tests in the project suite. Finally, the /exit and /SilentMode arguments tell TestComplete to exit once all the tests have finished, and to write errors and exceptions to a log file instead of displaying them in a message box when they occur.

Once you have the TestComplete command line working from a console window, just copy the entire command line (except for the testcomplete.exe portion) to the "Application Arguments" field of the "Application to Profile" panel, and save the project.

Then click the "Run Coverage" button and watch NCover gather coverage of an automated TestComplete execution. Once TestComplete has finished executing the tests, it will close automatically and NCover will collect and display the coverage data.

From here, you can use the "Script Helper" in NCover Explorer to create build scripts and config files that will integrate into your automated build proecess.

If you still need technical assistance, we can help:

Submit A Support Ticket

Try NCover Free Contact Us Online