‘epyunit’ - Command line interface¶
The epyunit commandline interface provides a call wrapper for unit and regression tests of arbitrary executables. The wrapper internally relies on the standard packages ‘PyUnit’ and integrates into Eclipse by ‘PyDev’. Thus unit tests could be applied in particular for shell scripts and intermixed application processes implemented in multiple programming languages. Automation of remote debugging by PyDev is supported.
The interface is minimalistic but allows for almost any required blackbox test including seamless cross-process-debugging of executables.
Less Is More...
In particular blackbox-tests unittests of bash-scripts are provided by a simple call interface for seamless integration into PyDev and Eclipse.
SYNOPSIS:¶
epyu [OPTIONS] [--] <testee> [<testee-options>] # prefered on Linux,BSD,UNIX,MacOS epyu.py [OPTIONS] [--] <testee> [<testee-options>] # prefered on Windows
rulesets for testcase evaluation [syntax-tree] [API] [source] :
match pattern for filter [exitvalues] [outputstreams] :
--exitign, --exittype, --exitval, --stdoutnok, --stdoutok, --stderrnok, --stderrok,
Goto: exitign, exittype, exitval, stdoutnok, stdoutok, stderrnok, stderrok
filter parameters [outputstreams] :
--redebug, --redotall, --reignorecase, --remultiline, --reunicode,
Goto: redebug, redotall, reignorecase, remultiline, reunicode
correlator parameters [fuzzy results] :
--priotype --result, --resultnok, --resultok,
output and format [format] :
--csv, --pass, --passall, --raw, --repr, --str, --xml --appname, --test-id, --timestamp
process wrapper:
--cp, --cp-prepend, --cp-append --debug, --environment, --help, -Version, --Version, --verbose, -version, --version --selftest, --slang, --subproc, --subunit,
Goto: cp, cp-prepend, cp-append, debug, environment, help, Version, verbose, version, selftest, slang, subproc, subunit
subprocess debugging:
--rdbg, --rdbg-forward
Goto: rdbg rdbg-forward
OPTIONS:¶
appname
An arbitrary application name to be inserted into record headers.
--appname=<arbitrary-name-of-app>
cp
- Classpath for module search, replaces sys.path.
--cp
cp-append
- Classpath for module search, appended at the end of sys.path.
--cp-append
cp-prepend
- Classpath for module search, inserted at the beginning of sys.path.
--cp-prepend
csv
- Prints complete test result CSV format including header.
--csv
debug
Debug entries, does NOT work with ‘python -O ...’. Developer output, aimed for filtering.
--debug -d
environment
- Include platform info into header.
--environment
exitign
- Ignore exit value.
--exitign=(True|False)
exittype
- Expect exit value type as success.
--exittype=(True|False)
- True: Exit value ‘0’ indicates success.
- False: Exit value ‘!=0’ indicates success.
exitval
Indicates success when exit value is equal to the provided value.
--exitval=<exit-value>
help
- This help.
--help -h
pass
Pass through the testee results on STDOUT and STDERR. The exit value is interpreted by rules, else the execution state of the framework defines the exit value.
--pass exit: exec-state-of-wrapper-epyunit STDOUT: output-from-subprocess STDERR: output-from-subprocess
passall
Pass through the testee result on STDOUT and STDERR including transparently the received exit value.
--passall exit: exit-of-subprocess STDOUT: output-from-subprocess STDERR: output-from-subprocess
priotype
- In case of present failure and success conditions,
--priotype=(True|False) default := False
- True: The success conditions dominate, if present at least one.
- False: the failure condition dominates. if present at least one.
rdbg
Activates remote debugging with PyDev plugin of Eclipse. Optionally the host and port number of the server process could be changed.
--rdbg[=host[:port]] host := (ip-add|dns-name) port := (port-number) default := localhost:5678
rdbg-forward
Forward the ‘–rdbg’ option to subprocesses for nested debugging of process chains.
--rdbg-forward=(<forwarding-levels>|all|label) <forwarding-levels>: Number of levels to be forwarded, 0==None. all: all nested subprocesses label: An arbitrary label defined at initialization of the debug instance. Debugging is enabled when these match. default:=0: No forwarding.
raw
- Enables ‘raw’, equal to passall.
--raw
redebug
- Enables ‘re.DEBUG’
--redebug
redotall
- Enables ‘re.DOTALL’
--redotall
reignorecase
- Enables ‘re.IGNORECASE’.
--reignorecase
remultiline
- Enables ‘re.MULTILINE’.
--remultiline
repr
- Prints complete test result by Python call of ‘repr()’.
--repr
result
The treshold of the total matched results for changing the overall state to success.
--result=#total-results #total-results = #total-failure-results + #total-success-results
resultnok
The treshold of the total matched failure results for changing the overall state to success.
--resultnok=#total-failure-results
resultok
The treshold of the total matched success results for changing the overall state to success.
--resultok=#total-success-results
reunicode
- Enables ‘re.UNICODE’.
--reunicode
selftest
Performs a basic functional selftest by executing the basic examples based on ‘myscript.<slang>’ or <custom-simulator>.
--selftest
For the possible resource simulator calls see ‘–slang’.
slang
Defines the resource simulatorPerforms a basic functional selftest by executing the basic examples based on ‘myscript.sh’. All options and arguments are applied during the tests.
--slang[=(bash|perl|python|<custom-simulator>)]
- The following platform dependent defaults are applied by default:
BSD: python Cygwin: python Linux: python MacOS: python Windows: python
- Where the following scripts are assigned to the following provided language tags:
bash: epyunit/myscript.sh perl: epyunit/myscript.pl python: epyunit/myscript.py
Additional are going to follow. In addition any executable compliant to the options of the predefined could be called by:
custom-simulator: "file path name to any compatible executable"
stderrnok
- Matched string ‘<nok-string>’ on stderr indicates success.
--stderrnok=<nok-string> <nok-string>:=(literal|regexpr) literal := string-literal regexpr := regular-expression-re-module
stdoutnok
- Matched string ‘<nok-string>’ on stdout indicates success.
--stdoutnok=<nok-string> <nok-string>:=(literal|regexpr) literal := string-literal regexpr := regular-expression-re-module
stderrok
- Matched string ‘<ok-string>’ on stderr indicates success.
--stderrok=<ok-string> <ok-string>:=(literal|regexpr) literal := string-literal regexpr := regular-expression-re-module
stdoutok
- Matched string ‘<ok-string>’ on stdout indicates success.
--stdoutok=<ok-string> <ok-string>:=(literal|regexpr) literal := string-literal regexpr := regular-expression-re-module
str
- Prints complete test result by Python call of ‘str()’.
--str
subproc
- Change the framework for the subprocess call.
--subproc
Starts the subprocess by:
‘epyunit.SystemCalls’
instead of the default:
‘epyunit.SubprocessUnit’
subunit
- Change the framework for the subprocess call.
--subunit
Starts the subprocess by default:
‘epyunit.SubprocessUnit’
test-id
Prints the test-id with the formats ‘csv’, and ‘xml’. Too be applied in case of multiple test case calls.
--test-id=<arbitrary-identifier-for-record-header>
timestamp
- Includes date and time into record header.
--timestamp
Version
- Current version - detailed.
--Version -Version
verbose
Verbose, some relevant states for basic analysis. When ‘–selftest’ is set, repetition raises the display level.
--verbose -v
version
- Current version - terse.
--version -version
xml
- Prints complete test result XML format.
--xml
ARGUMENTS:¶
[–]
To be used when ambigous options and/or arguments exist, the first match terminates the evaluatoin of the wrapper options.
[--]
testee
- The wrapped testee, see EXAMPLES.
<testee>
testee-options
- Options of the testee, see EXAMPLES.
[<testee-options>]
DESCRIPTION:¶
The call interface ‘epyunit’ provides the commandline interface for the unit test wrapper classes.
The call is simply a prefix to the actual testee including it’s options. The wrapper itself provides various criteria for the indication of the success and/or failure of the test case. Therefore correlation of stdout, stderr, and exit values is provided.
The following categories of parameter are provided:
Filtering of sub-results:
.
Adjusting the decision process:
Expected result types:
.
Subprocess debugging:
.
ENVIRONMENT:¶
- PYTHON OPTIONS: -O, -OO: Eliminates ‘__debug__’ code.
EXAMPLES:¶
- Some simple call examples are:
epyunit -- myscript.sh EXITOK epyunit -- myscript.sh EXITNOK epyunit -- myscript.sh EXIT8
- A call example for cross-process-border remote debugging:
epyunit --rdbg -- epyunit --rdbg -- myscript.sh EXITNOK 0. 1. 2.
Start outmost process from command line and attach it to PyDev by stub.
epyunit --rdbg
Start level-01 subprocess outermost process and attach it to PyDev by stub.
epyunit --rdbg -- epyunit --rdbg
Start level-02 subprocess, here a shell script from level-2 subprocess, and attach it to PyDev by stub.
epyunit --rdbg -- epyunit --rdbg -- myscript.sh EXITNOK
Additional examples could be found within the source code, unit tests, and UseCases.
- CLI: command line interface
- Eclipse: Executable within Eclipse IDE
- Detailed examples in the subdirectories of the source package:
- tests + testdata
- UseCases
COPYRIGHT:¶
Arno-Can Uestuensoez @Ingenieurbuero Arno-Can Uestuensoez Copyright (C)2015-2016 Arno-Can Uestuensoez