simplectest is designed to be used at the same time as implementation of your application. It provides a simple framework for running code, checking assertions and producing a report at the end.

The library does not have to be included in your final application, and all testing can be completely independent of your actual code.

First, download the most recent copy of simplectest from SourceForge:

No make/configure is required. All you need to do is include the macro definitions in your test files:
#include "simplectest/tests.h"

See YourFirstTest for an example of a testing file, also available as simple.c.

The framework also has limited support for "suites" of tests: see UsingSuites.

You can also specify configuration options in the testing suite:
  • By defining TESTS_BREAK_ON_FAILURE, the running test suite will cancel execution if ANY failure occurs. (v0.25+)
  • By defining TESTS_EXIT_ON_FAILURE, the entire running program will cancel execution if ANY failure occurs. (v0.25+)
  • By defining TEST_INDIVIDUAL, a testing suite will become standalone (and executable from the shell) - see UsingSuites. (v0.25+)

    You can use these in your compiler switches, e.g. adding -DTESTS_BREAK_ON_FAILURE to your command line. Alternatively, you can define them in the test files themselves.

  • Powered by Wiki! and Logo