Home | About | Partners | Contact Us
VA Linux Systems

yaktest: a wee testing framework for C++

yaktest is a small (just a few K) library for C++ which consists of three classes:
  • test_case, the base class for all test cases
  • test_problem, a problem description for a failed test
  • test_result, a collection of problems and successes
A fourth class, text_test_interpreter, takes the test_result data and spews it to stdout. The test results are in Emacs-compatible form, ie

filename:line_number:description

...so by adding a simple make target, you can just compile from emacs, use "make test" for the compile target, and get a nice automated test; using "next-error", you can move directly to the trouble spot. It's a simple way of doing things, but fairly effective; in the first few days of using it, I've already uncovered a few hidden bugs.

Sample Output

Here's the sample output from the test_point program, included with the distribution.

Test output begins; number of tests: 13

Successes: 7

Failures: 6
test_case_point.cpp:17:Equality failed.  Got (2, 2), expected (1, 2)
test_case_point.cpp:26:Equality failed.  Got (2, 2), expected (1, 2)
test_case_point.cpp:36:"top_left_point == test_equal_point" evaluated to false.
test_case_point.cpp:58:Equality failed.  Got (12, 22), expected (11, 22)
test_case_point.cpp:68:Equality failed.  Got (8, 18), expected (9, 18)
test_case_point.cpp:77:Equality failed.  Got (6, 6), expected (4, 6)

Errors: 0

Downloadables

yaktest comes in a standard .tar.gz format and source/binary RPMS. You can download yaktest from the sourceforge project page at http://sourceforge.net/projects/yaktest.

Hosted by Sourceforge

This project is hosted by the kind folks at SourceForge Logo
All trademarks and copyrights on this page are properties of their respective owners. Forum comments are owned by the poster. The rest is copyright 1999-2000 VA Linux Systems, Inc.