|
| 1 | + |
| 2 | +PyModel: Model-based testing in Python |
| 3 | +====================================== |
| 4 | + |
| 5 | +**PyModel** is an open-source model-based testing framework in Python. |
| 6 | + |
| 7 | +In model-based testing, you code a *model* that can generate as many |
| 8 | +test cases as needed. The model also checks the test outcomes. |
| 9 | +Model-based testing is helpful where so many test cases are needed |
| 10 | +that it is not feasible to code them all by hand. |
| 11 | + |
| 12 | +In the samples included with PyModel, there are models and test |
| 13 | +scripts for network sockets, a communication protocol, embedded |
| 14 | +controllers, some data structures, a multithreaded application, and a |
| 15 | +web application. |
| 16 | + |
| 17 | +PyModel includes an analyzer for validating models, visualizing their |
| 18 | +behavior, and checking their safety properties. |
| 19 | + |
| 20 | +PyModel can generate *offline tests* which are similar to unit tests, |
| 21 | +but the typical way to use PyModel is *on-the-fly testing*, where the |
| 22 | +test runner uses the model to compute the test run as it executes, so |
| 23 | +test runs can be as long as needed. On-the-fly testing can cope with |
| 24 | +nondeterminism and asynchrony in the system under test. |
| 25 | + |
| 26 | +PyModel can combine models using *composition*, guide tests through |
| 27 | +programmed *scenarios*, and focus test coverage according to |
| 28 | +programmed *strategies*. |
| 29 | + |
| 30 | +PyModel provides three main programs: |
| 31 | + |
| 32 | +- **pma**, PyModel analyzer: generates a finite state machine (FSM) |
| 33 | + and computes properties by exploring a model program, FSM, test suite, |
| 34 | + or a product of these. |
| 35 | + |
| 36 | +- **pmg**, PyModel graphics: generates a file of graphic commands from an FSM, |
| 37 | + that can be processed by the Graphviz *dot* command to produce graphics |
| 38 | + files in various formats including *svg*, *pdf*, and *ps*. |
| 39 | + |
| 40 | +- **pmt**, PyModel tester: displays traces, generates tests offline, |
| 41 | + executes offline tests, or generates and executes tests on-the-fly. |
| 42 | + |
| 43 | +There is also a fourth program: |
| 44 | + |
| 45 | +- **pmv**, PyModel viewer: invokes *pma*, *pmg*, and the Graphiz *dot* |
| 46 | + command (to display the graphics generated by *pmg*). The *pmv* |
| 47 | + program provides brevity and convenience, so analysis and display |
| 48 | + can be accomplished by a single command. |
| 49 | + |
| 50 | +Use *pma* and *pmg* (or *pmv*) to visualize and preview the behavior of *pmt*. |
| 51 | +Every path through the graph created by *pma* (and drawn by *pmg*) is a |
| 52 | +trace (test run) that may be generated by *pmt*, when *pma* and *pmt* are |
| 53 | +invoked with the same arguments. The *pma* program is also useful on |
| 54 | +its own for visualization and safety analysis. |
| 55 | + |
| 56 | +PyModel requires Python 2.6 or higher (because it uses *itertools.product*) |
| 57 | + |
| 58 | +PyModel is influenced by NModel, but it is not a translation or |
| 59 | +re-implementation. |
| 60 | + |
| 61 | + |
| 62 | + |
0 commit comments