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.3.tar.gz (5.4 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.3-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: testvdrive-1.2.3.tar.gz
  • Upload date:
  • Size: 5.4 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.3.tar.gz
Algorithm Hash digest
SHA256 5d704c94bc1957ae2948de1e3153a17baf81f60f07896023b2b5ea3f9ce13843
MD5 0f7d274df8538a27c69464da2a7a6cb9
BLAKE2b-256 d336a72682a40187d6a154ddd95e0dcd49af08a8d9900c8a72099b56b4363daf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: testvdrive-1.2.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6ac1281094a9bfb138bc22294f1afef03ab6f1af00e2c4ebab577b076e2be98a
MD5 6d44fd05b6712ce06e1730063dc2e2fc
BLAKE2b-256 e7a6e1b6b741a92696c4516ac53bec5c01f450d7e0f630d60f07f72c22beb9b5

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