Sitemap | Contact

Company Evaluations Purchase Support What´s new

CTC++ Integration to Visual Studio

Here our context is Windows. With "Visual Studio" we mean Visual Studio 2003 or later. See below a remark of usage with Visual Studio 6.0.

When the program files are in Visual Studio framework, they can be built from graphical IDE or from command line by 'devenv', 'vcbuild' or 'msbuild' commands. Making the command-line builds as "ctc-builds" is simple. Just prepend the command with "ctcwrap ctc-options", something like the following:
ctcwrap -i m -v devenv mysolution.sln /rebuild debug
ctcwrap -i dti vcbuild /rebuild myproject.vcproj Debug 


ctcwrap -i f msbuild myproj.vcproj /t:Rebuild /p:Configuration=Debug
Instrumented programs get born. They are run normally, which result creation/appending of the coverage datafile. The reports are taken from command line with ctcpost and ctc2html utilities.
Usage from the Visual Studio graphical IDE is also possible. It goes as follows:
Into the Visual Studio Tools menu two commands have been added: "CTC++ Set/Clean..." and "CTC++ Report"

CTC++ commands in Tools menu

To begin with, you select CTC++ Set/Clean... command, which brings you to the following dialog:
CTC++ Set/Clean...

You set the CTC++ Mode ON and select the instrumentation options as needed and click "OK".

From now on, when you compile the code by Visual Studio Build > (Re)Build commands , the compilations are "ctc-compilations". As result you get instrumented application (normally an .EXE or .DLL).

Then you run the program normally. You can start it from Visual Studio or outside of it. The program execution collects the coverage data and writes/appends it to the datafile.

You get the the coverage reports by Tools > CTC++ Report... command. It is a dialog program looking as follows:

CTC++ Report dialog

In the "Report type" pull-down menu you get alternatives to take the following reports:

  • HTML report: First a textual report is taken by ctcpost tool to a file. It is then inputted to the ctc2html tool, which converts it to hierarchical color-coded form. Your PC's default browser is started on the HTML report (unless you have denied it).
  • Untested report to Visual Studio: First a textual Untested Code Listing is taken to a file. Then it is written to Visual Studio output window so that each line is prefixed with "sourcefilename(linenumber):". Clicking on on such line brings to the source window the source file and positions the cursor at the corresponding line. This is a convenient way to see the untested code locations.
  • Profile listing (textual): With ctcpost tool an Execution Profile Listing is generated to a file. Then a viewer (notepad by default) is started on it (unless you have denied it).
  • Timing listing (textual): With ctcpost tool an Execution Time Listing is generated to a file. Then a viewer (notepad by default) is started on it (unless you have denied it).
  • XML report: With ctcpost tool an XML report is generated to a file. Then a viewer (notepad by default) is started on it (unless you have denied it).

In "Coverage view" area you can fine-tune how the coverage report will be generated. For example, if the code has been instrumented for multicondition coverage, you can get the report in a lower MC/DC coverage view.

When you want to get back to the non-instrumented version of your program, in the CTC++ Set/Clean... dialog you set CTC++ Mode OFF and rebuild your program.

When you want to get rid of all CTC++ generated files from your project directory (symbolfile, datafile, various report files), you can use the CTC++ Set/Clean... command's subdialog CTC++ Clean... for doing it.

Usage with Visual Studio 6.0

Of course the usage is possible with Microsoft VC++ 6.0 compiler from command line. For example with makefiles, which emit cl and link commands.

If your code is in a Visual Studio 6.0 IDE framework, the usage is possible as follows:

  • Export from the project its makefile
  • Build the project by 'ctcwrap' and 'nmake', something like the following:
    ctcwrap -i d nmake -f myproject.mak clean all 
  • Run the tests normally with the instrumented program
  • Take the reports with ctcpost and ctc2html tools in command line mode

To frontpage