This section explains how you can test your source code through a Test Project and when it is recommended.
A Test Project is an Eclipse project that is dedicated for running tests. It can be created based on the selected Build Targets. A Test Project:
We recommend using Test Projects for testing multi-layer projects that include a root project with a number of sub-projects attached. Directly testing such projects (without using a Test Project) limits the scope of testing to one project in the hierarchy. This means that the testing actions you perform on the root project exclusively apply to the resources included in this project–the sub-projects will not be tested. A Test Project can serve as a root for all the project in the hierarchy, ensuring that all the resources are included in the testing scope.
In addition, you can use Test Projects to to provide a better separation of testing components (such as test cases and stubs) from the original source code.
You can create a Test Project using the Create Test Project option in the Project Explorer context menu–it opens a wizard that guides through the process of creating a Test Project. This option is available project nodes that represent build targets. Right-click the node and select Parasoft Test> C/C++test> Create Test Project.
You can configure a Test Project using the Test Project Reference page in the Test Project properties. It allows you to change the set of build targets that are initially included when the Test Project is created. Right-click the Test Project and select Properties, then go to Parasoft> C++test> Test Project References.
The Test Project References page includes a table with the list of Build Targets that are referenced by the Test Project. When you choose the Refresh Test Project command, C/C++test will try to collect build flag information for all the resources referenced in this list (see Refreshing the Test Project).
A Test Project requires maintenance to ensure that it is in sync with the original project for which it was created. In most cases, maintenance involves:
You should refresh the Test Project every time you change the build flags in the original project. In Project Explorer, right-click the Test Project, and choose Parasoft> C/C++test> Refresh Test Project. C/C++test will rescan the Build Targets referenced by the Test Project (Test Project References Page) and refresh the build data file.
When a Test Project is created, it is linked to all directories containing source files that were complied while the referenced Build Targets were built. To link the Test Project with resources that were added after the Test Project was created, you need to manually add the link–using the standard Eclipse mechanism for adding linked resources (New> File/Folder> Advanced, Link to file/folder in file system).
We strongly recommend using linked resource rather than making copies of existing resources.
When a Test Project is created, it is linked to all directories containing source files that were complied while the referenced Build Targets were built. The links are not automatically updated after the Test Project is created. You need to manually remove the links to resources that were removed form the referenced Build Target after the Test Project was created—using the standard Eclipse facilities for removing linked resources.
If the test project is created from more then one Build Target, you may need to manually update the list of referenced Build Targets.
It is common practice to work with more than one Wind River Workbench project's Build Spec for a given project. In such a case, when the active Build Spec is changed in the original project, you can pick up a new compiler/linker flags by refreshing the project (see Refreshing the Test Project). You do not need to create a separate test project for every Build Spec.