xref: /minix3/external/bsd/dhcp/dist/tests/HOWTO-unit-test (revision 83ee113ee0d94f3844d44065af2311604e9a30ad)
1Introduction
2------------
3
4That is only a brief overview of tests in ISC DHCP. For more thorough
5description, see ISC DHCP Developer's Guide. You can generate it, by
6having Doxygen installed and doing:
7
8 cd doc
9 make devel
10
11and then opening doc/html/index.html
12
13Tests Overview
14--------------
15
16In DHCP, a unit test exercises a particular piece of code in
17isolation. There is a separate unit test per module or API. Each unit
18test lives in a directory beneath the code it is designed to exercise.
19So, we (will eventually) have:
20
21    server/tests/
22    client/tests/
23    common/tests/
24    dhcpctl/tests/
25
26And so on.
27
28We are using ATF (Automated Test Framework) as a framework to run our
29unittests. See ISC DHCP Developer's Guide for much more thorough
30description of unit-test and ATF framework in general.
31
32Running Unit Tests
33------------------
34
35In order to run the unit tests for DHCP, enable ATF support during configure:
36
37$ ./configure --with-atf
38
39And then use:
40
41$ make check
42
43This will run all of the unit tests. Make sure that ATF is actually
44installed and that you have atf-run and atf-report tool in your PATH.
45
46You can run a single test by going to the appropriate test directory
47and invoking the test directly:
48
49$ cd server/tests
50$ atf-run | atf-report
51
52There are also a number of options that you can use when running a
53test. See atf-run and atf-report documentation.
54
55Adding a New Unit Test
56----------------------
57
58See ISC DHCP Developer's Guide.
59
60Adding a New Unit Test Program
61------------------------------
62
63See ISC DHCP Developer's Guide.
64