Project Cre=
ation 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 Windo=
ws Mobile/Windows CE does not require any additional setup for C++test stat=
ic analysis.

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

To verify that the project setup is correct:

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.

Verify that the proper compiler family is specified (in this case, Micr=
osoft Visual C++ x.x for Windows Mobile).

In most cases, you can use the Autodetect button to au=
tomatically select the appropriate compiler configuration. If you need to u=
se another compiler's binaries, clear the Synchronize with project&=
nbsp;settings check box, and then manually specif=
y the appropriate location(s).

If you want to use an alternative project configuration (e.g., Debug, R=
elease, etc.), choose it in the Configurations box.

Static Analysis

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

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

To perform static analysis:

Select the Solution Explorer node that represents the resource(s) you w=
ant to test (a single file, a selection of multiple files, or the entire pr=
oject).

Open the pull-down menu for the Test Using toolbar but=
ton (this is a blue triangle), then choose your preferred static analysis t=
est configuration.

After the analysis begins, C++test will collect the analysis options, ca=
lculate the scope of the analysis, and then start the static analysis. Afte=
r the analysis is completed, the summary dialog and the static analysis res=
ults will display in the C++test output panel. You can now review and respo=
nd to results, as well as generate reports, as described in the following s=
ections:

The "Build and run test executable for Windows Mobile/CE using ActiveSyn=
c" test flow was specifically designed to facilitate setting up unit tests =
with ActiveSync as a communication channel. ASconnector is invoked in the C=
ustomStep 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 a=
s with the emulator.

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

This is an example of a CustomStep, which can be used in this scenario:<=
/p>

=
Unit Testing with ASconnector

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

ASconnector can be customized by the following options:

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

Option/Format

Short Equivalent

Description

--testExecutable=3D<path>

--te

Specifies the path to the target executable o=
n the host machine.

Mandatory option.

--logFile=3D<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 execu=
table execution finishes. The default host location for downloaded log file=
s is the working directory. The host location can be changed with the --log=
Dir option. A comma-separated list of files can be issued. If this option i=
s not present, standard log files are processed (cpptest_results.tlog and <=
br>cpptest_results.clog).

--logDir=3D<path>

--ld

Specifies how long (in milliseconds) ASconnec=
tor will wait for the ActiveSync connection.

If set to 0, there will =
be no timeout.

Default value: 8000 milliseconds

--targetArch=3D<arch>

=

--ta

Target platform architecture. May =
be one of the following: arm, mips, sh, x86 or emu for emulator.

--printHelp

--help

Displays options summary.

--testExecutableCmd <...>

N/A

After this option, the rest of the=
command line is directly passed to the target executable.

The program flow consists of the following steps:

The target executable is copied from the host to the target executable.=

If the program detects that the same version of the target executable i=
s already copied (in the previous run of the test flow, for example) the ex=
ecutable is not copied. Timestamps are checked in order to detect this.

The target executable is started and testing begins.

When the testing finishes, the log files are copied back from the targe=
t system to the host.

Temporary log files are deleted.

Unit Testing

The following Test Configurations were designed specifically for use wit=
h Windows Mobile/Windows CE applications:

Build and Run Test Executable for Windows Mobile or Windows CE =
Using ActiveSync: For building and running a test executable for W=
indows Mobile/Windows CE. ActiveSync is used as a communication channel. To=
use this flow, both host and target machines must support ActiveSync. The =
target can be an actual device connected in ways supported by ActiveSync, o=
r it can be an emulator. For details, see Application Monitoring.

Build and Run Test Executable for Pocket PC: For build=
ing and running a test executable for Windows Mobile Pocket PC. File commun=
ication is used, through sharing the host directory as a Storage Card in th=
e emulator. By default "./Storage Card/cpptest_results.tlog" a=
nd "./Storage Card/cpptest_results.clog" locations are u=
sed for storing test and coverage results. The test executable is generated=
to a subdirectory named "2577" to facilitate autostart after system boot. =
PPC_USA.BIN image is used from Windows Mobile SDK. When execution completes=
, close the emulator. C++test will then read and display test results.=

Build and Run Test Executable for Smartphone: For buil=
ding and running a test executable for Windows Mobile Smartphone. Fil=
e communication is used, through sharing the host directory as a Storage Ca=
rd in emulator. By default "./Storage Card/cpptest_results.tlog" and "./Storage Card/cpptest_results.clog" locations are use=
d for storing test and coverage results, respectively. The test executable =
is generated to a subdirectory named "2577" to facilitate autostart after s=
ystem boot. SP_USA_GSM_QVGA_VR.BIN image is used from Windows Mobile SDK. W=
hen execution completes, close the emulator. C++test will then read and dis=
play test results.

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 particula=
r environment:

emulator_path: The path to the emulator executable fil=
e. By default, set to "C:\Program Files\Microsoft Device Emulator\1.0\Devic=
eEmulator.exe".

platform_dir: The name of the subdirectory in which th=
e executable will be generated. By default, set to "2577".

=
Application Monitoring

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

Build and Run Application with Memory Monitoring for Windows Mo=
bile or Windows CE Using ActiveSync: For building and running an a=
pplication for Windows Mobile/Windows CE. ActiveSync is used as a communica=
tion channel. To use this flow, both host and target machines must sup=
port ActiveSync. The target can be an actual device connected in ways suppo=
rted by ActiveSync, or it can be an emulator. For details, see Application Monitoring.

Build and Run Application with Memory Monitoring for Pocket PC:=
For building and running an application for Windows Mobile Pocket=
PC. File communication is used, through sharing the host directory as a St=
orage Card in the emulator. By default, ./Storage Card/cpptest_result=
s.tlog and ./Storage Card/cpptest_results.clog lo=
cations are used for storing test and coverage results. The test exec=
utable is generated to a subdirectory named 2577 to facilitate autostart af=
ter system boot. The PPC_USA.BIN image is used from Windows Mobile SDK. Whe=
n you finish testing your application, close the emulator. C++test will the=
n read and display test results.

Build and Run Application with Memory Monitoring for Smartphone=
: For building and running an application for Windows Mobile Smart=
phone. File communication is used, through sharing host directory as =
a Storage Card in the emulator. By default ./Storage Card/cpptest_res=
ults.tlog and ./Storage Card/cpptest_results.clog locat=
ions are used for storing test and coverage results, respectively. The test=
executable is generated to a subdirectory named 2577 to facilitate autosta=
rt after system boot. The SP_USA_GSM_QVGA_VR.BIN image is used from Windows=
Mobile SDK. When you finish testing your application, close the emulator. =
C++test will then read and display test results.

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

Learning More

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