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.3.0.tar.gz (5.6 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.3.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for testvdrive-1.3.0.tar.gz
Algorithm Hash digest
SHA256 0c4e708dd2ec9badb6270f9850cba3cf574dffe784cc6437ee1b657cc63da04d
MD5 ace66d144779296eddea49c23e174494
BLAKE2b-256 85e5fbb3f4c8573852857f22d1c44a34bae33341687d61a2c228c09ec2ff7b28

See more details on using hashes here.

File details

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

File metadata

  • Download URL: testvdrive-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 5.5 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d5aac49051acb5fa776d0639e88e627c6e284c6c185cd4562cdcf27c34e6d5d2
MD5 ac93d9ab326edb37cace5ddd08a085a0
BLAKE2b-256 5ade425c70d01973dd83824251075f3a54f4b551ef80b37bf54d3deb26a739ca

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