I created a testing suite called saru ( http://github.com/mikeando/saru ) for my own code dev. Its a BSD licensed code. I developed it as I didn't like several of the features of other testing suites. Its not widely used, but I've used it on several commercial projects spread across two companies.
- I don't like all my tests getting compiled into one binary. My reasons for this are if the compile fails all tests fail, if one test does undefined behaviour the program output is undefined.
- I want control over what tests run. I want to be able to group tests and run subsets.
- I want compilation failure of a test to be reported as a test failure, and not halt all my tests running.
- I want to be able to run tests from multiple different languages
- I want a system flexible enough that I can run specific tests under valgrind (not yet in saru :( )
So saru addresses most of these features.
Its focus is on being able to run a suite of tests written in different languages.
With minimal test sizes. Here's the smallest (failing) C++ test
//SARU : dummy dummy
int main() { return (1==2)?0:1; }
All saru really cares about is the return value of the binary that it compiles.
It then parses the output to determine what tests failed and so on. It has headers to make working with C++ a little nicer than the above trivial example :
//SARU : dummy dummy
#include "MyStruct.h"
#include "saru_cxx.h"
class Fixture
{
MyStruct s_;
Fixture() : s_() {}
void test_A_is_B()
{
SARU_ASSERT_EQUAL( s_.A(), s_.B() );
}
void test_C_is_7()
{
SARU_ASSERT_EQUAL( 7, s_.C() );
}
};
int main()
{
saru::TestLogger logger;
SARU_TEST( Fixture:: test_A_is_B, logger );
SARU_TEST( Fixture:: test_C_is_7, logger );
logger.printSummary();
return logger.allOK()?0:1;
}
Or if you don't like the way its C++ headers work it should be able to integrate with other unittesting libraries with minimal difficulty.
But it will also run tests that are written in PHP & python.
So you can set up full functional tests with saru. Or you can run something like lint over your code as part of the test suite.