TestData - Find & provide record

Tricentis Tosca Test Data Service enables you to identify and retrieve the right test data.

To do so, use the Module TestData - Find & provide record to find a specific record in your database.

In case security is enabled, the functionality described on this page may be restricted depending on the user groups you belong to. To set your access rights, contact your Administrator.

This Module is part of the Standard subset. You can find it under Standard modules->Test Data Management->Test Data Service.

Example

The following example shows how to find a record in your database and how to insert the data into your application. To do so, follow the steps below: 

  1. Import the Standard.tsu subset to your workspace (see chapter "Import and export subsets").

  2. Navigate to the Configurations folder and expand the imported Configurations folder therein.

  3. Select the TestDataService configuration and define the following test configuration parameters:

    • TestDataEndpoint to specify the location from which you want to retrieve your records

    • TestDataRepository to define the repository to be queried

    • Browser to specify with browser you want to use to open your test application

Define test configuration parameters for TestDataEndpoint and TestDataRepository.

Optionally, you can omit the test configuration parameter (TCP) called TestDataEndpoint. In this case, Tosca Commander automatically retrieves a TDS endpoint from the Service Discovery.

To configure it, go to the Tosca Commander settings and navigate to Tricentis Services->ServerEndpointAddress.

  1. Create a TestCase with the name Sample TestCase. Assign the TestDataService configuration to the TestCase by using drag and drop (see chapter "Assign configurations").

  1. To create a TestStep for opening your test application, drag and drop the Module OpenUrl onto the Sample TestCase. This Module is part of the Standard.tsusubset and located at Standard modules->TBox Engines->Html.

  2. Tricentis Tosca automatically creates a new TestStep with the XTestStepValue Url. Enter the URL of the Tricentis Tosca Sample Application into the Value column and set the ActionMode to Input.

    With this example you can open the Tricentis Tosca Sample Application http://sampleapp.tricentis.com.

Open Tricentis Tosca Insurance Calculator

  1. Create a TestStep which selects the control Automobile in the menu of the sample application (see chapter "Navigate the Tosca XScan UI").

Select the control Automobile

  1. Create a new TestCase and drag and drop the Module TestData - Find & provide record onto this TestCase (see chapter "Creating TestSteps from Modules"). Tricentis Tosca automatically creates a new TestStep with the with the XTestStepValues Existing TDS type*, Alias name (record) and Data search filter.

  2. To find a specific object, you can search within a specific range of objects. Enter the following values into your XTestStepValues:

    • Enter car for Existing TDS type*.

    • Leave Alias name (record) blank. In this case, Tricentis Tosca automatically uses the Value of Existing TDS type*.

    • Populate the values of Data search filter as shown in the screenshot below. In this example, Tricentis Tosca searches for the record of a car with the dateofmanufacture between the years of 2010 and 2015 and with the make defined as VW.

      If you enter numeric values in the Value column, you have to set the DataType to Numeric.

      It is possible to use wildcards and regular expressions.

Find a record of the type car.

Example: once execution is finished, the following results appear:

Successful result in ScratchBook

Unsuccessful result in ScratchBook

  1. Create a new TestStep named Vehicle Data to use the data from the record that was retrieved from the Test Data Service repository. Since you left Alias name (record) blank, Tricentis Tosca automatically uses the Value of Existing TDS type*.

    If you only want to use a record of a certain type, you can use dynamic expressions to retrieve record data.

Use values from the Test Data Service database

You have exclusive access to the record and after you retrieved it, it is locked. No other TestStep will get the same record if you need it.

This ensures that the test runs in a distributed environment. The record is automatically unlocked once you have executed your tests or as soon as you start a new iteration in your loop. If the TestCase fails, the record is also unlocked.