summaryrefslogtreecommitdiffstats
path: root/web/input/doc/faq/nptest.md
diff options
context:
space:
mode:
Diffstat (limited to 'web/input/doc/faq/nptest.md')
-rw-r--r--web/input/doc/faq/nptest.md42
1 files changed, 42 insertions, 0 deletions
diff --git a/web/input/doc/faq/nptest.md b/web/input/doc/faq/nptest.md
new file mode 100644
index 0000000..71fda44
--- /dev/null
+++ b/web/input/doc/faq/nptest.md
@@ -0,0 +1,42 @@
1title: NPTest
2parent: FAQ
3---
4
5# How do the NPTest parameters work?
6
7NPTest.pm is a perl module, originally written by Peter Bray, and provides
8some basic functions for testing the plugins. It has two main helpers:
9`getTestParameter` and `testCmd`.
10
11## getTestParameter
12
13Used to get parameters given in previous test runs. Use the 3 parameter
14version (the 4 parameter version is deprecated).
15
16Saved parameters are put in `/var/tmp/NPTest.cache`. Unfortunately, there is
17no easy way of altering this - you will have to manually change this file to
18edit existing parameters.
19
20If you are adding new parameters, there are three values for the parameters
21that you need to be aware of:
22
23* default value
24* the value that you check against in the test script
25* an empty string, which is returned by getTestParameter when the test is run
26 via automated testing (technically, when no terminal is associated to the
27 test run)
28
29You should try and ensure current tests are not affected when a new parameter
30is added. So it may be better to say `NP_INTERNET_ACCESS`, with information
31like *default "yes", disable with "no"* and check for
32`NP_INTERNET_ACCESS == "no"` to skip the tests.
33
34## testCmd
35
36This runs a command and returns an NPTest object back. You can combine
37Test::More routines with the object to get the return code, output or perf
38data to test against expected values.
39
40See `plugins/t/check_disk.t` as an example test script.
41
42<!--% # vim:set filetype=markdown textwidth=78 joinspaces: # %-->