Altwalker
https://altom.gitlab.io/altwalker/model-editor/#/visual-editor

Altwalker


Introduction

Altwalker is a MBT tool based on GraphWalker. Its input is also a FSM. It supports test generation on Python, C# and .NET programming languages.

Commands

Once installed, it provides a command line utility which, among others, offers the following features;

  • check: check the model for issues
  • generate: the test cases based on the model
  • init: initialise a new project
  • offline: generate test in a package in order to execute them later
  • online: run the tests

1. Start a new project

Following command will start the new project:

$ altwalker init testsLibrary -l python

It is going to create a directory whose name is testsLibrary directory with two subdirectories:

  • model: directory to store models
  • tests: directory to store generated tests

This POC is going to create tests using Python language. By default this command creates following directory structure:

No alt text provided for this image

The Python file test.py contains following content due to the default model stored on default.json file:

class ModelName:


    def edge_A(self):
        pass


    def vertex_A(self):
        pass


    def vertex_B(self):
        pass
    

2. Generate test sources

Engineers are going to generate test code based on a particular model. For instance, in the following example, the model is stored into the LibraryApiDemo.json file:

$ altwalker generate -m models/LibraryApiDemo.json testsLibrary2

It will generate the test code with empty implementation:

Test code with default implementation

Alike GraphWalker it requires engineers to implement edges and nodes steps.

3. Online test generation

Online test generation can be obtained by executing following command:

$ altwalker online \
testsLibrary/tests \
-m models/LibraryApiDemo.json \
"random(vertex_coverage(100))"

The model is a JSON file. In order to design the model the AltWalker model editor might be helpful.

Test execution output

Below two test execution output are presented, a failed and a successful one.

Failed execution

Altwalker failed execution output

Successful execution

Altwalker succesful execution output

4. Offline test generation

AltWalker offers also the ability to generate test using offline mode:

$ altwalker offline \
-m models/LibraryApiDemo.json \
"random(vertex_coverage(100))"

The output is a list of vertexes and edges that the test should go through:

Offline output

Previous option is easily parseable. Writing the test steps to execute is straightforward:

No alt text provided for this image

Conclusion

The article has presented AltWalker tool. It shows the commands offered as well as examples of use. The reader can also check two examples about the same SUT, one using online and another one using offline test generation mode.

References

To view or add a comment, sign in

More articles by Federico Dobal

  • fMBT

    Introduction fMBT generates and executes test cases on the fly. It is based on model graphs.

  • GraphWalker by examples

    Introduction The article will present an overview of GraphWalker by examples. As mentioned in previous post it requires…

  • Hello model based testing!

    Introduction This article summarises the first date and lessons learned during the process of approaching Model Based…

    3 Comments
  • Shut up my dear code coverage friend, we cannot trust you again! Can we?

    Introduction Development and quality teams rely on code coverage or testing coverage metrics. There is a distinction…

    3 Comments

Explore content categories