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.
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:
For more information about C++test project properties, see Reviewing and Modifying Settings.
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:
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. |
This section explains how to configure and run runtime testing. It covers:
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:
<CustomStep id="run_test" label="Running test executable..." commandLine=""ASconnector.exe" "-- te=${cpptest:testware_loc}\${project_name}Test.exe" "--ta=arm" --testExecutableCmd --start-after=${cpptestproperty:test_case_start_number}" workingDir="${cpptest:testware_loc}" /> |
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/Format | Short Equivalent | Description |
---|---|---|
--testExecutable=<path> | --te | 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 |
--targetArch=<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 following Test Configurations were designed specifically for use with Windows Mobile/Windows CE applications:
Build Test Executable for Windows Mobile: For building a test executable for Windows Mobile/Windows CE. File communication is used. By default "./Storage Card/cpptest_results.tlog"
and "./Storage Card/cpptest_results.clog"
locations are used for storing test and coverage results.
"./Storage Card/cpptest_results.tlog"
and "./Storage Card/cpptest_results.clog"
locations are used 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."./Storage Card/cpptest_results.tlog"
and "./Storage Card/cpptest_results.clog"
locations are used for storing test and coverage results, respectively. The test executable is generated to a subdirectory named "2577" to facilitate autostart after system boot. SP_USA_GSM_QVGA_VR.BIN image is used from Windows Mobile SDK. When execution completes, close the emulator. C++test will then read and display 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 particular environment:
Image_path: The path to the emulator Windows CE image file. By default (for Pocket PC), set to "C:\Program Files\Windows Mobile 5.0 SDK R2\PocketPC\DeviceEmulation\0409\PPC_USA.BIN".
For general information on generating and executing unit test cases with C++test, Test Creation and Execution. |
The following Test Configurations were designed specifically for use with Windows Mobile/Windows CE in Application Monitoring Mode:
./Storage Card/cpptest_results.tlog
and ./Storage Card/cpptest_results.clog
locations are used for storing test and coverage results. The test executable is generated to a subdirectory named 2577 to facilitate autostart after system boot. The PPC_USA.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../Storage Card/cpptest_results.tlog
and ./Storage Card/cpptest_results.clog
locations are used for storing test and coverage results, respectively. The test executable is generated to a subdirectory named 2577 to facilitate autostart 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.
For general information on performing application monitoring and runtime error detection with C++test, see Runtime Error Detection. |