Welcome to the new Ranorex Support Portal

How Do I Prevent Certain Combinations From Appearing Using the “Bound Constraint” Feature?

Creating bound constraints under the “Constraints” tab to insert system logic into your model.

Creating Bound Constraints

Imagine that you have these parameters & values…

You will have the following issue when you click on the “Scenarios” button:

To solve this problem, you first need to add “Not Applicable” as inputs

This is because something will need to appear in test cases that include the value “Do Not Add a Hotel”.

We will want “Not Applicable” to appear for both “Hotel Chain Preference” and “Type of Room” in every scenario that includes the value “Do Not Add a Hotel”.

Next, you’ll want to make sure that “Do Not Add a Hotel” only gets paired with the “Not Applicable” Values.

You have two options under the “Constraints” tab. One is quick, the other is slow. Let’s see the slow option, first

Namely, it’s adding a lot of “Invalid Constraints” as described in more detail in the previous article in this section.

This is the quick option… Bound Constraints!

Click on a set of green arrows for the first value

Repeat for the second value

Confirm how you’d like to have the bound constraint operate:

Most of the time when you have “Not Applicable” as an option, you will use “mutually bound constraints” as in this case. Here, we want “Do Not Add a Hotel” to be bound with Type of Room as “Not Applicable” AND we want to have Type of Room of “Not Applicable” to be bound with “Do Not Add a Hotel” so we mark this one as a Mutually Bound Constraint.

Boom! Pow! Shazam! Problem solved!

Further Information

So what really just happened there?

When you add a Bound Constraint, DesignWise will constrain the first value chosen against all the other values in the parameter of the second value chosen. In the example above, creating a bound constraint of ‘Do Not Add Hotel’ and ‘Hotel Chain Preference’ = ‘Not Applicable’ means you are really invalidating these options:

  • ‘Do Not Add a Hotel’ with ‘Hotel Chain Preference = Marriott’ (this combination will never appear).
  • ‘Do Not Add a Hotel’ with ‘Hotel Chain Preference = Hilton’ (this combination will never appear).
  • ‘Do Not Add a Hotel’ with ‘Hotel Chain Preference = Motel One’ (this combination will never appear).
  • ‘Do Not Add a Hotel’ with ‘Hotel Chain Preference = Vivanta by Taj’ (this combination will never appear).

And because we created a MUTUALLY BOUND constraint, we are also invalidating this combination:

  • ‘Do Add a Hotel’ with ‘Hotel Chain Preference = Not Applicable’ (this combination will never appear).

As you use the Bound Constraint feature, keep the following tips in mind:

  • You can use the Invalid Constraint Feature to accomplish anything that the Bound Constraint feature can do.
  • The Invalid Constraint feature is frequently less confusing to use for new users than the Bound Constraint feature. Don’t hesitate to use the Invalid feature instead of the Bound Constraint feature.
  • If you have more than 10 or so Bound Constraints or Invalid Constraints in a model, you might find that it is easier and faster to document your paired values in Excel. If so, we would recommend (a) adding multiple paired values before you export into Excel, and (b) ensuring that you use the exact spelling of Values (e.g., ‘cutting and pasting’ is usually safer than typing)
  • Watch out for “Not Applicable” values. Do you need to add them to your model? Do you need to invalidate the combination of “Not Applicable” with other selections? (In the example above, we did not want “Do Add a Hotel” to appear together with ‘Hotel Chain Preference = Not Applicable’)
  • Especially watch out for situations where you have MULTIPLE related “Not Applicable” values in a model. Would it make sense to create a “Bound Constraint” between, say, ‘Hotel Chain Preference = Not Applicable’ and ‘Type of Room’ = Not Applicable’? In the example above, it WOULD make sense to include that Bound Constraint. Every time ‘Hotel Chain Preference’ = ‘Not Applicable’ we would want ‘Type of Room’ to also be ‘Not Applicable’ also. Similarly, every time ‘Type of Room’ = Not Applicable, we would want ‘Hotel Chain Preference’ to also be ‘Not Applicable’. This is an example of a type of constraint that the human brain would handle effortlessly without even consciously applying logical rules.



Get the latest test automation information right in your mailbox.


© 2024 Ranorex GmbH. All Rights Reserved