Commandline tools

  • API-Wrapper - epyunit.py: [doc] [source]

    Commandline interface, for help on the epyunit call e.g.:

    epyunit.py --help
    

    For quick verification of the setup and basic features call:

    epyunit.py --selftest
    
  • PyDev debug support: [doc] [source]

    ‘pydevd.py’ utilities for Eclipse/PyDev, for help on the epyd call e.g.:

    epyd --help
    
  • epyunit.unittest.subprocess: unittest.subprocess

    The module ‘epyunit.unittest.subprocess’ provides classes derived from ‘unittest’ for tests of arbitrary subprocesses.

  • bash - myscript.sh : test response simulator dummy

    For help on the provided hard-coded repsonses call:

    myscript.sh --help
    
  • Python - myscript.py : test response simulator dummy

    For help on the provided hard-coded repsonses call:

    myscript.py --help
    

‘myscript.py’ - Module

Testee data simulator.

Simulates hard-coded test results for the test of the tool chain itself, as reference probe for validation of the chain, and for test of base functions in case of derived classes.

Refer also to the probe simulators in other languages, when debug and step into the probe itself is required:

  • myscript.py - Python
  • myscript.sh - bash
  • myscript.pl - Perl
  • ffs.

Functions:

call_A_OK

epyunit.myscript.call_A_OK()[source]
# A: succeed: OK
EXIT:
0
STDOUT:
fromA
arbitrary output
arbitrary signalling OK string
arbitrary output
STDERR:

call_B_NOK

epyunit.myscript.call_B_NOK()[source]
# B: fail: NOK
EXIT:
0
STDOUT:
fromB
arbitrary output
arbitrary output
STDERR:
arbitrary signalling ERROR string

call_C_PRIO

epyunit.myscript.call_C_PRIO()[source]
# C: redundancy resolved by user defined priority: PRIO
EXIT:
0
STDOUT:
fromC
arbitrary output
arbitrary signalling OK string
arbitrary output
STDERR:
arbitrary signalling ERROR string

call_D_EXITOK

epyunit.myscript.call_D_EXITOK()[source]
# D: exit value: EXITOK
EXIT:
0
STDOUT:
fromD
arbitrary output
arbitrary signalling OK string
arbitrary output
STDERR:

call_E_EXITNOK

epyunit.myscript.call_E_EXITNOK()[source]
# E: exit value: EXITNOK
EXIT:
1
STDOUT:
fromE
arbitrary output
arbitrary signalling OK string
arbitrary output
STDERR:

call_F_EXIT7

epyunit.myscript.call_F_EXIT7()[source]
# F: exit value: EXIT7
EXIT:
7
STDOUT:
fromF
arbitrary output
arbitrary signalling NOK string
arbitrary output
STDERR:

call_G_EXIT8

epyunit.myscript.call_G_EXIT8()[source]
# G: exit value: EXIT8
EXIT:
8
STDOUT:
fromG
arbitrary output
arbitrary signalling NOK string
arbitrary output
STDERR:
arbitrary err output
arbitrary err signalling NOK string
arbitrary err output

call_H_EXIT9OK3NOK2

epyunit.myscript.call_H_EXIT9OK3NOK2()[source]
# H: exit value: EXIT9OK3NOK2
EXIT:
9
STDOUT:
fromH
OK
OK
OK
STDERR:
NOK
NOK

call_I_STDERRONLY

epyunit.myscript.call_I_STDERRONLY()[source]
# I: exit value: STDERRONLY
EXIT:
0
STDOUT:
STDERR:
fromI
NOK
NOK

call_DEFAULT

epyunit.myscript.call_DEFAULT()[source]
# DEFAULT: define: here succeed ‘–default-ok’: DEFAULT
EXIT:
123
STDOUT:
arbitrary output
STDERR:

‘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

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:

  • Adjusting the decision process:

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.
  1. Start outmost process from command line and attach it to PyDev by stub.

    epyunit --rdbg
    
  2. Start level-01 subprocess outermost process and attach it to PyDev by stub.

    epyunit --rdbg -- epyunit --rdbg
    
  3. 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.

‘epyd’ - Command line interface for pydevd.py

SYNOPSIS:

epyd [OPTIONS]

OPTIONS:

.

–force

Force selected parameters, ignore standard constraints.

–package

Package the current ‘pysrc’ into a deployment archive for remote debugging.

REMARK: current implementation packages the complete ‘pysrc’ subdirectory, which actually seems not to be required.

–package-type=(zip|tar.gz)

Type of archive.

–package-path=<filepathname-package>

The file pathname for the package to create.
–package-print
Prints the path name of the created package to stdout.

-d –debug

Debug entries, does NOT work with ‘python -O ...’. Developer output, aimed for filtering.

-h –help

This help.

-Version –Version

Current version - detailed.

-v –verbose

Verbose.

-version –version

Current version - terse.

ARGUMENTS:

none.

DESCRIPTION:

The epyd commandline interface provides a helpers for the preparation of remote 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.
  1. Start outmost process from command line and attach it to PyDev by stub.

    epyunit --rdbg
    
  2. Start level-01 subprocess outermost process and attach it to PyDev by stub.

    epyunit --rdbg -- epyunit --rdbg
    
  3. 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.

COPYRIGHT:

Arno-Can Uestuensoez @Ingenieurbuero Arno-Can Uestuensoez Copyright (C)2015-2016 Arno-Can Uestuensoez