sample
tester sample - tester sample test specification
This page provides a sample test specification. In the web form a space
has been placed at the beginning of each line to turn off formatting. To
use this page as a test specification, the space has to be deleted since
test commands must begin in the first column.
See ``t.form'' as a working test template specification.
The tester manual overview refers to all other sections:
Test Specification Form
tests Description of sample tests.
Names to substitute. It helps to make them stand out with
capitol letters. The strength is that names can be changed
in one place. By default, the tester will for the ".names"
file as well.
name definition
SOURCE master directory for XYZ project
Alternate name values
name alternate_value
names
CAT /bin/cat
CD /bin/cd
CP /bin/cp
ECHO /bin/echo
GREP /bin/grep
LS /bin/ls
MORE /bin/more
MV /bin/mv
RM /bin/rm -f
SOURCE /usr2/home/develop/test/master
# A comment stops the processing after any multi-line request
or another valid keyword command.
Environment commands to give to any shell command stream
envall
#
Before all testing execute
beforeall $ECHO beforeall: $TESTSDESC
$CP $SOURCE/mytestdata/data* .
#
After all testing execute
afterall $ECHO afterall: $TESTSDESC
$RM data*
#
defaults follows this (apply till the next default)
default Test group description.
class class_name_list
beforeall executes before this group of tests
beforeall $ECHO beforeall: $DEFDESC
#
Before each test execute
before $ECHO before: $TESTDESC
#
Environment commands for the run command
env
#
Expect these results (stdout, stderr, both, same, out, ...)
expect both
Exit code expected from the run command (value of exit)
exit 0
Diff command to be applied with any options (diff, spiff, cmp, ...)
diff diff
Save these results (stdout, stderr, both, same, out, ...)
save both
Prune commands before any expected output is checked
prune
#
After each test execute
after $ECHO after: $TESTDESC
#
afterall executes before this group of tests
afterall $ECHO afterall: $DEFDESC
#
Tests (use descriptions to make them unique)
test test_description
class test_type
run run_command options arguments
#
Next test, ...
test test_description
class test_type
run run_command options arguments
any lines after the run
will be fed as input lines
to the command
#
These acceptable test specific commands override a default
env
expect out1 out2
save out4
exit 1
diff cmp
before
prune $CAT $TESTSPEC.out1 | myFilter | reduce > $TESTSPEC.out3
$CP $TESTSPEC.out1 $TESTSPEC.out4
$CP $TESTSPEC.out3 $TESTSPEC.out1
after
#
end
Anything text after "end" is ignored.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Sample Test Specification (from test descriptions)
Non-executable tests
Valid Arguments
positional arguments vs options
duplicate options
long names
Invalid Arguments
no argument specified
no filename specified
invalid format
invalid long format
no format specified
invalid option
Executable tests
Valid data with different sizes: 4, 8, 16, 32
clean up output files afterward after saving "ls -l" & sum
remove date and time information that varies from run to run
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Suggestion: auto-generate the specification from tests/runs and vi
vi command to show tests:
:!grep ^test t.form | sed 's/^test//'
vi command to show tests/class
:!egrep "^test|^c|ass|^default" t.form |sed 's/^class//'|sed 's/^test//'|sed 's/^default//'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
See files beginning with "t." as samples of test scripts.