Select the testmethod “Rules” in the register “Test” of the testcase editor.
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.
Test the probe by pushing the validate-button. Make sure that every requirement mentioned in the previous step is fulfilled.
Switch to the register “Rules” and add a new rule using the “Create rule” button.
Enter a name that clearly desribes the rule. You may enter an optional description.
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;
Run the test manually using the play-button on the top right of the testcase editor.
Table of Contents
Session expired
Please log in again.
The login page will open in a new tab. After logging in you can close it and return to this page.