# Differences

This shows you the differences between two versions of the page.

 — rule-based-filter [2016/09/22 02:36] (current) Line 1: Line 1: + ===== Rule-based Filter ===== + When designing test data using combinatorial testing techniques, we often need to remove or avoid certain combinations as they are either unfeasible or unnecessary for whatever reason. ​ You can certainly remove them manually after the test combinations have been generated, but that's tedious and prone to errors. Depending on number of test combinations generated manually removing unwanted combinations may even be impossible due to large volume. + + The solution is to create a set of constraints or rules to instruct //​DataDesigner//​ to automatically filter out certain combinations.  ​ + + ---- + ==== Rule Expression ==== + + The rules are expressed as a simple expression: + IF condition THEN assertion + + The //​condition//​ and //​assertion//​ are simple boolean expressions:​ + ​[FieldName] [operator] [value or [FieldName] [&& or ||] ... + + Note field name can only contain alphabets, numbers and underscore. + + For example: + IF (OS = "​Windows"​) THEN (Browser = "​IE"​ || Browser = "​FireFox"​ || Browser = "​Netscape"​) + + where //OS// and //Browser// are two parameters of type Enum. This constraint specifies that if OS is Windows, then Browser has to be IE, FireFox, or Netscape. + + The //​operator//​ can be: + * > - greater than, numeric fields only + * < - less than, numeric fields only + * = - equals + * != - not equals + * >= - greater than or equal, numeric fields only + * <= - less than or equal, numeric fields only + + Arithmetic operations are also supported: + IF DEPOSIT_AMOUNT - WITHDRAW_AMOUNT <= 0 THEN REJECT_TRANSATION = true + + Only numeric fields can participate in the arithmetic operations. Following arithmetic operations are supported: + * + - addition + * - - substration + * * - multiplication + * / - division + * % - mod operation + + When comparing with text, the text must be enclosed with double quotes ("). + + Numeric constants may be used in the comparison, for example: + IF AGE >= 19 THEN ADULT = true + + Parenthesis can be used to help organize complex expression, for example: + IF (WINTER=true && TEMPERATURE > 30) || (SUMMER=true && TEMPERATURE < 90) THEN GOOD_WEATHER = true + + ​

#### Getting Started  