Skip to main content

Python test by send / expect.

Project description

Python test drive utility

A nifty utility to test things.

The test case file drives a send / expect engine. The expect is then evaluated and the result is printed in a green colored 'OK' or a red colored 'ERR'.

./testvdrive.py testcase.txt

If you installed from pip, use:

testvdrive testcase.txt

The test case file contains the test instructions, one line per test. The format:

#   Context_string  Send_string     Expect_string   Find/Compare
#   --------------  -----------     -------------   ------------
#    for the user   what to test    what to expect  True if Find

Example test cases:

[ "Echo Command", "", "", True],                # NOOP
[ "Test ls", "ls", "Make", True],               # Do we have a Make file
[ "DF command", "df", "blocks", "regex" ],      # Search regex
[ "DF mregex", "df", ".*blo",  "mregex" ],      # Match regex

The output of example test cases (colored in terminal):

Echo Command     	 OK
Test ls          	 OK
DF command       	 OK
DF mregex        	 OK

Help from command line:

 usage: testvdrive [-h] [-V] [-o] [-A] [-v] [-d DEBUGLEV] [-l FILL] [-s]
                  [test_cases ...]

Test with send/expect by executing sub commands from test case scripts.

positional arguments:
  test_cases            Test case file names to execute

options:
  -h, --help            show this help message and exit
  -V, --version         Show version number
  -o, --outp            Show communication with program
  -A, --info            Show testcase file format info
  -v, --verbose         increase verbocity (Default: none)
  -d DEBUGLEV, --debug DEBUGLEV
                        Debug value (0-9). Show working info. Default: 0
  -l FILL, --fill FILL  Fill info string to lenght. Default: 16
  -s, --show_case       Show test case file(s).

For info on TestCase File Format use -A option. The file 'testcase.txt' is
executed by default.

Git

The source can be found on:

    https://github.com/pglen/testvdrive

// EOF

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

testvdrive-1.2.1.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

testvdrive-1.2.1-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file testvdrive-1.2.1.tar.gz.

File metadata

  • Download URL: testvdrive-1.2.1.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for testvdrive-1.2.1.tar.gz
Algorithm Hash digest
SHA256 4729aa8f0ddfe8cd80fabec5bedf5a77f68412a0da595ea53df9549d017eb24a
MD5 1d15115f736cb79f2afd03c3cfd5cc05
BLAKE2b-256 0605c077ab6457ee1fbd38de502df38b7656120b5ff836d3e9604950ff2c401c

See more details on using hashes here.

File details

Details for the file testvdrive-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: testvdrive-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for testvdrive-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d344c74926cbb24b18c2482b4c355d4b741cda38ab80fef0346c6ca25aa137c7
MD5 65b7ddba3b90195e87211f3b0dfade6c
BLAKE2b-256 a69331c052810477a46b56868a42f7f9de44dc0ce38cec52e7c53954a295b987

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page