11# AUnit - Unit Testing Framework for Arduino Platforms
22
3+ Version: v0.3.0 (2018-03-19)
4+
35## Summary
46
57** AUnit** (rhymes with "JUnit") is a unit testing framework based
@@ -16,8 +18,9 @@ AUnit was created to solve 2 problems with ArduinoUnit:
1618 [ ArduinoUnit #70 ] ( https://github.com/mmurdoch/arduinounit/issues/70 ) .
1719* ArduinoUnit does not compile on the ESP8266 platform (see
1820 [ ArduinoUni #68 ] ( https://github.com/mmurdoch/arduinounit/issues/68 ) ,
19- [ ArduinoUni #57 ] ( https://github.com/mmurdoch/arduinounit/pull/57 ) , and
20- [ ArduinoUni #55 ] ( https://github.com/mmurdoch/arduinounit/issues/55 ) ).
21+ [ ArduinoUni #57 ] ( https://github.com/mmurdoch/arduinounit/pull/57 ) ,
22+ [ ArduinoUni #55 ] ( https://github.com/mmurdoch/arduinounit/issues/55 ) ,
23+ [ ArduinoUni #54 ] ( https://github.com/mmurdoch/arduinounit/issues/54 ) ).
2124
2225In contrast:
2326* AUnit consumes as much as 66% * less* flash memory than ArduinoUnit on the
@@ -31,11 +34,16 @@ convert to AUnit:
3134* ` #include <ArduinoUnit.h> ` -> ` #include <AUnit.h> `
3235* ` Test::run() ` -> ` aunit::TestRunner::run() `
3336
34- Almost all of the frequently used macros are compatible between ArduinoUnit and
37+ Essentially all of the various macros are compatible between ArduinoUnit and
3538AUnit:
3639* ` test() `
3740* ` testing() `
3841* ` assertXxx() `
42+ * Meta Assertions
43+ * ` checkTestXxx() `
44+ * ` assertTestXxx() `
45+ * ` externTest() `
46+ * ` externTesting() `
3947
4048AUnit supports exclude and include filters:
4149* ` TestRunner::exclude() `
@@ -48,15 +56,19 @@ Here are the features which have not been ported over from ArduinoUnit:
4856* ArduinoUnit supports multiple ` * ` wildcards in its ` exclude() ` and ` include() `
4957 methods. AUnit supports only a single ` * ` wildcard and it must occur at the
5058 end if present.
51- * Various "Meta Assertions" from ArduinoUnit (i.e. ` checkTestXxx() ` and
52- ` assertTestXxx() ` ) have not been implemented.
5359
5460### Added Features
5561
56- Here are some features in AUnit, not available in ArduinoUnit:
62+ Here are the features in AUnit which are not available in ArduinoUnit:
5763
5864* The ` TestRunner ` supports a configurable timeout parameter which
59- can prevent ` testing() ` test cases from running forever.
65+ can prevent ` testing() ` test cases from running forever. The following
66+ methods and macros are available in AUnit to support this feature:
67+ * ` Test::expire() `
68+ * ` assertTestExpire() `
69+ * ` assertTestNotExpire() `
70+ * ` checkTestExpire() `
71+ * ` checkTestNotExpire() `
6072* AUnit works on the ESP8266 platform.
6173
6274### Beta Status
@@ -67,14 +79,16 @@ it currently in "beta stage" until more users have tested it.
6779
6880## Installation
6981
70- The library is available in the Arduino IDE Library Manager. Search for "unit
71- test" or "AUnit", select "AUnit", then click the "Install" button.
82+ The latest stable release is available in the Arduino IDE Library Manager.
83+ Search for "unit test" or "AUnit", select "AUnit", then click the "Install"
84+ button.
7285
73- The library can also be installed by cloning the
74- [ GitHub repository] ( https://github.com/bxparks/AUnit ) , then
75- manually copying over the contents to the ` ./libraries ` directory used
76- by the Arduino IDE. (The result is a directory named ` ./libraries/AUnit ` .)
77- See the Preferences menu for the location of the Arduino sketch directory.
86+ The development version can be installed by cloning the
87+ [ GitHub repository] ( https://github.com/bxparks/AUnit ) , checking out the
88+ ` develop ` branch, then manually copying over the contents to the ` ./libraries `
89+ directory used by the Arduino IDE. (The result is a directory named
90+ ` ./libraries/AUnit ` .) See the Preferences menu for the location of the Arduino
91+ sketch directory. The ` master ` branch contains the stable release.
7892
7993Using either installation method, you may need to restart the Arduino IDE to
8094pick up the new library.
@@ -310,9 +324,7 @@ The following boolean asserts are also available:
310324
311325### Meta Assertions
312326
313- *** ArduinoUnit Compatibility*** : _ Not implemented in AUnit._
314-
315- The following methods from ArduinoUnit are not implemented:
327+ The following methods from ArduinoUnit have also been implemented:
316328
317329* ` checkTestDone(name) `
318330* ` checkTestNotDone(name) `
@@ -322,6 +334,8 @@ The following methods from ArduinoUnit are not implemented:
322334* ` checkTestNotFail(name) `
323335* ` checkTestSkip(name) `
324336* ` checkTestNotSkip(name) `
337+ * ` checkTestExpire(name) ` [ &ast ; ]
338+ * ` checkTestNotExpire(name) ` [ &ast ; ]
325339* ` assertTestDone(name) `
326340* ` assertTestNotDone(name) `
327341* ` assertTestPass(name) `
@@ -330,14 +344,38 @@ The following methods from ArduinoUnit are not implemented:
330344* ` assertTestNotFail(name) `
331345* ` assertTestSkip(name) `
332346* ` assertTestNotSkip(name) `
347+ * ` assertTestExpire(name) ` [ &ast ; ]
348+ * ` assertTestNotExpire(name) ` [ &ast ; ]
333349
334- The following macros are not implemented because they are only needed
335- by the Meta Assertions:
350+ The ` checkTestXxx() ` methods check the status of the test named ` name `
351+ and returns a ` bool ` . The execution continues even if ` false ` .
352+
353+ The ` assertTestXxx() ` methods stops the unit test if the status check
354+ returns ` false ` , and prints assertion messages that look like this:
355+ ```
356+ Assertion passed: Test slow_pass is done, file AUnitTest.ino, line 366.
357+ Assertion passed: Test slow_pass is not failed, file AUnitTest.ino, line 372.
358+ Assertion passed: Test slow_skip is skipped, file AUnitTest.ino, line 448.
359+ ```
360+
361+ The following macros define ` extern ` references to test case objects which live
362+ in other ` .cpp ` files. These are required for the above meta assertions if the
363+ test cases are defined in another file:
336364
337365* ` externTest() `
338366* ` externTesting() `
339367
340- *** ArduinoUnit Compatibility*** : _ Not implemented in AUnit._
368+ *** ArduinoUnit Compatibility*** : _ The methods marked by [ &ast ; ] are only
369+ available in AUnit. Also, the assertion messages are different. ArduinoUnit
370+ reuses the format used by the ` assertXxx() ` macros, so prints something like
371+ the following:_
372+ ```
373+ Assertion passed: (test_slow_skip_instance.state=2) >= (Test::DONE_SKIP=2), file
374+ AUnitTest.ino, line 439.
375+ ```
376+
377+ _ AUnit has a separate message handler to print a customized message for the
378+ assertTestXxx() meta assertion macros._
341379
342380### Status Indicator Methods
343381
@@ -348,9 +386,10 @@ status reason).
348386* ` pass() ` - test passed
349387* ` fail() ` - test failed
350388* ` skip() ` - test skipped
351- * ` expire() ` - test timed out
389+ * ` expire() ` - test timed out [ & ast ; ]
352390
353- *** ArduinoUnit Compatibility*** : _ ` expire() ` is available only in AUnit._
391+ *** ArduinoUnit Compatibility*** : _ The method(s) marked by [ &ast ; ] are only
392+ available in AUnit._
354393
355394### Overridable Methods
356395
@@ -627,11 +666,11 @@ Teensy LC (static) | 8192 | 2980 | 2780 |
627666Teensy 3.2 (flash) | 262144 | 51236 | 36300 |
628667Teensy 3.2 (static) | 65536 | 5328 | 5236 |
629668---------------------------+---------+-------------+-------------|
630- ESP8266 - ESP-12E (flash) | 1044464 | does not | 267479 |
631- ESP8266 - ESP-12E (static) | 81920 | compile | 34564 |
669+ ESP8266 - ESP-12E (flash) | 1044464 | does not | 266748 |
670+ ESP8266 - ESP-12E (static) | 81920 | compile | 33128 |
632671---------------------------+---------+-------------+-------------|
633- ESP8266 - ESP-01 (flash) | 499696 | does not | 267359 |
634- ESP8266 - ESP-01 (static) | 47356 | compile | 34564 |
672+ ESP8266 - ESP-01 (flash) | 499696 | does not | 266748 |
673+ ESP8266 - ESP-01 (static) | 47356 | compile | 33128 |
635674---------------------------+---------+-------------+-------------|
636675```
637676
@@ -647,7 +686,7 @@ See [CHANGELOG.md](CHANGELOG.md).
647686This library was developed and tested using:
648687* [ Arduino IDE 1.8.5] ( https://www.arduino.cc/en/Main/Software )
649688* [ Teensyduino 1.41] ( https://www.pjrc.com/teensy/td_download.html )
650- * [ ESP8266 Arduino Core 2.4.0 ] ( https://arduino-esp8266.readthedocs.io/en/2.4.0-rc2 / )
689+ * [ ESP8266 Arduino Core 2.4.1 ] ( https://arduino-esp8266.readthedocs.io/en/2.4.1 / )
651690
652691I used MacOS 10.13.3 for most of my development.
653692
0 commit comments