TestOptimal Wiki

Model-Based Testing (MBT)

User Tools

Site Tools


DataSet Editor

»Model Editor Transition Context Menu: Trans DataSet

DataSet Editor allows you to create and edit the dataset for a transition. You can dynamically add or remove fields. It supports several combinatorial test generation algorithms including Pairwise algorithm. For more advanced data generation, please check out Data Designer.


A transition dataset is automatically used by TestOptimal in test generation. The rows in the dataset are retrieved and used as the transition is traversed. You can access the data fields on the current row with $getTransData('fieldName') in any of the transition triggers.

Create DataSet

DataSet is automatically created when you open DataSet Editor through transition context menu Edit DataSet.

DataSet Attributes

  • Dataset Name - change the default value to an appropriate name.
  • Algorithm - select from the drop down list of algorithms (for more information about these algorithms see Combinatorial Algorithms for more details):
    • pairwise
    • 3-wise
    • 4-wise
    • full combinatorial
  • Persistence - save the actual dataset table to be used during model execution. If left unchecked, TestOptimal will re-generate the datatable using the selected algorithm. If your dataset contains verify fields, you must ensure this checkbox is checked as you will want the data rows with verify fields to be saved.
  • Auto Refresh - if the data set should be refreshed from its source. Only applicable if the data set was imported from external file or excel. Be aware that the data set will be wipe out and replaced by the content from the external source. If you have modified the data set after the import, you should have this checkbox unchecked to avoid the lost of your updates.
  • Random Retrieval - how the datatable will be retrieved. If the checkbox is checked, the rows in datatable will be retrieved and used randomly. If the checkbox is not checked, the datatable will be retrieved and used sequentially and when the end of the datatable is reached, it will repeat from the beginning of the datatable.

DataSet Fields

Fields are added by clicking on . Enter a field name and the domain values to be tested with. Leave Group field blank for now, it will be explained later.

By default, fields are created to participate in the algorithm in generating test cases. You can create a field to store the verification result which you will use to record the expected value after executing the test case using the data on that row. To create a verification field, select V for Group attribute from the dropdown list.

Use the default (leave it blank) when creating non-verification field, which indicates that these fields are independent of each other.

In some cases a group of field may be related to each other and they must choose the related value from the list. For example if you have Credit Card Type and Credit Card Number fields added to the dataset and defined a list of credit card types like visa/amex/master/etc and the matching credit card number for each credit type, Credit Card Number must correspond to the matching Credit Card Type. In this case, select the same group id form Group attribute dropdown list for these fields.

By sharing the same group id, fields will take the values from their lists at the same position.

You can delete field by clicking on preceeding the field name.

Generate DataTable

Once you have the fields defined, you can generate the dataset for the fields by clicking on the regenerate link.

You can remove unwanted rows by clicking on . Each field in the datatable can be edited as you wish.

If you have verification field(s), they will be left blank. You can enter the appropriate values for each row. The results will be saved if Persistence checkbox is checked.

During the model execution, the dataset will be loaded and traversed. Besides the option to traverse the datatable sequentially or randomly as described above, you can also control the sequence of which row to be used first programmatically in mScript by setting the user variable dataset name_idx.

Sorting DataTable

DataTable can be sorted by clicking on the column label. You can sort by multiple columns by holding the SHIFT key while clicking on the column label.

DataSet Import

You may also import dataset from external file (xsl, csv, jdbc database and url) and dataset you have created with DataDesigner.

  • file - to import data from external file (xsl, csv, url)
  • dataset - to import data from DataDesigner
  • sql - to import data from an external jdbc database
  • url - to import data from an URL that returns tab delimited file

To import data from external files, click on import link. Following dialog will appear:

The file extension is used to determine the file type:

  • .csv, .tab, .txt - for text files. File must reside in dataset folder in the model folder
  • .xls - MS Excel (Excel 2003 file). Append ;sheetName to read from specific sheet in the document
  • url - tab delimited files residing on a remote host
  • .ds - for dataset created by DataDesigner

Sql Data Source

Importing from a jdbc database requires that you have defined a system datasource first. Then you just enter the following URI:

sql:datasource=TestDB;sql=select * from employee

where TestDB is the name of the system datasource to be used to run the sql statement.

URL / Http Data Source

Importing from http data source can be set using the following URI:


where the http URL above is the url accessible from TestOptimal server and returns a tab delimited file.

The import operation is a one time operation. Changes to the original data source will not be automatically updated to the dataset. You may force dataset to automatically refresh the data from the original data source before each model execution by checking the checkbox Auto Refresh. Be aware that should you have made any changes to the dataset after last import, those changes will be lost when refresh is completed.

To prevent such loss of changes, it is recommended to import data from dataset created with DataDesigner.

dataset_editor.txt · Last modified: 2017/12/21 04:45 by admin