Project

General

Profile

Actions

UnitTesting » History » Revision 4

« Previous | Revision 4/12 (diff) | Next »
Junxiao Shi, 06/14/2014 07:57 PM


Unit Testing

NFD requires unit testing for most modules.

NFD uses Boost Unit Test Framework.

Learning Resources for Boost Unit Test Framework

  • Boost Unit Test Framework documentation
  • 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. Use --help command line option to get more information about the available options.

Testing Code Guidelines

  • Test suites should be defined inside nfd::tests namespace.
  • Test suites should use nfd::tests::BaseFixture fixture, to get automatic setup and teardown of global io_service.
  • If a custom fixture is defined for test case or test case, that custom fixture should derive from BaseFixture.

Testing Helpers

  • tests/core/limited-io.hpp provides operation count and time limit
  • tests/daemon/face/dummy-face.hpp provides a Face that doesn't depend on a socket
  • tests/daemon/fw/strategy-tester.hpp provides a facade to test a forwarding strategy

Updated by Junxiao Shi over 10 years ago · 12 revisions