The purpose of this repository is to help to setup CppUTest using Eclipse in a Windows 7 machine.
-
Download the 32-bit version of Cygwin and run the installation package.
-
Install the Devel category packages:
-
Add your new Cygwin bin directory to the Path variable:
-
Download the latest package of CppUTest from CppUTest Github Page using the following command:
git clone git://github.com/cpputest/cpputest.git
.If you do not have git installed in your machine, download it from this page Downloading Git and run the installation.
-
Open Cygwin and go to the folder cpputest/cpputest_build
-
Enter the following commands:
cmake ..
-
A confirmation will show in the Cygwin console:
-- Configuring done
-- Generating done
-- Build files have been written to: /cygdrive/c/users/.../cpputest/cpputest_build
-
Run the make command in the same folder
make
-
A confirmation will show in the Cygwin console:
[100%] Built target CppUTestExtTests
-
Run the make install command in the same folder:
make install
- After completing the porject installation, a new folder will be created in the location of your Cygwin directory under
cygwin\usr\local\lib
-
Copy this lib folder and it's contents and paste it on the CppUTest folder.
-
Add CPPUTEST_HOME to your systems variables using the cpputest folder
-
Download and Install Java Development Kit
-
Add the JDK bin folder to the Path variable
-
Download and install Eclipse IDE. Select Eclipse IDE for C/C++ Developers during installation.
-
Install the C/C++Unit plugin Open Eclipse. Accept the default workspace for now (you may want to set a more appropriate workspace location later on). Then install the "C/C++ Unit Test" plugin: "Help"->"Install New Software"-> work with "Kepler - http://download.eclipse.org/releases/kepler". You will find the plugin under:
[ ] Programming Languages
[x] C/C++ Unit Testing Support.
Also install:
[ ] Linux Tools
[x] Gcov Integration
-
Clone the CppUTest Eclipse Test Runner and add it to Eclipse following the instructions below:
Create directory "<YOUR_PATH_TO_ECLIPSE>/eclipse/dropins/CppUTest".
In this repository, change into the directory "org.eclipse.cdt.testrunner.cpputest".
Copy the following artifacts from there to "<YOUR_PATH_TO_ECLIPSE>/eclipse/dropins/CppUTest":
bin/org/ --> org/ META-INF/ plugin.properties plugin.xml
You must copy "bin/org/" to "org/" and not to "bin/org/" !
Close Eclipse. Start Eclipse from a command shell with the following command:
Eclipse -clean -console -consoleLog
"CppUTest Tests Runner" should now be selectable as a test runner within Eclipse and successfully run a CppUTest test project.
-
Clone the sample project from this repository
-
Add the sample project to Eclipse
-
Add the path to the CppUTest folder in the settings of the Cywin C Compiler and Cygwin C++ Compiler in Eclipse:
-
Add the CppUTest library to the Cygwin C++ Linker settings in Eclipse:
-
Build the project
-
In Eclipse go to New Launch Configuration and select C/C++ Unit:
-
Under Test Runner select CppUTest Tests Runner:
-
Run the project
-
The tests should run and show passed: