Difference between revisions of "Testing"
(beginning start at a testing page) |
(→Available Test Groups) |
||
Line 60: | Line 60: | ||
| unit-tests | | unit-tests | ||
| Runs basic unit tests for the libraries. These tests generally involve compiling a simple c-application that execercises various aspects of the Net-SNMP C Libraries. | | Runs basic unit tests for the libraries. These tests generally involve compiling a simple c-application that execercises various aspects of the Net-SNMP C Libraries. | ||
+ | |- | ||
+ | | transports | ||
+ | | Tests each available transport type for its ability to send and receive data. Simple SNMP messages are sent from a client to an agent and back using each available transport type. Will likely require a properly setup network (eg, a working IPv6 interface if you compiled in IPv6 support). | ||
+ | |- | ||
+ | | tls | ||
+ | | Extensive tests of the TLS and DTLS transports to ensure they're functioning and all the features are working | ||
+ | |- | ||
+ | | perl | ||
+ | | Simple tests of the perl module and it's ability to send and receive data | ||
|- | |- | ||
|} | |} |
Revision as of 17:03, 8 December 2010
Net-SNMP comes with a testing suite that is simple to use, and fairly simple to write new tests for. The instructions below describe both how to the suite and how to write new tests for it.
Contents
Using the Test System
The simplest way to run the tests is to simply:
# cd testing # make test
And watch the output.
Notes for version 5.5 and below
make test really just invokes the "RUNTESTS" script. See the RUNTESTS -h output for help
Everything below this point applies primarily to version 5.6 and above. Although the "simple" tests described below still work and thus it's still possible to write new tests using that format for version prior to 5.6.
Notes for version 5.6 and above
In version 5.6 the testing suite was rewritten to provide:
- Logical grouping of tests
- The ability to generate compiled tests
- To make use of the wiki:Test Anything Protocol (TAP)
make test is still the simple way to run the default set of tests. This should work on every platform, although platforms with newer versions of perl will get increased levels of support. Platforms without perl at all can't take advantage of the TAP collection process and the output will thus be very verbose.
make test will still run the default set of tests for you, now using the RUNFULLTESTS script. However, there are more tests available that can be run in addition to the complete set. The test groups are located in individual directories in the testing/fulltests directory. The one exception is the support directory which merely contains supporting files for the other directories.
Running a particular test
To run a particular group use:
# cd testing # ./RUNFULLTESTS -g groupname
Where groupname is the directory name you wish to execute the tests from. For example:
# ./RUNFULLTESTS -g unit-tests
will run the unit-tests for the libraries.
Available Test Groups
Note: Features discussed on this page require Net-SNMP version 5.6 or higher.
The following list describes the test groups available in the latest version of Net-SNMP. These will only be available from 5.6 onward, and as Net-SNMP development continues some may only be available in the more recent versions:
Test Group | Description |
---|---|
all | A special keyword to run every available test group |
default | The default list of tests to run. This group is expected to work even with older versions of perl. The other groups frequently require Newer versions of perl (5.8+). |
unit-tests | Runs basic unit tests for the libraries. These tests generally involve compiling a simple c-application that execercises various aspects of the Net-SNMP C Libraries. |
transports | Tests each available transport type for its ability to send and receive data. Simple SNMP messages are sent from a client to an agent and back using each available transport type. Will likely require a properly setup network (eg, a working IPv6 interface if you compiled in IPv6 support). |
tls | Extensive tests of the TLS and DTLS transports to ensure they're functioning and all the features are working |
perl | Simple tests of the perl module and it's ability to send and receive data |