Creating a rule

  1. Create a new testcase.
  2. Select the testmethod “Rules” in the register “Test” of the testcase editor.
  3. In he register “Probes” create a new dynamic probe that returns the dataset that should be validated by your rules.
    • For example: Return a list of employees from your HR-system. Every employee record has some attributes like birthdate, gender, salary, vacation days etc.
    • You can return either a single value (scalar value), a list or even a whole data table.
    • In most cases the rules testmethod is used with a whole data table. If that’s the case, don’t forget to set the extraction method of the probe to “Whole table”.
    • When your probe contains multiple data records (rows), you ideally define a primary key column. Otherwise you will not be able to recognize records in the test results.
  4. Test the probe by pushing the validate-button. Make sure that every requirement mentioned in the previous step is fulfilled.
  5. Switch to the register “Rules” and add a new rule using the “Create rule” button.
  6. Enter a name that clearly desribes the rule. You may enter an optional description.
  7. Enter the rule expression.
    • Single-Line Expression
      • Begin the expression with an equal sign =
      • The expression must return a boolean value (true or false).
        =Data("Gender").IsNotEmpty
    • Multi-Line Expression
      • Instead of defining a single-line expression beginning with an equal sign (=) you can also define a multi-line C# script that returns a boolean value at the end using the return-syntax.
var age = DateTime.Today.Year - Data("BirthDate").DateTime.Year;
var actualVacationDays = (double)Data("VacationHours").Decimal / 8.5;

var availableVacationDays = 0;
if (age <= 25) {
  availableVacationDays = 25;
}
else {
  availableVacationDays = 20;
}

return actualVacationDays == availableVacationDays;
  1. Run the test manually using the play-button on the top right of the testcase editor.
Table of Contents