I'm looking for a test framework for C++ in Eclipse CDT. Ideally it should have similar functionalities to those offered by JUnit.
I tried CUTE. It is good but I cannot seem to create unit tests within the project I'm currently working on. Neither can I create a separate unit test project to test my current project, because my current project is a C++ hello world application, but CUTE only allows testing project for a C++ library.
Any idea of other test frameworks I may count on, and is there any tutorial available? Thanks.
The most scalable way to write unit tests in C is using a unit testing framework, such as: CppUTest. Unity. Google Test.
The CDT is Eclipse's C/C++ Development Tooling project. It is an industrial-strength C/C++ IDE that also serves as a platform for others to provide value-added tooling for C/C++ developers.
All tests should be run with jUnit3, if i run a non-configured Test, it tries to use the default-TestRunner (jUnit4). So, i have to go into the run/debug configuration, change the TestRunner to "jUnit3" and run it again. On EVERY Test.
I use Google Test Framework and Google Mock Framework with Eclipse CDT C/C++ Tests Runner plugin. This plugin also works with qt tests and boost tests. Look and feel like junit in java eclipse :)
Google test framework is very well described here: http://code.google.com/p/googletest/
Eclipse CDT C/C++ Tests Runner plugin: https://github.com/xgsa/cdt-tests-runner/wiki/Tutorial
You can use it by creating new project for test or directly in current project by creating separate build and run action for test runner. I have 2 folders in my project, Source and Tests, Tests folder is exclude from normal build, so I can run test and build application using one project.
The problem you describe with CUTE is that you need to find a way to split up your application so you move the functionality you want to test to a library. Every test framework will put this requirement on your project structure.
Try GoogleTest or Boost.Test.
GoogleTest does not have a plugin for Eclipse.
see this issue: http://code.google.com/p/googletest/issues/detail?id=40
Cppunit is abandonware in the sense that it is not actively being maintained anymore.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With