Load Data into Caching Database from Customization Module
The Load Data into Caching Database from Customization Module allows you to work with data sources that Tosca Data Integrity doesn't support out-of the-box. You can integrate your own custom data source reader into Tosca Data Integrity to load any data set into the SQLite caching database.
For example, if you have data formats that are less common and no ODBC/JDBC driver exists, such as certain EBCDIC files or data that is stored on remote locations and difficult to access, you can write a customization that reads the data and formats it like a table. Once you've integrated your customization into Tosca DI, you can use the Load Data into Caching Database from Customization Module to store the data in the caching database.
Tricentis recommends that you only use this approach if you have the technical knowledge to write a custom implementation. For information on how to set up a custom data source reader, see chapter "Use a custom data source reader".
Prerequisites
To use the Load Data into Caching Database from Customization Module, you must meet the following requirements:
-
You have the Tosca Data Integrity Modules And Samples.tsu subset.
-
You've configured the path of the SQLite caching database in Settings->Tosca Data Integrity.
-
You've set up and integrated your custom data source reader as described in chapter "Use a custom data source reader".
Use the Module
The tables below provide information on all ModuleAttributes of the Load Data into Caching Database from Customization Module.
Table name and table entries
ModuleAttribute |
Description |
Optional |
---|---|---|
Table Name |
Specify the name of the table into which Tosca DI loads the data. |
|
Keep Existing Table Entries |
Set to True to add the data of the file to the existing table. The default value is False. This means that Tosca DI drops the table before loading new data. |
X |
Custom Data Reader
ModuleAttribute |
Description |
Optional |
---|---|---|
Class Attribute Name |
In the Value field, enter the name of your custom data source reader. The name is declared in the ClassAttributeName of your data source interface. Example: CustomCSVReader |
|
Parameters - Key |
Specify the key-value pair to pass information to your custom implementation code:
Example: name FilePath, value D:\TestFile.csv Note: If you work with COBOL files, you must use specific parameters (see chapter "Run tests with COBOL files"). |
|
Column Renaming
Column Renaming works either via file or manually. You can't specify both.
Value |
Description |
Optional |
---|---|---|
Column Renaming |
Remap the column names via file. Specify the full file path to a text or CSV file with the column mappings. The file has to start with the header row Current Column Name;Mapped Column Name followed by one line for each column that you want to rename. Example: Current Column Name;Mapped Column Name Name1;First Name Name2;Last Name |
X |
Current Name |
Remap the column names manually. In the Name column, specify the name of the column you want to rename. In the Value column, specify the new name. |
X |
Cell Settings
Cell settings contains two options:
-
All Columns - Option applies one of the actions below to all columns.
-
Single Columns - <Name> applies one of the actions below to a specified column. To specify a column, replace <Name> with the column name.
Value |
Description |
Optional |
---|---|---|
Trim |
Removes all leading and trailing white space characters. Default scope: HeaderAndData |
X |
Trim[<character>] |
Removes all leading and trailing occurrences of the specified character. Default scope: HeaderAndData Exchange <character> with the character you want to remove. To remove a ", enter the " four times, e.g. Trim[""""]. |
X |
TrimStart |
Removes all leading white space characters. Default scope: HeaderAndData |
X |
TrimStart[<character>] |
Removes all leading occurrences of the specified character. Default scope: HeaderAndData Exchange <character> with the character you want to remove. To remove a ", enter the " four times, e.g. TrimStart[""""]. |
X |
TrimEnd |
Removes all trailing white-space characters. Default scope: HeaderAndData |
X |
TrimEnd[<character>] |
Removes all trailing occurrences of the specified character. Default scope: HeaderAndData Exchange <character> with the character you want to remove. To remove a ", enter the " four times, e.g. TrimEnd[""""]. |
X |
Replace[<string>][<string>] |
Replaces all occurrences of the first string with the second string. Default scope: Data |
X |
Substring[<start index>] |
Extracts a part of a longer string. The extract starts at the defined start index position and runs until the end of the string. Default scope: Data For example: Substring[9] with input Project Manager returns Manager. |
X |
Substring[<start index>][<length>] |
Extracts a part of a longer string. The extract starts at the defined start index position and contains the number of characters specified in length. Default scope: Data For example: Substring[9][3] with input Project Manager returns Man. |
X |
Right[<length>] |
Extracts a part of a longer string. The extract runs from the end of the string towards the beginning and contains the number of characters specified in length. Default scope: Data For example: Right[7] with input Project Manager returns Manager. |
X |
Lowercase |
Converts the string to lowercase using the currently active locale. Default scope: Data For example: Lowercase with input Project Manager returns project manager. |
X |
Lowercase[Culture:<culture name>] |
Converts the string to all lowercase. Lowercase[Culture:<culture name>] uses the given culture name to create a new locale. Default scope: Data For example: Lowercase[Culture:zh-Hans] uses the culture information of "Chinese(simplified)" to convert uppercase to lowercase characters. |
X |
Uppercase |
Converts the string to uppercase using the currently active locale. Default scope: Data For example: Uppercase with input Project Manager returns PROJECT MANAGER. |
X |
Uppercase[Culture:<culture name>] |
Converts the string to all uppercase. Uppercase[Culture:<culture name>] uses the given culture name to create a new locale. Default scope: Data For example: Lowercase[Culture:en-us] uses the culture information of "English - United States" to convert lowercase to uppercase characters. |
X |
Trim double quotes |
Removes leading and trailing double quotes. For example: Trim double quotes with input """Project Manager""" returns Project Manager. |
X |
Load Error Behavior
ModuleAttribute |
Description |
Optional |
---|---|---|
Ignore Load Errors |
Specify whether you want Tosca DI to ignore load errors. The default value is False. This means that errors aren't ignored. |
X |
Max Errors |
Specify the maximum number of errors before execution is aborted. The default value is 100. |
X |
File Name |
Specify the file that errors are logged to. Enter a full path and file name. Tosca DI overwrites any existing file with the same name. By default, Tosca DI doesn't log load errors. |
X |
Example: Load data from a CSV file
In this example, you use the Load Data into Caching Database from Customization Module to load data from a CSV file into the caching database. To do so, you use a custom CSV file reader (see our code sample). You perform the following steps:
-
To integrate the custom data source reader, you copy and paste the DLL file into the Custom Data Readers folder located at C:\Program Files (x86)\TRICENTIS\Tosca Testsuite\Data Integrity.
-
In Tricentis Tosca, you open the Load Data into Caching Database from Customization TestStep.
-
As Table Name, you specify the name of the table into which Tosca DI loads the data.
-
In the Value field of Class Attribute Name, you enter the name of your custom data source reader.
-
You select Parameters->Key and change the name Key to Filepath.
-
In the Value field, you enter the file path of the CSV file that you want to use as the data source.
Load data from a CSV file into caching database
You can now run your TestCase.