Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
maxLevel4

Overview

Invalid constraintsĀ restrict parameter values that canĀ neverĀ be tested together.

In specific scenarios, system allows user to define what parameter values can never be tested together or in the other hand, scenarios where parameter values can only be tested together.Ā 
For that, user can apply constraints to support these cases.


So that the model can understand the requirements, you have the option to define invalid constraints (values that can never be tested together), and/or bound constraints (values that can only be tested together) to train the model.

Invalid constraints

Invalid constraintsĀ restrict parameter values that canĀ neverĀ be tested together.


In this example, let's assume Internet Explorer (IE) is not supported on Apple computers so it would be impossible for a tester to execute a test case that instructed them to launch IE from a Mac running on its native operating system. Accordingly, we do not want any tests generated to include combinations such as ā€œOS Xā€ and ā€œIE8ā€ in the same test case.

Image Added

On the Rules ->Constraints screen, you will need to click on two red Xā€™s. Hover over the first Value of the Invalid Pair and click on the red X that appears

Image Added


Find the second Value that can never appear together with the first one, hover over it, and click on the red X to create your ā€œInvalid Pairā€

Image Added


As you enter your Constraints, you will see them listed to the left:

Image Added

After you enter these two Invalid Pairs, clicking on the ā€œScenariosā€ button will create a completely new set of test cases that excludes those two pairs of Values (and only those two pairs of Values). Each test with ā€˜OS Xā€™ as the operating system will have a browser other than IE.

As you use the Invalid Pair feature and the related Bound Pair one, keep in mind these usage tips:

Tip

Do you need to addĀ a lotĀ of Invalid Constraints?

  • Imagine you had an application that asked, ā€œWould you like to add a hotel to your travel reservation?ā€ Any scenarios with ā€œDo Not Add a hotelā€ would require many, many different Invalid Constraints between things like ā€œDo Not Add a Hotelā€ and ā€œHotel Chain Preference = Xā€. For situations like those, the Bound Constraint feature will help you accomplish your constraint handling much faster.
  • If you have more than 10 or so Invalid Constraints (or Bound Constraints) in your plan, you might find that it is faster to export your plan into Excel and document your paired values in Excel. If so, make sure to both (1) add multiple paired values in Xray Test Case Designer before you export into Excel (so you can copy and paste the Xray Test Case Designer formatting for Invalid Constraints and/or Bound Constraints), and (2) ensure that you use the exact spelling of Values (e.g., ā€˜cutting and pastingā€™ Values will usually be safer than typing)

Watch out for ā€œNot Applicableā€ Values.

  • Do you need to add some of them to your plan? Do you need to invalidate the combination of ā€œNot Applicableā€ with other specific Values?
  • Especially watch out for situations where you have multiple related ā€œNot Applicableā€ values in a plan. Would it make sense to create a ā€œBound Constraintā€ between ā€˜Hotel Chain Preference = Not Applicableā€™ and ā€˜Type of Roomā€™ = Not Applicableā€™?




Bound constraints

Bound constraintsĀ restrict parameter values that canĀ onlyĀ be tested together.


Consider these parameters & values:

Image Added


You will have the following issue when you click on the ā€œScenariosā€ button:

Image Added

Even though the test calls for not adding the hotel, the data row proceeds to specify the preference and type of room, which is clearly incorrect.


To solve this, you first need to add ā€œNot Applicableā€ as parameter values

Image Added

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ā€.

Info

The exact syntax of the conditional value and its position in the list don't matter, it could have been "N/A" as the last value.


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:

Image Added

Namely, itā€™s adding a lot of ā€œInvalid Constraintsā€ as described in the previous article in this section.

How to use Bound Constraints

UI Steps
sizesmall
UI Step

Click on the green arrow icon to the right from the first value name (it appears on hover)

Image Added

UI Step

Click on the green arrow icon to the right from the second value name (it appears on hover)

Image Added

UI Step

Confirm how youā€™d like to have the bound constraint operate:

Image Added

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.


When you add a Bound Pair, Xray Test Case Designer 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 these combinations:

  • ā€˜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 for new users . 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 plan, 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)
  • Especially watch out for situations where you have MULTIPLE related ā€œNot Applicableā€ values in a plan. 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.


ā€œBound Constraintsā€ are rules for your model algorithm to ensure that two values must appear together. Knowing which type to use depends on your plan structure and business & technology requirements.

We will be using this set of values to demonstrate:

Image Added

As a reminder, to apply a bound constraint, you need to hover over value 1, click the green arrow icon to the right from the value name, then do the same for value 2, and select the appropriate option from the 3 provided ones.

One-way Bound Pair

The underlying relationship type: many-to-one, represented by WHEN-THEN statements in the left column.

We would like to exclude combinations like ā€˜Breed of Animal = Shiba Inuā€™ and ā€˜Type of Animal = Catā€™ from the generated scenarios. We have 2 breeds for each of the first 2 types of animals. Therefore, we can set up 4 one-way bound pairs from "Breed of Animal" to "Type of Animal":

Image Added

You can check your logic by reading the statement at the bottom of the dialog.


The order in which you set the pair matters!

In this case, we wouldn't be able to say WHENĀ ā€˜Type of Animal = Catā€™ THENĀ ā€˜Breed of Animal = Siameseā€™ because that would prevent 'Cat + Persian' from appearing and would leave 'Persian" without any possible pairing.

Image Added

Note
You may argue that the statement at the bottom still looks correct in this direction, however you need to keep in mind how the word "must" is interpreted by the algorithm. Since the evaluation is done at the "pair of values" level, "must have Breed of Animal as Siamese" = "must NOT have Breed as Persian, Shiba Inu, Golden Retriever, Arabian" - of which "Persian" is incorrectly excluded, therefore this direction wouldn't work for this example. We could use such direction if we had multiple types that can be with only 1 breed.

Mutually Bound Pair

The underlying relationship type: one-to-one, represented by ALWAYS-ALWAYS statements in the left column.

With Mutually Bound Constraints, the values are exclusive to each other. In this example, there is only one horse breed in the second parameter. So, with 1 constraint, we can specify that "Horse" should not be paired with "Siamese, Persian, Shiba Inu, Golden Retriever" AND "Arabian" should not be paired with "Cat, Dog" - i.e., "Horse" and "Arabian" must only be tested together.

Image Added


The final set of rules for this model (in the verbal form) would look like this:

Image Added

In essence, Bound Constraints and Invalid Constraints perform similar tasks: they ensure that certain values only or never appear together - making all generated scenarios valid within the model scope. From a different point of view, Bound Constraints and Mutually Bound Constraints actually invalidate many values and Invalid Constraints bind many values, behind the scenes.


"Skip" constraints

"Skip" constraints are only available under the Advanced Mode which is enabled per request (toggle in the top left of the Constraints screen).

"Skip" constraints allow for certain parameters to be excluded from test cases when it is not appropriate for them to appear. It is a faster alternative to the "Not applicable" + Bound Pairs approach. However, as the feature is in the beta stage,Ā please note that there are a couple open defects, specifically around the interaction of "Skip" constraints with the regular ones. So if you encounter any issues, feel free to reach out to SupportĀ or avoid skips for the time being.

How to Use Skip Constraints

For example, letā€™s use this plan below for a flight booking system:

Image Added

In this model, only customers who are in First Class get in-flight dining. Coach and Business class customers do not get in-flight dining. Therefore, test cases with Coach and Business class customers should have no value for ā€œFood Choiceā€.


First, navigate to Rulesā†’ Constraints.Ā Next, click the toggle to change to Advanced Mode ā€“ that is the only way to implement "Skip" constraints:

Image Added

Once in Advanced Mode, we use the following syntax for "Skip" constraints:

Ā  Ā  Ā  Ā  Ā  Ā  Parameter[Parameter Value] >> Parameter(s) to be skipped

So, for our example, the syntax is this:

Image Added

The ability to include multiple values in the same constraint is an aspect of the Advanced Mode that is not limited to "Skip" constraints.

Now, when we generate our test suite by navigating to Scenarios, any row that includes ā€œTicket Typeā€ as ā€œCoachā€ or "Business" will have no value for ā€œFood Choiceā€:

Image Added

You can also skip multiple parameters that are listed next to each other in the Parameters screen. For example, letā€™s say that Coach customers now get no food, drink, or checked bag. Thus, they should have blanks for each of those parameters. Since we have those 3 sequentially in the table of parameters (refer to the model screenshot at the start of this article), we canĀ use the following syntax:

Ā  Ā  Ā  Ā  Ā  Parameter[Parameter Value] >> First Parameter to be skipped :: Last parameter to be skipped

The boundaries are inclusive, therefore, for our example, that looks like this:

Image Added

Now, when we generate our test suite by navigating to Scenarios, any rows with ā€œCoachā€ for ā€œTicket Typeā€ have no value for ā€œFood Choiceā€, ā€œDrink Choiceā€, or ā€œChecked Bagā€:

Image Added


The final component of "Skip" constraints is the ā€˜skip to endā€™ capability. In this case, we can tell Xray Test Case Designer that for some parameters values, skip all parameters listed later (below) on the ā€œParametersā€ page.

So, for our example, we could return to our Parameters page and reorder the elements so that ā€œFood Choiceā€, ā€œDrink Choiceā€, and ā€œChecked Bagā€ are the last three parameters:

Image Added

Then, we use the syntax below to skip to end:

Ā  Ā  Ā  Ā  Ā  Parameter[Parameter Value] >> First Parameter to be skipped::!!

For our example, that looks like this:

Image Added

Lastly, you can do a quick review of available options & syntax by clicking the ā€œUsageā€ button in top-right section of the Advanced Mode:

Image Added


View a Constraint

UI Steps
sizesmall
UI Step

To view constraints, select the option "Rules" and then "Constraints" on the model

Image Added

UI Step

A list with all the bound and invalid constraints will be displayed.

Image Added


Edit a Constraint

To edit a constraint, you need to change view to "bulk" . Then you can edit the constrain type selecting the corresponding operator.Ā 

Image Added

It is not possible to edit a constrain at the Standard View. In the Standard View you are only allowed to delete and create a new constrain.

Delete a Constraint

To delete a constraint, hover the constraint and select the delete option:
Image Added

Bound constraintsĀ restrict parameter values that canĀ onlyĀ be tested together.Another option is to, on bulk view mode, delete the desired constraint line:
Image Added