Project

General

Profile

UnitTesting » History » Version 4

Junxiao Shi, 06/14/2014 07:57 PM

1 1 Junxiao Shi
# Unit Testing
2
3
NFD requires unit testing for most modules.
4
5 2 Junxiao Shi
NFD uses [Boost Unit Test Framework](http://www.boost.org/doc/libs/1_48_0/libs/test/doc/html/index.html).
6 1 Junxiao Shi
7
## Learning Resources for Boost Unit Test Framework
8
9 2 Junxiao Shi
* [Boost Unit Test Framework documentation](http://www.boost.org/doc/libs/1_48_0/libs/test/doc/html/index.html)
10 1 Junxiao Shi
* After compiling the unit-test binary, it is possible at run time to select which tests to run and what kind of output is desired.
11
  Use `--help` command line option to get more information about the available options.
12 2 Junxiao Shi
13
## Testing Code Guidelines
14
15
* Test suites should be defined inside `nfd::tests` namespace.
16
* Test suites should use `nfd::tests::BaseFixture` fixture, to get automatic setup and teardown of global `io_service`.
17
* If a custom fixture is defined for test case or test case, that custom fixture should derive from `BaseFixture`.
18 3 Junxiao Shi
19
## Testing Helpers
20
21
* `tests/core/limited-io.hpp` provides operation count and time limit
22 4 Junxiao Shi
* `tests/daemon/face/dummy-face.hpp` provides a `Face` that doesn't depend on a socket
23
* `tests/daemon/fw/strategy-tester.hpp` provides a facade to test a forwarding strategy