AUnit  0.3.1
Unit testing framework for Arduino platforms inspired by ArduinoUnit.
Static Public Member Functions | List of all members
aunit::TestRunner Class Reference

The class that runs the various test cases defined by the test() and testing() macros. More...

#include <TestRunner.h>

Static Public Member Functions

static void run ()
 Run all tests using the current runner. More...
 
static void list ()
 Print out the known tests. More...
 
static void exclude (const char *pattern)
 Exclude the tests which match the pattern. More...
 
static void include (const char *pattern)
 Include the tests which match the pattern. More...
 
static void setVerbosity (uint8_t verbosity)
 Set the verbosity flag. More...
 
static bool isVerbosity (uint8_t verbosity)
 Returns true if ANY of the bit flags of 'verbosity' is set. More...
 
static void setPrinter (Print *printer)
 Set the output printer. More...
 
static void setPassOrFail (bool ok)
 Set the pass/fail status of the current test. More...
 
static void setTimeout (long millis)
 Set test runner timeout across all tests, in millis. More...
 

Detailed Description

The class that runs the various test cases defined by the test() and testing() macros.

It prints the summary of each test as well as the final summary of the entire run at the end. In the future, it may be possible to allow a different TestRunner to be used.

Definition at line 41 of file TestRunner.h.

Member Function Documentation

◆ exclude()

static void aunit::TestRunner::exclude ( const char *  pattern)
inlinestatic

Exclude the tests which match the pattern.

Currently supports only a trailing '*'. For example, exclude("flash*").

Definition at line 53 of file TestRunner.h.

◆ include()

static void aunit::TestRunner::include ( const char *  pattern)
inlinestatic

Include the tests which match the pattern.

Currently supports only a trailing '*'. For example, include("flash*").

Definition at line 61 of file TestRunner.h.

◆ isVerbosity()

static bool aunit::TestRunner::isVerbosity ( uint8_t  verbosity)
inlinestatic

Returns true if ANY of the bit flags of 'verbosity' is set.

Definition at line 71 of file TestRunner.h.

◆ list()

static void aunit::TestRunner::list ( )
inlinestatic

Print out the known tests.

For debugging only.

Definition at line 47 of file TestRunner.h.

◆ run()

static void aunit::TestRunner::run ( )
inlinestatic

Run all tests using the current runner.

Definition at line 44 of file TestRunner.h.

◆ setPassOrFail()

static void aunit::TestRunner::setPassOrFail ( bool  ok)
inlinestatic

Set the pass/fail status of the current test.

Definition at line 79 of file TestRunner.h.

◆ setPrinter()

void aunit::TestRunner::setPrinter ( Print *  printer)
static

Set the output printer.

Definition at line 46 of file TestRunner.cpp.

◆ setTimeout()

static void aunit::TestRunner::setTimeout ( long  millis)
inlinestatic

Set test runner timeout across all tests, in millis.

Set to 0 for infinite timeout. Useful for preventing testing() test cases that never end. This a timeout for the TestRunner itself, not for individual tests.

It might be usefult to allow timeouts on a per-test basis, but I'm reluctant to do that at the Test class level because it would add extra 4 bytes (maybe 2 if we allowed a small maximum) of static memory per test case. The solution might be to allow the end-user to choose to pay for this extra cost if they want to. I think the right way to do that is to add support for test fixtures which is something on the back of my mind.

Definition at line 94 of file TestRunner.h.

◆ setVerbosity()

static void aunit::TestRunner::setVerbosity ( uint8_t  verbosity)
inlinestatic

Set the verbosity flag.

Definition at line 66 of file TestRunner.h.


The documentation for this class was generated from the following files: