Goal : test separately every feature
- Test scenario (check sum() function)
- Test case (works with 2 positive numbers)
- Preconditions (C std lib works)
- Test steps (Create 2 variables, call sum(), check the result)
- Test data (a=1, b=2)
- Expected result (return value = 3)
Dependencies : autoconf, automake, lcov
sudo apt install autoconf automake lcov
./setup-cpputest.sh
If you want to force download of CppUTest, use ./setup-cpputest.sh -reinstall
.
If you want to uninstall CppUTest, use ./setup-cpputest.sh -uninstall
.
After writing configuration in MakeTests.mk
, run the following commands:
make tests
or
make all
make tests_coverage
Generate coverage HTML files (source files must be in the working folder)
make clean
First install cpputest package:
sudo apt install cpputest
Then complete and run this C++ example (can de done in Eclipse):
#include <CppUTest/CommandLineTestRunner.h>
#include <CppUTest/TestHarness.h>
TEST_GROUP(Group) {};
TEST(Group, Test) {};
int main(int argc, char ** argv)
{
RUN_ALL_TESTS(argc, argv);
}
This repository is licensed under the MIT License - see the LICENSE file for details
A huge thank you to Charles Gayot for letting me opensource this repository ! ❤️