https://github.com/robert-96/altwalker-graph-data-demo
A simple example of an AltWalker project that updates the graph data from the test code.
https://github.com/robert-96/altwalker-graph-data-demo
altwalker graphwalker model-based-testing python
Last synced: 3 months ago
JSON representation
A simple example of an AltWalker project that updates the graph data from the test code.
- Host: GitHub
- URL: https://github.com/robert-96/altwalker-graph-data-demo
- Owner: Robert-96
- License: mit
- Created: 2021-07-08T14:04:05.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-10-19T13:29:51.000Z (over 2 years ago)
- Last Synced: 2025-01-27T17:54:04.338Z (5 months ago)
- Topics: altwalker, graphwalker, model-based-testing, python
- Language: Python
- Homepage:
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# altwalker-graph-data-demo
A simple example of an AltWalker project that updates the graph data from the test code.
## Overview
This example showcases how you can update you graph data (model data) in order to influence the path generation.
Basically we have a node from witch we want to go.
> **Note**:
>
> This method doesn't works with the `offline` command because it generates all steps before the execution of the test code.
>
> This method only works with the `online` command, where only one step from the path is generated at a time and then executed.Fist we will initialize a variable `number` inside the `action` section of the model with a default value:
```json
"actions": [
"number = 0;"
]
```Fist we will add a guard.
```json
"guard": "number > 0.5"
```In order to update the graph data from your tests, you need to define the method with a parameter, and AltWalker will pass the graph data to your method. This method is a way of executing actions from you test code.
Then in the method corresponding with our branching vertex will add:
```python
def v_start(self, data):
data['number'] = random.random()
```## Setup
You can find the AltWalker setup guide [here](https://altom.gitlab.io/altwalker/altwalker/installation.html).
## Running the tests
```
$ altwalker online tests -m models/default.json "random(vertex_coverage(100))"
```## License
This project is licensed under the [MIT License](LICENSE).