Business Rules Table
Each row in the Business Rules Table represents an example of a given rule. If a rule fails when a scenario is executed, the remaining rows will still be executed.
A Business Rules Table is useful for validations using a series of data sets. Examples include financial calculations, validations against various data, etc.
Unlike the Business Workflow where you have to implement a Workflow for the underlying fixture to get created, in the Business Rules Table the Fixture gets created automatically when the Business Rules Table is created.
Creating Business Rules Tables
The rules table can be created in two different ways:
- by designing a new table
- by reusing an existing table
Options to create Business Rules Table are available as Content-Assist and Context-Menu on the Scenario Editor. The option Insert a New Business Rules Table created a new Rules Table along with its underlying Fixture. The option Reuse an Existing Business Rules Table allows one to create a new Rules Table based on an existing Fixture, as described above.
While reusing an existing Fixture, one can choose one or more existing columns (including Assertion columns). One can also add new columns which implies that the existing Fixture gets modified to include corresponding fields for the new columns.
The following screenshot shows the underlying Fixture that gets created for the Business Rules Table that tests the User Registration scenario mentioned above.
Design New Table
A new table can be created using the option Insert a New Business Rules Table
on the Scenario editor. This creates a new table where the user is required to add the input
columns and the assertion column.
While creating a new table, it is advised that the table name and column names be relevant in a Java context as the column names given are directly mapped to the field names used in the underlying Java fixtures.
Reuse existing table to create a Rules Table
An existing table can be reused to create another Business Rules Table using the option
Reuse an Existing Business Rules Table on the Scenario Editor.
You may add or remove columns in addition to the columns reused from the existing table.
To add or remove columns, the option Add/Remove Columns can be used.
This will add columns to a single table while what is visible on the scenario is a view of
that table with a subset or all columns, which essentially are the columns selected by the
user.

Rename Table or Columns
It is possible to rename an existing Business Rules Table or rename the column names in that table. For this, you may select the rename option on the table's context menu that appears on right-click. This will rename a table/column(s) and update the change in the underlying fixtures.

Modify Columns
Twist allows you to modify a Business Rules Table which essentially means modifying columns in that table. For this, you may select the modify option on the table's context menu that appears on right-click. This will add, remove and/or re-order column(s) and update the change accordingly in the underlying fixtures(only relevant to add columns).
