summaryrefslogtreecommitdiff
path: root/cmdtest.1.in
blob: 8e392bc0388159b9a887be19f8d2ebb7c902d9f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
.\" Copyright 2011 Lars Wirzenius <liw@liw.fi>
.\" 
.\" This program is free software: you can redistribute it and/or modify
.\" it under the terms of the GNU General Public License as published by
.\" the Free Software Foundation, either version 3 of the License, or
.\" (at your option) any later version.
.\" 
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
.\" GNU General Public License for more details.
.\" 
.\" You should have received a copy of the GNU General Public License
.\" along with this program.  If not, see <http://www.gnu.org/licenses/>.
.\"
.TH CMDTEST 1
.SH NAME
cmdtest \- blackbox testing of Unix command line tools
.SH SYNOPSIS
.SH DESCRIPTION
.B cmdtest
tests Unix command line tools,
preferably non-interactive ones.
The user writes some tests,
consisting of the command to run, the input files given to it,
and the expected output.
.B cmdtest
runs the command,
compares the actual output to the expected output,
and reports any differences.
If everything matches,
then tests pass.
.SH OPTIONS
.SH EXAMPLE
To test that the
.BR echo (1)
command outputs the expected string,
create a file called
.I echo-tests/hello.script
containing the following content:
.IP
.nf
#!/bin/sh
$COMMAND hello, world
.fi
.PP
Also create the file
.I echo-tests/hello.stdout
containing:
.IP
hello, world
.PP
Then you can run the tests:
.IP
.nf
$ cmdtest echo-tests -c /bin/echo
test 1/1
1/1 tests OK, 0 failures
.fi
.PP
If you change the stdout file to be something else,
.B cmdtest
will report the differences:
.IP
.nf
$ cmdtest echo-tests -c /bin/echo
FAIL: hello: stdout diff:
--- echo-tests/hello.stdout	2011-09-11 19:14:47 +0100
+++ echo-tests/hello.stdout-actual	2011-09-11 19:14:49 +0100
@@ -1 +1 @@
-something else
+hello, world

test 1/1
0/1 tests OK, 1 failures
.fi
.SH "SEE ALSO"
.BR cliapp (5).