NModel is a model-based testing and analysis framework for model programs written in C#. It is explained and used in the book Model-based Software Testing and Analysis with C#.

In constrast with conventional unit testing, where a test engineer must code each test case, model-based testing is recommended where so many test cases are needed that it would be infeasible to code them all by hand. It is especially indicated for testing behaviors with data- and history-dependence and nondeterminism, where many different variations (data values, interleavings etc.) should be tested for each scenario (or use case). Model-based testing has been applied to communication protocols, web applications, embedded control systems, and graphical user interfaces.

The NModel release includes: The library also exposes the functionality of mpv, otg, ct and more, so you may write your own tools which are more closely adapted to your environment, or which provide other capabilities.

To use NModel, you must write your own model program in C# that models your implementation. Then you can use the mpv tool to visualize and analyze the behavior of your model program, in order to confirm that it behaves as you intend, and to check for design errors. To execute tests using the test runner ct, you must write a test harness in C# that couples your implementation to the tool. (The implementation does not have to be written in C# and does not have to use .NET.) You can use the test generator otg to create tests from your model program in advance, or let ct generate the test on-the-fly from your model program as the test run executes. If you wish, you can write a custom strategy in C# that ct uses to maximize coverage according to criteria you define. To express scenarios, you can dispense with C# and write simple finite state machines (FSMs), then use composition to achieve scenario control during testing or to check temporal properties during analysis. You can build up model programs from separate features or use composition to combine model programs in a well-structured way.

A good way to get started is to install NModel, download the reference manual and samples from Releases, and try some of the examples.

NModel requires .NET, but does not require Visual Studio.

NModel pages at Codeplex: Also: NModel pages elsewhere: Other projects:
  • PyModel: model-based testing in Python

Last edited Feb 5, 2010 at 4:54 AM by jon, version 12