Data & data management | Ranorex
HomeUser GuideRanorex Studio AdvancedData-driven testingData & data management

Data & data management

Test data are the basis for data-driven testing. The creation of test data belongs to test planning. The design, the structure and the contents of test data completely depend on the test project itself. Therefore, this user guide does not include a guide of how to define and design test data for your test challenge.

But it introduces and explains options for managing, creating and binding data to your data-driven test solution.

In this chapter

    Data source management

    Test data are centrally managed based on test suites. Each test suite of a test solution owns its own set of test data. All test data managed within one test suite are available for any test case of this test suite. The management of test data is explained herein.

    Accessing the data source management

    Accessing test data management

    Accessing test data management

    Data management can be accessed from various spots:
    Click MANAGE DATA SOURCES… in the Studio toolbar
    Click Data source… in the test suite toolbar
    Click Data source… in the context menu of a test container (test case, smart folder)
    See the data source management window

    Data source options

    Adding a new data source to the set of managed test data sources, deleting a data source and cloning a test data source are the basic operations within the data sources management dialog .

    Basic data source operations

    Basic data source operations

    Drop-down selection for adding a new data source. Four different data types are available, all of which will be explained hereinafter Deleting a data source. Any data source can be selected and deleted from the list of managed test data sources by clicking Delete

    Note icon

    Note

    Deleting an Excel, CSV, or SQL data source means deleting the internal link to this data source, not the data source itself. The physically stored test data file is left unchanged and remains as is at its storage location

    tipp icon

    Attention

    Deleting a Simple data table means deleting the data physically. Data will be lost! The reason for this is, that the data of this type are directly stored in the corresponding test suite (XML) file.

    Cloning a data source means cloning the reference to the data. By means of this option it is possible to offer different subsets of data to different test cases or smart folders
    Note icon

    Note

    Cloning a Simple data table means copying its contents in the XML file representation of the corresponding test suite.

    List of available (managed) data sources
    Data source configuration section. Depending on the data type various configuration settings are to be made to add a data source. This section is explained in detail along with the different data type explanations

    Data source assignment

    Whereas data sources are managed centrally from within the test suite, the assignment of test data is done on a test case and smart folder basis. With respect to Simple data tables, the creation is also done from within the test case and smart folder.

    Accessing test data assignment from test case and smart folder

    Accessing test data assignment from test case and smart folder

    Select the test case or smart folder which is to be assigned to a data source
    Open the context menu and click Data source…
    Assigning a data source to a test case or smart folder

    Assigning a data source to a test case or smart folder

    Open the drop-down selection of available data sources and select with mouse-click
    See the assigned data source near the test case or smart folder in the test suite view

    Data source assignment rules

    The assignment of data sources to test cases and smart folders within a test suite structure follows some simple and important rules which need to be kept in mind.

    Assignment rules:

    Rule no.1 Each data source can be assigned exactly once in a vertical test suite structure tree
    Rule no.2 Data source availability only works downwards a test suite structure, not upwards
    Rule no.3 Data source assignments complement each other and do not replace each other

    Explanation assumption

    Let’s assume, that we have two data sources available in a test suite – a CSV data source myCSVData and an Excel data source myExcelData.

    Data source assignment example I

    Data source assignment example I

    Important to know:

    The CSV data source is assigned to the smart folder A-1
    The Excel data source is assigned to the smart folder A-2
    According to rules #1-#3 no data source is available for test modules in test case A
    All test modules of the smart folder A-1 have access to CSV-data
    Referring to rules #2 & #3 all test modules of the smart folder A-2 have access to CSV and Excel data
    Referring to rules #2 & #3 all test modules of any test case or smart folder down of smart folder A-2 have access to CSV and Excel data

    Data source assignment example II

    Data source assignment example II

    Important to know:

    All data sources have been assigned below test case B and smart folder 1. Therfore, no data source is available for the corresponding test modules The Excel data source is assigned to the smart folder 1-1. Therefore, the test modules down of this tree branch have access to Excel data The smart folder 1-2 is assigned to CSV data. Its corresponding test modules have therefore access to these Smartfolder 1-2-1 is assigned to Excel data. According to rule #3 its descending test modules have access to both CSV and Excel data Smartfolder 1-3-1 is again assigned to Excel data. Therefore all descending test modules have access to Excel data

    Simple data table

    For small and easy test challenges it might be useful to create test data based on simple table data.

    Creating a simple data table - part I

    Creating a simple data table – part I

    Click the New… button in the data source manager and click Simple data table
    Assign a meaningful name to the data connector
    Confirm with OK

    Important to know:

    The option of masking data items is introduced and explained at the end of this section

    Creating a simple data table - part II

    Creating a simple data table – part II

    Use the table editor to create the test data of your choice
    Creating a simple data table - part III

    Creating a simple data table – part III

    When finished click OK to end the data table creation process

    Important to know:

    The option of selecting data ranges of the data table is introduced and explained at the end of this section

    Excel data connector

    Using test data stored in Excel file format is a possible option. This section shows how to add and assign these test data to a data-driven test case or smart folder.

    tipp icon

    Hint

    Instead of using the default Excel file format xlsx, the native binary file format xlsb is also available. This file format is supported by Microsoft Office 2007 and is much faster than the non-binary version.
    Creating an Excel data connector

    Creating an Excel data connector

    Click the New… button in the data source manager and click Excel connector…
    Once finished configuration, confirm with OK

    Excel connector configuration:

    Assign the connector a meaningful name and choose the file location with a standard Windows dialog
    If you apply version control, checking this option is mandatory. Otherwise, you may do not have access to the test data. Even if not, copying the test file to your test environment is strongly recommended.
    Worksheet selection

    • If test data are distributed among two or more sheets within the Excel file, the location of the affected test data can be specified herein
    • Additionally, the range of a subset can be specified herein
    • Not loading the worksheet at start-up means that the number of rows is not determined and therefore cannot displayed in the test suite

    The option of masking data items is introduced and explained at the end of this section

    tipp icon

    Hint

    Consider using CSV-based data instead of Excel-based data. When applying CSV-based data, Excel can still be used as data editor but is not necessary for being installed in your runtime environment.

    CSV data connector

    Using test data stored in CSV file format is a possible option. This section shows how to add and assign these test data to a data-driven test case or smart folder.

    Creating a CSV data connector

    Creating a CSV data connector

    Click the New… button in the data source manager and click CSV connector…
    Once finished configuration, confirm with OK

    CSV connector configuration:

    Assign the connector a meaningful name and choose the file location with a standard Windows dialog
    If you apply version control, checking this option is mandatory. Otherwise, you may do not have access to the test data. Even if not, copying the test file to your test environment is strongly recommended.
    Data configuration

    • Specify whether the CSV file contains a header file, or not
    • Not loading the CSV file at start-up means that the number of rows is not determined and therefore cannot be displayed in the test suite

    The option of masking data items is introduced and explained at the end of this section

    SQL data connector

    The SQL data connector allows you to access an SQL database and get access to data through using SQL query. Herein a basic and simple example accessing a Microsoft Access database is shown to explain the underlying principle for accessing SQL databases.

    Creating an SQL data connector - part I

    Creating an SQL data connector – part I

    Click the New… button in the data source manager and click SQL connector…
    Assign the connector a meaningful name
    Click Create to proceed with specifying the SQL connection string
    Creating an SQL data connector - part II

    Creating an SQL data connector – part II

    Specify the database location in a standard Windows file dialog
    Once finished the optional connection properties click OK to proceed

    Optional connection settings:

    Change the database connection type in an optional dialog if necessary
    Specify login data with username and password if necessary
    It is recommended to test the connection prior to the test integration

    Creating an SQL data connector - part III

    Creating an SQL data connector – part III

    Proceed with Create to specify the database query
    SQL database query designer

    SQL database query designer

    Complete the necessary SQL query in to provide the necessary data to Ranorex Studio and confirm with OK

    Creating an SQL data connector - part IV

    Creating an SQL data connector – part IV

    If finished, click OK to end SQL data connector establishment

    Data masking option

    During the data connector properties specification, this option enables to hide particular data in the report. If you need sensitive, or secret test data to be ‘masked’ in the report, this option allows you to specify which data are to be hidden.

    Masking data in report

    Masking data in report

    Unmasked data are displayed regular in the test report
    Masked data are hidden. Their content is replaced by dots

    Selecting data range

    It is possible to specify and select a data range, i.e. a subset of the data source available for the current test case based on complete rows.

     

    Selecting a data range

    Selecting a data range

    Select a range in the data properties selection dialog
    Click Preview effective data set… to see the result of the selection