---
title: "Rule-Based Test Generation"
slug: "rule-based-test-generation"
description: "Learn how to vary Test Case Generation from your Models and Subflows using Rule-Based Constraints."
tags: ["Video Tutorial", "Test Modeller", "Feature Overviews"]
updated: 2023-03-10T11:04:16Z
published: 2023-03-10T11:04:16Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://knowledge.curiositysoftware.ie/llms.txt
> Use this file to discover all available pages before exploring further.

# Rule-Based Test Generation

Learn how to vary Test Case Generation from your Models and Subflows using Rule-Based Constraints.

[Embedded content](https://www.youtube.com/embed/DH36yApLjPY?&amp;wmode=opaque&amp;rel=0)

Rules to traverse models!

**Preamble:** How to use Subflows to traverse across models with multiple end points.

- Log-in Subflow
- Reports Subflow

**Journey:** Log in as a certain type of user, choose a particular report, then test a report.

**Part1:**Drag Subflow node onto Canvas > Select from the directory the model to inhabit the Subflow node. > Connect up Subflows and select appropriate Subflow node.

**Part 2:**Now put in Logic into the Subflows

Go to Test Generation in Ribbon > Click Rules (icon) > Choose a pre-set Variables (you do this). Remember to Expose the Variable, so it can be picked up in the end-to-end Master Model. Advanced > Select Expose as Flow Parameter (this tells the optimiser what to do to resolve the Variable).

**Part 3:** Make an Assignment to the Variable on a node

Click on the required node > In the Ribbon, click Rules (icon) to show Node Logic Pane (All output decisions must be Assigned, otherwise the Rules are redundant).

**Part 4:**Create a new Coverage Profile

In the Ribbon > Click New (in-between Tests and Coverage icons) > Name it. Then > Click Coverage (icon) > Choose the Variables tab > Select a Variable and Value. (Whenever the Coverage Profile is Run).

**Part 5:**Re-import the modified Subflows into the end-to-end Master Model

Right click on Subflow node and right-click for Subflow Properties > Click Parameters to see the Variable is Exposed (no surprise). Declare a Variable and a second time in Subflow Properties link it to the Parameter in the Subflow. In the Data Painter Pane > Click Variable (in this case =[LoginModelControl]).

**Part 6:**Control how to get through the Logic

Set-up Coverage Profiles. Click Coverage (icon) > In the Coverage Profile Pane, select Variables Tab > Add all Variables.

A Model is a canvas and the Flow that is built onto it. There are several types of Model, some of which display different tabs and tools on the toolbar in Quality Modeller.

Subflows are used to quickly embed and re-use models within a master model. Subflows hide detailed or complex modelling and make the master Flow more readable. They enable scalability by building out the complexity from smaller, more step-focussed Models, rather than building giant, complex, inflexible Flows.

Test Data Variables are sets of data that can be attached to blocks in models. This data can be custom, synthetic, automated etc. Variables are basically assigned data values and rules to blocks, and this data is used when automation is run.

The Master Model is simply a model which combines Subflows into one large Model. Master Models are used to join together a range of system models, visualise them and test them as a whole.

Coverage Profiles are a wrapper for Coverage settings and options. Any number of Coverage Profiles can be created as required, each with its own Coverage settings. The Coverage button is on the Test Generation tab of a Model. Quality Modeller Models come with Default Profile, User Stories and Test Cases Profiles built in.

## Related

- [Quality Modeller 101](/test-modeller-101.md)
- [Quality Modeller](/get-started-with-test-modeller.md)
- [Test Case Generation](/test-case-generation-in-test-modeller.md)
- [Model Rules - Contains in List Rule](/model-rules-contains-in-list-rule.md)
- [Export Tests to Microsoft Excel](/generate-optimised-test-cases-and-test-data-into-excel.md)
