In this section:


The following topics explain how to use C++test to perform static analysis and unit testing on code that is designed to be compiled/built using Windows Mobile.

The C++test Visual Studio plugin directly supports Mobile SDKs for Window Mobile 5 and 6. No additional installation is required. 

For testing Microsoft eMbedded Visual C++ 4.0 projects, please use the C++test standalone (Eclipse based) distribution.

Project Creation and Configuration

This topic explains how to configure Visual Studio projects for Windows Mobile to be tested with C++test.

A Microsoft Visual Studio project that is correctly configured for Windows Mobile/Windows CE does not require any additional setup for C++test static analysis.

For unit testing, the Runtime Library is required. It can be built automatically by C++test (the default) or manually from Visual Studio IDE or from a Makefile. To learn about the runtime library, see Working with the C++test Runtime Library.

To verify that the project setup is correct:

  1. Right-click the Solution Explorer tree (a.k.a. "the project tree") node for the project whose settings you want to review and modify, then choose C++test Properties from the shortcut menu. The Properties dialog will open.
  2. Verify that the proper compiler family is specified (in this case, Microsoft Visual C++ x.x for Windows Mobile).
  3. If you want to use an alternative project configuration (e.g., Debug, Release, etc.), choose it in the Configurations box.

For more information about C++test project properties, see Reviewing and Modifying Settings

Static Analysis

This topic explains how to configure and run static analysis on code that is designed to be compiled/built using Windows Mobile. 

Since static analysis runs on pure code only, information and settings related to linking and running the test object are not relevant to this kind of testing. However you must have all compiler settings set properly. 

To perform static analysis:

  1. Select the Solution Explorer node that represents the resource(s) you want to test (a single file, a selection of multiple files, or the entire project).
  2. Start the analysis in one of the following ways:

After the analysis begins, C++test will collect the analysis options, calculate the scope of the analysis, and then start the static analysis. After the analysis is completed, the summary dialog and the static analysis results will display in the C++test output panel. You can now review and respond to results, as well as generate reports, as described in the following sections:

For general information on performing static analysis with C++test, see Static Code Analysis and  Flow Analysis

Runtime Testing

This section explains how to configure and run runtime testing. It covers:

Environment-Specific Configuration

Automating Unit Testing with Microsoft ActiveSync

To facilitate using Microsoft ActiveSync as a communication channel during unit testing, an ASconnector command line tool is provided. ASconnector can automate the following tasks:

For details on ASconnector, see Unit Testing with ASconnector.

The "Build and run test executable for Windows Mobile/CE using ActiveSync" test flow was specifically designed to facilitate setting up unit tests with ActiveSync as a communication channel. ASconnector is invoked in the CustomStep in this flow. The CustomStep can be further customized to better suit your testing environment.

This flow supports unit testing with the actual target device, as well as with the emulator.

In this case, we are assuming that the target device (or emulator) is properly connected with the host, and the ActiveSync is up before running unit testing. This connection will be used by ASconnector.

This is an example of a CustomStep, which can be used in this scenario:

	label="Running test executable..." 

Unit Testing with ASconnector

ASconnector is a tool that allows you to automate unit testing on a target device or emulator using Microsoft ActiveSync as a communication channel.

ASconnector can be customized by the following options: 

ASconnector  [options]... [--ExecutableCmd ...]

Option/FormatShort EquivalentDescription

Specifies the path to the target executable on the host machine.

Mandatory option.

--logFile=<target_path> --lf 

Specifies a path to the log file on the target device. The log file is downloaded to the host after the test executable execution finishes. The default host location for downloaded log files is the working directory. The host location can be changed with the --logDir option. A comma-separated list of files can be issued. If this option is not present, standard log files are processed (cpptest_results.tlog and

 --logDir=<path> --ld

Specifies how long (in milliseconds) ASconnector will wait for the ActiveSync connection.

If set to 0, there will be no timeout.

Default value: 8000 milliseconds


--taTarget platform architecture. May be one of the following: arm, mips, sh, x86 or emu for emulator.
--printHelp--helpDisplays options summary.
--testExecutableCmd <...>N/AAfter this option, the rest of the command line is directly passed to the target executable.

The program flow consists of the following steps: 

  1. The target executable is copied from the host to the target executable.
  2. If the program detects that the same version of the target executable is already copied (in the previous run of the test flow, for example) the executable is not copied. Timestamps are checked in order to detect this.
  3. The target executable is started and testing begins.
  4. When the testing finishes, the log files are copied back from the target system to the host.
  5. Temporary log files are deleted.

Unit Testing

The following Test Configurations were designed specifically for use with Windows Mobile/Windows CE applications:

The last three flows are intended for use with Microsoft Device Emulator. The following properties used in the Windows Mobile/Windows CE test flow definitions can be customized to adjust your flow definition to a particular environment:

For general information on generating and executing unit test cases with C++test, Test Creation and Execution.

Application Monitoring

The following Test Configurations were designed specifically for use with Windows Mobile/Windows CE in Application Monitoring Mode:

The last two flows are intended for use with Microsoft Device Emulator. You can customize them like you can customize other unit testing flows.

For general information on performing application monitoring and runtime error detection with C++test, see Runtime Error Detection.