File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / dhcp / tests / HOWTO-unit-test
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Oct 9 09:06:55 2012 UTC (11 years, 8 months ago) by misho
Branches: dhcp, MAIN
CVS tags: v4_1_R7p0, v4_1_R7, v4_1_R4, HEAD
dhcp 4.1 r7

    1: Introduction
    2: ------------
    3: 
    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: 
   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.
   19: So, we (will eventually) have:
   20: 
   21:     server/tests/
   22:     client/tests/
   23:     common/tests/
   24:     dhcpctl/tests/
   25: 
   26: And so on.
   27: 
   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.
   31: 
   32: Running Unit Tests
   33: ------------------
   34: 
   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:
   40: 
   41: $ make check
   42: 
   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.
   45: 
   46: You can run a single test by going to the appropriate test directory 
   47: and invoking the test directly:
   48: 
   49: $ cd server/tests
   50: $ atf-run | atf-report
   51: 
   52: There are also a number of options that you can use when running a
   53: test. See atf-run and atf-report documentation.
   54: 
   55: Adding a New Unit Test
   56: ----------------------
   57: 
   58: See ISC DHCP Developer's Guide.
   59: 
   60: Adding a New Unit Test Program
   61: ------------------------------
   62: 
   63: See ISC DHCP Developer's Guide.

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>