Trees | Indices | Help |
|
---|
|
'epyunit' - Command line interface
The epyunit commandline interface provides a call wrapper for unit and regression tests of arbitrary executables. This also includes the management of seammless cross-process debugging based on PyDev/Eclipse.
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 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.
SYNOPSIS:
epyunit [OPTIONS] [--] <testee> [<testee-options>]
The following categories of options are provided:
rulesets:
--exitign, --exittype, --exitval, --priotype --redebug, --redotall, --reignorecase, --remultiline, --result, --resultnok, --resultok, --reunicode, --stderrnok, --stderrok, --stdoutnok, --stdoutok,output and 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,
—exit-unit-ok, --exit-unit-failed
subprocess debugging:
--pydev-remote-debug, --rdbg, --rdbg-forward --rdbg-env
OPTIONS: .
--appname=<arbitrary-name-of-app> An arbitrary application name to be inserted into record headers. —cp=<path-list>
Classpath for module search, replaces sys.path.—cp-prepend=<path-list>
Classpath for module search, inserted at the beginning of sys.path.—cp-append=<path-list>
Classpath for module search, appended at the end of sys.path.—csv
Prints complete test result CSV format including header.-d --debug
Debug entries, does NOT work with 'python -O ...'. Developer output, aimed for filtering.—environment
Include platform info into header.—exitign=(True|False)
Ignore exit value.—exittype=(True|False)
Exit value 'True' indicates success for '0', 'False' indicates success for '!=0'.—exit-unit-failed=<exit-value>
Exit value to be emitted in case of failure of unittest.
default := 1
—exit-unit-ok=<exit-value>
Exit value to be emitted in case of success of unittest.
default := 0
—exitval=<exit-value>
Indicates success when exit value is equal to the provided value.-h --help
This help.—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.—passall
Pass through the testee result on STDOUT and STDERR including transparently the received exit value.—priotype
In case of present failure and success conditions,
TRUE: the success condition dominates.
FALSE: the failure condition dominates.
—pydev-remote-debug[=host[:port]]
Activates remote debugging with PyDev plugin of Eclipse.—raw
Same as '--passall'—rdbg[=host[:port]]
Activate remode debug, optionally the host and port number of the server process could be changed.
default:=localhost:5678
—rdbg-env
- Enables the readout of RDBG environment variables:
RDBGROOT, RDBGSUB—rdbg-forward=(<forwarding-levels>|all|label)
Forward the '--rdbg' option to subprocesses for nested debugging of process chains.
<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.
—redebug
Enables 're.DEBUG'—redotall:
Enables 're.DOTALL'—reignorecase:
Enables 're.IGNORECASE'.—remultiline:
Enables 're.MULTILINE'.—repr
Prints complete test result by Python call of 'repr()'.—result=#total-results
The treshold of the total matched results for changing the overall state to success.—resultnok=#total-failure-results
The treshold of the total matched failure results for changing the overall state to success.—resultok=#total-success-results
The treshold of the total matched success results for changing the overall state to success.—reunicode:
Enables 're.UNICODE'.—selftest
Performs a basic functional selftest by executing the basic examples based on 'myscript.<postfix>', see '--slang'.—slang[=(bash|perl|python|<file-path-name>)
Sets the subprocess script by it's programming language for the '--selftest' resource simulator. The following postfixes are currently available:
slang=bash -> postfix=sh
slang=perl -> postfix=pl
slang=python -> postfix=py
<file-path-name> -> "calls the provided executable"
default:=python
—stderrnok=<nok-string>
Error string on stderr indicates success.—stderrok=<ok-string>
OK string on stderr indicates success.—stdoutnok=<nok-string>
Error string on stdout indicates success.—stdoutok=<ok-string>
OK string on stdout indicates success.—str
Prints complete test result by Python call of 'str()'.—subproc
Starts the subprocess by: 'epyunit.SystemCalls' This mode also switches the output to '--passall' by default, when another output mode is required, set the required option after the '--subproc' option.—subunit
Starts the subprocess by the default: 'epyunit.SubprocessUnit'—test-id=<arbitrary-identifier-for-record-header>
Prints the test-id with the formats 'csv', and 'xml'. Too be applied in case of multiple test case calls.—timestamp
Includes date and time into record header.-Version --Version
Current version - detailed.-v --verbose
Verbose, some relevant states for basic analysis. When '--selftest' is set, repetition raises the display level.-version --version
Current version - terse.—xml
Prints complete test result XML format.
ARGUMENTS:
[--]
The double hyphen terminates the options of the call, thus the remaining part of the call is treated as the subcall of the testee.<testee>
The wrapped testee.[<testee-options>]
Options of the testee.
ENVIRONMENT:
PYTHON OPTIONS:
-O, -OO: Eliminates '__debug__' code.
EXAMPLES:
Basic call examples are provided:
For detailed examples refer to the subdirectories of the source package for:
- Unit tests
- UseCases
SEE ALSO:
Version: 0.2.0
Author: Arno-Can Uestuensoez
Copyright: Copyright (C) 2010-2016 Arno-Can Uestuensoez @Ingenieurbuero Arno-Can Uestuensoez
License: Artistic-License-2.0 + Forced-Fairplay-Constraints
|
|||
EPyUnitException |
|
|||
|
|||
|
|
|||
__uuid__ = '9de52399-7752-4633-9fdc-66c87a9200b8'
|
|||
__release__ = 'alpha2'
|
|||
_ai = sys.argv.index('--appname')
|
|||
_APPNAME = "epyunit"
|
|||
_host = platform.node()
|
|||
_user = "testuser"
|
|||
_osu = platform.uname()
|
|||
_os = _osu [0]
|
|||
_osver = _osu [2]
|
|||
_arch = _osu [-1]
|
|||
_longopts = ["priotype=", "result=", "resultnok=", "resultok="
|
|||
_sopts = "a:hdv"
|
|||
_tmp = sys.path.pop(0)
|
|||
_kargs = {}
|
|||
_appname = None
|
|||
_testid = 0
|
|||
_selftest = False
|
|||
_slang = 'python'
|
|||
_verbose = 0
|
|||
_debug = 0
|
|||
_default = 'OK'
|
|||
_prio = "NOK"
|
|||
_exit = "OK"
|
|||
_exitokval = 0
|
|||
_exitnok = "NOK"
|
|||
_exitnokval = 1
|
|||
_chk_exit = True
|
|||
_chk_stderr = False
|
|||
_CHK_STDERR_OK = []
|
|||
_CHK_STDERR_NOK = []
|
|||
_chk_stdout = False
|
|||
_CHK_STDOUT_OK = []
|
|||
_CHK_STDOUT_NOK = []
|
|||
_result = 0
|
|||
_out = None
|
|||
_timestamp = False
|
|||
_environment = False
|
|||
_myRulesMap = {}
|
|||
_O_REPR = 0
|
|||
_O_XML = 1
|
|||
_O_CSV = 2
|
|||
_O_PASS = 3
|
|||
_O_PASSA = 4
|
|||
_CALL_SUBPROC = SubprocessUnit
|
|||
_myargs = {}
|
|||
_mi = 0
|
|||
sx = _CALL_SUBPROC(** _kargs)
|
|||
ret = sx.callit(' '.join(_args))
|
|||
_unit_status = sx.apply(ret)
|
|
_longopts
|
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Mon Mar 27 06:09:19 2017 | http://epydoc.sourceforge.net |