3.14.9. Using central data sets

You can create and manage central test data sets for a Project which can be reused in Test Cases.

3.14.9.1. Creating and editing central test data sets

To create a central test data set:

  1. Open the Central Test Data Editor by clicking the ”Central Test Data Editor” button on the toolbar or selecting:

    Open with-->Central Test Data Editor

    from the Test Suite Browser.

  2. In the Central Test Data Editor, select:

    Add new Data Set

    from the context-sensitive menu or press »Insert«.

  3. In the dialog that appears, enter a name for the new data set and click ”OK”.

  4. The new data set appears in the Central Test Data Editor. You can now add parameters to the data set (Section 3.14.9.3, “Adding and modifying parameters for central test data sets”).

  5. You can rename the data set by pressing»F2« or selecting:

    Rename

    from the context sensitive menu.

  6. You can categorize your central data sets using the Add category function from the context-sensitive menu (Section 3.11, “Working with categories in the browsers and editors”).

3.14.9.2. Deleting central test data sets

You can delete a central test data set if the data set has not yet been reused (referenced) in a Test Case (Section 3.14.9.5, “Reusing central test data sets in Test Cases”).

  1. Select:

    Delete

    from the context-sensitive menu or press »DELETE«.

  2. A dialog will appear if the data set has been reused and cannot be deleted.

  3. You can use the search (Section 3.30.2, “Searching for places where a Test Case or Test Suite has been used”) to show where the data set has been used.

3.14.9.3. Adding and modifying parameters for central test data sets

Once you have created a central test data set (Section 3.14.9.1, “Creating and editing central test data sets”), you can add parameters to the data set using the Edit Parameters dialog.

  1. Open the edit parameters dialog for the central data set by double-clicking on the data set in the Central Test Data Editor. You can also select Edit parameters from the context-sensitive menu.

  2. In the Edit Parameters dialog, you can see any parameters you have already added for this data set, and what type of parameters they are.

  3. Use the ”Add” button to create a new parameter for the data set.

  4. Enter a name for the parameter and select the type of parameter it should be (e.g. String, Integer, ...). The type of parameter it should be will depend on which actions are using it. A list of actions and their parameters (and types) is available in the reference manual.

    Names for referenced parameters may only consist of letters, numbers and underscores. You cannot use spaces.

  5. You can also change the order the parameters appear in, edit their types and names, and delete them completely using this dialog.

3.14.9.4. Entering data for central test data sets

Once you have created a central test data set (Section 3.14.9.1, “Creating and editing central test data sets”) and have added parameters to the central test data set (Section 3.14.9.3, “Adding and modifying parameters for central test data sets”) then you can enter data for these parameters in the Data Sets View.

To enter data sets for a central test data set:

  1. Open the Central Test Data Editor by clicking the ”Central Test Data Editor” on the toolbar or selecting:

    Open with-->Central Test Data Editor

    from the Test Suite Browser.

  2. In the editor, single-click the central test data set you want to add data to.

  3. Select ”Add” to add a row.

  4. Enter the values for the parameters in the row.

    You cannot add referenced parameters (i.e. reference names preceded by the equals sign) in the Data Sets View for a central test data set.

  5. Use the buttons in the Data Sets View to add more rows, delete rows and insert rows above the currently selected row.

3.14.9.5. Reusing central test data sets in Test Cases

You can reuse a central test data set in a Test Case to provide the concrete data for the parameters required by the Test Case.

  1. In the Properties View for the Test Case, enter the name of the central test data set you want to use in the Central Test Data Set field.

    Press »CTRL+SPACE« to see a list of possible data sets for this Test Case. You will only be shown data sets that contain the correct parameters with the correct types.

  2. When you have entered a central test data set, then the Properties View shows central test data set as the data type. You will see the data from the central test data set in read-only form in the Data Sets View.

    If data is missing from the central test data set, you will receive the error that test data is incomplete for any Test Suites this Test Case is used in.

  3. You can delete the central test data set used by removing it from the central test data set field. The data type reverts to local data. For more information on the data sources, see the earlier section (Section 3.14.8, “Viewing and changing data sources for Test Cases”).

    You can use central test data sets that contain more parameters than your Test Case. For example, if your Test Case requires the parameters NAME, ADDRESS and your central test data set contains NAME, ADDRESS, POSTCODE, you can still use the central test data set.

3.14.9.6. Importing Excel files as central test data

If you have existing Excel files that you want to convert into central test data, then you can import them via the Central Test Data Editor:

  1. In the Central Test Data Editor, right-click and select Import from the context-sensitive menu.

  2. In the dialog that appears, browse to the directory containing your Excel file(s).

  3. Either select the whole directory (if it contains all Excel files) on the left, or select the individual Excel files on the right.

  4. Click ”Finish” to start the import.

3.14.9.7. Changing the column used in a central test data set for multiple Test Cases

If you have used a central test data set in multiple Test Cases and later realize that you have two columns in the central test data set that contain the same information, then you can change all Test Cases that use this central test data set to just use one column. Once you have done this, you can remove the unnecessary column from the central test data set.

In order to perform this action, all Test Cases to be changed must not be in use by anyone else using the Project -- you should ensure that this is the case before performing the action, otherwise the action cannot be carried out.

  1. Search for all places where the central test data set whose column usage you want to change is used. Use Show where used on the central test data set to see all places (Section 3.30.2, “Searching for places where a Test Case or Test Suite has been used”).

  2. In the Search Result View, you will see all places where the selected central test data set is reused in this Project, including any original specifications of Test Cases that use it, and any reused Test Cases that use it (as Test Cases or as Event Handlers. We recommend selecting all entries to perform the action, otherwise you may have incomplete test data after only changing a subset.

  3. You will only be able to perform the changes if:

    • All the selected Test Cases use the same central test data set.

    • All the selected Test Cases have their original specification in this Project, i.e. you do not have a Test Case from a reused Project that uses the central test data set in this Project.

    • The Project is not protected.

    • The Test Cases you have selected are present (i.e. they are not missing from e.g. reused Projects.

    • None of the selected Test Cases uses two different central test data sets (e.g. one central test data set on the originally specified Test Case, and another one at a place where it is reused).

    • The selected Test Cases have at least one referenced parameter and at least one of the referenced parameters has the same type as another parameter in the central test data set.

  4. If the Project is protected, or Test Cases are missing, the context-menu entry will be disabled. If any of the other prerequisites are not fulfilled, you will see an information dialog that lets you automatically deselect any invalid Test Cases.

  5. From the context menu, select:

    Change central test data set column usage

  6. In the dialog that appears, you can select a parameter to change on the left-hand side, and the column to change it to on the right-hand side. You can only change the usage of columns whose types are the same. If you have e.g. TEXT1 (string) and TEXT2 (string) in your central test data set and Test Cases, but you only require TEXT1, then select TEXT2 on the left-hand side and TEXT1 on the right hand side.

  7. Click ”Finish” to perform the action.

  8. All selected Test Cases will be altered to use the newly chosen column in place of the previously used column.

  9. If the newly chosen column was already used in one or more of the selected Test Cases, then all places within the Test Case that referenced the old column are changed to reference the newly chosen column. Using the example from above, all places where TEXT2 was referenced in the selected Test Case will be changed to TEXT1. The changed name remains at the interface of the Test Case; TEXT2 is not deleted from the Test Case, but it is no longer used. If the newly chosen column was not yet used in one or more of the selected Test Cases, the old parameter name of the Test Case is renamed to the newly chosen column.



Copyright BREDEX GmbH 2015. Made available under the Eclipse Public License v1.0.