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