-
Notifications
You must be signed in to change notification settings - Fork 994
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add more comments to the temperature switch unit test
- Loading branch information
Showing
2 changed files
with
43 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,40 @@ | ||
# Test framework Usage | ||
# Test framework | ||
|
||
## Background | ||
|
||
|
||
This is a frame work for writing unit tests for modules or libs. | ||
It compiles only src/libs/... and a few select needed modules by default. | ||
It runs on the target and the output is written to the serial UART, it runs well with MRI so you can also debug with GDB. | ||
|
||
You can edit the Rakefile to specify which module you are going to test the example has tools/temperaturecontrol selected. | ||
|
||
The unit tests go in a directory named src/testframework/unittests/XXXX/YYYY where XXXX is the module subdirectory (tools,utils) and YYYY is the modulename | ||
The unit tests go in a directory named src/testframework/unittests/*XXXX*/*YYYY* where *XXXX* is the module subdirectory (tools,utils) and *YYYY* is the modulename | ||
|
||
The Kernel and main are replaced with special versions for testing. | ||
|
||
The main way to test is to stimualte the modules by sending it commands via on_gcode_received(), and monitor its actions my mockin gthe ON_PUBLIC_SET/GET calls it makes. | ||
A properly written module does not access other modules any other way. | ||
The main way to test is to stimulate the modules by sending it commands via | ||
on_gcode_received() (or other events it is registered for), and monitor its | ||
actions my mocking the ON_PUBLIC_SET/GET calls it makes. A properly written | ||
module does not access other modules any other way. | ||
|
||
Many HAL calls are made via THEKERNEL->xxx (eg THEKERNEL->adc) and these can be intercepted by mocks to provide the module with its external data. | ||
|
||
An example is provided here... | ||
|
||
`src/testframework/unittests/tools/temperatureswitch/TEST_TemperatureSwitch.cpp` | ||
|
||
you compile a unit test and framework using rake... | ||
## Usage | ||
|
||
You compile a unit test and framework using [rake](http://rake.rubyforge.org/)... | ||
|
||
```shell | ||
rake testing=1 | ||
rake upload | ||
> rake testing=1 | ||
> rake upload | ||
``` | ||
|
||
The unit test will run, the results are printed to the serial uart port, and then it is lieft in DFU mode so rake upload can be run again for the next test. | ||
The unit test will run, the results are printed to the serial uart port, and then it is left in DFU mode so `rake upload` can be run again for the next test. | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters