Skip to main content

Model-based testing in Python

Project description

PyModel is an open-source model-based testing framework in Python.

In model-based testing, you code a model that can generate as many test cases as needed. The model also checks the test outcomes. Model-based testing is helpful where so many test cases are needed that it is not feasible to code them all by hand.

In the samples included with PyModel, there are models and test scripts for network sockets, a communication protocol, embedded controllers, some data structures, a multithreaded application, and a web application.

PyModel includes an analyzer for validating models, visualizing their behavior, and checking their safety properties.

PyModel can generate offline tests which are similar to unit tests, but the typical way to use PyModel is on-the-fly testing, where the test runner uses the model to compute the test run as it executes, so test runs can be as long as needed. On-the-fly testing can cope with nondeterminism and asynchrony in the system under test.

PyModel can combine models using composition, guide tests through programmed scenarios, and focus test coverage according to programmed strategies.

PyModel provides three main programs:

  • pma, PyModel analyzer: generates a finite state machine (FSM)

    and computes properties by exploring a model program, FSM, test suite, or a product of these.

  • pmg, PyModel graphics: generates a file of graphic commands from an FSM,

    that can be processed by the Graphviz dot command to produce graphics files in various formats including svg, pdf, and ps.

  • pmt, PyModel tester: displays traces, generates tests offline,

    executes offline tests, or generates and executes tests on-the-fly.

There is also a fourth program:

  • pmv, PyModel viewer: invokes pma, pmg, and the Graphiz dot

    command (to display the graphics generated by pmg). The pmv program provides brevity and convenience, so analysis and display can be accomplished by a single command.

Use pma and pmg (or pmv) to visualize and preview the behavior of pmt. Every path through the graph created by pma (and drawn by pmg) is a trace (test run) that may be generated by pmt, when pma and pmt are invoked with the same arguments. The pma program is also useful on its own for visualization and safety analysis.

PyModel work in progress is available at GitHub: https://github.com/jon-jacky/PyModel

The PyModel distribution is also available at the author’s web page: http://staff.washington.edu/jon/pymodel/www/

PyModel requires Python 2.6 or higher (because it uses itertools.product)

PyModel is influenced by NModel, but is not a translation or re-implementation.

PyModel is covered by the BSD License.

Code and documents are copyright (C) 2009-2013, Jonathan Jacky.

Revised May 2013

Project details


Download files

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

Source Distributions

PyModel-1.0.zip (813.2 kB view details)

Uploaded Source

PyModel-1.0.tar.gz (673.9 kB view details)

Uploaded Source

File details

Details for the file PyModel-1.0.zip.

File metadata

  • Download URL: PyModel-1.0.zip
  • Upload date:
  • Size: 813.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for PyModel-1.0.zip
Algorithm Hash digest
SHA256 2028147a3edc371ae9bc98e0f260110bbfc5354b6082cc504abd2fee92f1dfae
MD5 3d4217faa4297d041f8195b22f51448c
BLAKE2b-256 17b9751bd210daaf86c73d93c5b500860eee16beb8a76a1a7d59927096c44e8d

See more details on using hashes here.

File details

Details for the file PyModel-1.0.tar.gz.

File metadata

  • Download URL: PyModel-1.0.tar.gz
  • Upload date:
  • Size: 673.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for PyModel-1.0.tar.gz
Algorithm Hash digest
SHA256 6e99d049550caa1171561395bcf28446ab04aaae7e3f661ffe8d75b2b9d939fc
MD5 3d97b5263a7a04f7a2d324362063db72
BLAKE2b-256 84ba4ac09d73488e0cf55602df81dfcba5e5cba009ff824346e25f675cb8aa03

See more details on using hashes here.

Supported by

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