Test Data Service Modules - Compare dates and numbers

Tricentis Test Data Service performs text-based comparison, except for the query expressions, for which you must upload the test data via API when using numerical and boolean comparisons.

You can use the DataType Date to save, compare, and use dates in different formats (see chapter "DataType").

For date comparisons, in Test Data Service you must provide the Value according to the ISO 8601 date format (yyyy-MM-dd). Test Data Service uses string comparison.

This chapter describes how to compare dates and numbers based on examples.

Before you start

If you want to store, search for, and use dates in your Test Data repositories, you have to create a new item and retrieve the data. To do so, follow the steps below: 

  1. Import the Standard subset (see chapter "Import and export subsets").

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

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

    •  TestDataEndpoint: specify the Test Data Service URL location from which you want to retrieve your items.

    •  TestDataRepository: specify the repository.

You can also define test configuration parameters for TestCases or TestCases folders.

In this case, Tosca Commander tries to retrieve the TDS endpoint from the Tosca Gateway Service.

  1. Create a TestCase named Example. Drag and drop the TestDataService configuration onto your TestCase (see chapter "Assign configurations").

Test Data Service uses the global temporal expressions unless you override them with test configuration parameters. For more information, see chapter "Settings - Dynamic Temporal Expressions".

Compare dates

To compare dates, follow the steps below: 

  1. Drag and drop the Module TestData - Create & provide new item onto the Example TestCase (see chapter "Create TestSteps from Modules"). Tricentis Tosca automatically creates a new TestStep with the XTestStepValues Existing or new TDS type, Alias name (item), and Data structure.

  2. For the Existing or new TDS type XTestStepValue, enter the value Example.

  3. Add a new XTestStepValue with the name Birthday and enter the date 23/01/1981 14:22:43 in the Value column. Optionally, you can add additional XTestStepValue entries as described below.

  4. Since you have defined a date in the Value column, set the DataType to Date.

  5. Run the TestCase in ScratchBook to create a new item in the Test Data Service.

Store UTC date and time in the Test Data Service

  1. Drag the Module TestData - Find & provide item onto the Example TestCase to create a new TestStep. Add the Birthday XTestStepValue under Data search filter, add the value, set the ActionMode to Constraint, and set the DataType to Date.

Find an item with a suitable value in the Test Data Service

  1. Create a new TestStep as described above in another Module TestData - Create & provide new item.

  2. Enter the date {DATE["26/03/1980 07:06:12"][][]} in the Value column. Use the same date format that you defined as Tosca date formats.

  3. Run the TestCase in ScratchBook to find an item matching the search criteria.

Store date and time in the Test Data Service

  1. Check the created items in Test Data Management.

Created items in Test Data Management

Compare numbers

To compare numbers, follow the steps below: 

  1. Drag the Module TestData - Find & provide item onto the Example TestCase to create a new TestStep. Add the Age XTestStepValue under Data search filter, add the value, set the ActionMode to Constraint, and set the DataType to Numeric.

Find a new item Age in the Test Data Service

  1. Add the Weight XTestStepValue under Data search filter, set the ActionMode to Constraint, and set the DataType to Numeric.

Find a new item Weight in the Test Data Service

  1. To retrieve data from a specific item, drag the Module TBox Set Buffer onto the Example TestCase.

Store the retrieved value in a buffer

  1. In the TestStep TestData - Create & provide new item under the Example TestCase, check the values of Data structure.

Create a new item in the Test Data Service

  1. Check the data entries in Test Data Management.

Created items in Test Data Management