Testwell CTC++ / Integration to Visual Studio
Here our context is Windows
platform. On it, when the application code is built in command line
mode (or from makefiles), and let the compiler be VC++ 5.0, VC++6.0,
VC++ 7.1 or VC++ 8.0, VC++ 9.0, VC++ 10.0 CTC++ is readily usable. See
the basic CTC++ description for more.
The help of
these IDE integration packages are not needed in such usage.
There are two CTC++ integrations to Visual
Studio IDEs:
These facilitate intuitive and seamless use
of CTC++ via the corresponding IDE. These integration add-on
packages are different from their technical implementation, and
slightly also how they are used. However, the general look-and-feel is
the same in all of them. Below these integrations are described in
more detail.
CTC++ Integration to
Visual Studio 5.0/6.0 IDE
Here we show a use scenario on how CTC++
is used in this environment.
Selecting the project
The first thing to do is to select the
project and its configuration, which will be tested with CTC++. This is
done by some of the normal Visual Studio 5/6 means by setting the
selected projects active. In this example the project is 'Cube'. The
active project might contain subprojects, too.
CTC++ additions in the Visual Studio
5/6 Tools menu
Three commands are added to the Tools
menu:
- CTC++ Build/Clean...
- CTC++ Execute...
- CTC++ Report...
Instrumenting and building the instrumented project
Tool command CTC++ Build/Clean...
gives this dialog. Here a number of selections can be made regarding
what will be instrumented and what instrumentation options will be
used. If there had been subprojects, each of them can be instrumented
independently, or leaving the main project (main target) or some of the
subprojects (subtargets) as non-instrumented.
By simply clicking Build the
project's C/C++ source files are instrumented by CTC++ Preprocessor
and the needed compilations and linking are invoked for getting
the instrumented target. Normal makefile optimizations take place for
saving processing time. For example, if you have changed only a couple
of the participating source files, only they are re-instrumented and
compiled for the new instrumented target.
Running the instrumented executable
Tool command CTC++ Execute... gives this dialog. If the
project target was an executable program, it (the CTC++ built version
of the program) can be started from here. Of course, the instrumented
program can also be executed with any of the normal means that programs
are generally executed on Windows. The instrumented code can also be in
a .dll or in a .lib file and it comes into execution when called from
an otherwise non-instrumented main program.
This is how it looks when our sample
instrumented executable runs. You may do multiple test runs and each of
them cumulates the execution history file.
Getting various CTC++ reports
Tool command CTC++ Report...
gives this dialog. Various types CTC++ reports can be selected. The
possible forms of reporting are:
- HTML-report
- Untested report to Dev. Studio
- Profile listing (textual)
- Untested listing (textual)
- Summary listing (textual)
- XML report (in XML form)
- Timing listing (textual)
When you select HTML report, your machine's default browser is started
on the generated report. For textual reports you can specify the viewer
(default is notepad) that will be started on the generated report. See
the
basic CTC++ description on how the
reports look like.
These same reports you can also generate in command line mode of CTC++
(utilities
ctcpost,
ctc2html, etc.).
The "Untested report to Dev.Studio" report is primarily meant for
developers who quickly wish to have a look what code portions have not
got a hit in the tests so far.
Clicking on a line in the Visual Studio
output window gives you a view to corresponding source file in the
upper right window with the pertinent line marked.
Cleaning the instrumented files and
targets
Once you are satisfied with the structural
test coverage measured by CTC++, in functional sense you have exercised
the program thoroughly and you no more have found new errors, it is
time to stop the testing. The thing to do is to select Clean...
in the CTC++ Build/Clean... dialog and the disk is polished
from all the auxiliary files and directories CTC++ has created.
Note that in the normal course of work
CTC++ keeps your original source files and targets intact. In some
situations, say when instrumenting a DLL, you may explicitly request
CTC++ to write the instrumented target over the original one for
conveniently getting the instrumented target into execution. At
any time you can also (without doing Clean... in the CTC++
Build/Clean... dialog) build the non-instrumented project by normal
Visual Studio 5/6 means.
CTC++
Integration to Visual Studio .NET 2003/2005/2008/2010 IDE
The CTC++ integrations to these three
IDEs
are similar. Actually they are implemented by the same dialog
programs, which are also used in some other IDE integrations, notably
with CodeWarrior and Carbide.c++.
But first a side-story of this Visual Studio use context. In these
Visual
Studios the builds can be done also in command line mode, for example
as
follows:
devenv mysolution.sln /rebuild debug
These kind of builds can be made "ctc-builds" using
ctcwrap command, as follows:
ctcwrap -i m -v devenv mysolution.sln /rebuild debug
Next we talk of CTC++ usage in the GUI of these Visual Studio IDEs.
At installation phase of this IDE integration (a separate installation
step after the basic CTC++ installation of the Visual Studio version at
hand) two CTC++ specific commands have been
inserted to the Visual Studio Tools menu, as follows:

Selecting
CTC++ Set/Clean... brings you to
the following dialog program where you set CTC++ Mode ON and select the
instrumentation options that you wish to use during the coming build.
Next you (re)build your solution or project normally via the IDE
commands, for example as follows:

As a result the project target (all project
targets of the solution) get born as instrumented according to the
Visual Studio build rules.
Next the instrumented code (.EXE, .DLL,
.LIB) is executed. It may be run in the Visual Studio context or
elsewhere, in the same way as the original code.
Finally the coverage reports can be
obtained using the ctcpost/ctchtml
programs either from the command line or integrated to Visual Studio
IDE. In the latter case you start the CTC++
Report... dialog program from the Tools menu. It looks as
follows:

Various types CTC++ reports can be
selected. The possible forms
of reporting are:
- HTML report
- Untested report to Visual Studio
- Profile listing (textual)
- Untested listing (textual)
- Summary listing (textual)
- XML report (in XML form)
- Timing listing (textual)
When you select HTML report, your machine's default HTML browser is
started
on the generated report (unless you check the viewer starting off). For
textual reports your specify your favorite editor (default notepad) to
be started on the generated report. See the
basic
CTC++ description on how the reports look like.
Cleaning the project from
CTC++
The CTC++ Visual Studio .NET 2003, 2005, 2008 and 2010 integration
behaves so
that
the
instrumented project targets (object files, executables) overwrite the
original ones. Thus, for getting back to a non-instrumented level, you
just set CTC++ Mode OFF and rebuild your project without CTC++.
Further, in the
CTC++ Set/Clean...
dialog there
is a subdialog
Clean...,
which you can use for polishing the project directory from the CTC++
generated reports and other CTC++ auxiliary files.