Steer databases
To steer databases, you have to create Database Engine 3.0 TestCases. The Standard subset contains all Modules that you need to create a database TestCase.
You can find these Modules under Standard modules->TBox XEngines->Database.
-
If you use Tosca BI, Tricentis recommends that you use the BI DB Expert Module from the Tosca BI Modules And Samples.tsu subset instead. This Module has the same base functionality, but allows you to use the connections you have defined in the Tosca BI Connection Manager.
Structure of database TestCases
Database TestCases require the following base structure:
-
Open a connection to a database.
-
Run an operation on your database. You perform these operations through SQL statements.
-
Close the connection.
The Database Engine 3.0 does not support mixed TestCases. If you use the Database Engine 3.0 Module to open a connection, you must perform your database operations and then close the connection with Database Engine 3.0 Modules. |
Use Modules to create your TestCase
You can perform the steps of your database TestCase in one of the following ways:
-
Use separate Modules: TBox DB Open Connection, TBox DB Run SQL Statement, and TBox DB Close Connection.
-
Use the TBox DB Expert module, which contains all steps in one Module.
For information on how to create TestSteps from Modules, see chapter "Creating TestSteps from Modules".
In this example, you use the TBox DB Expert module to perform the following actions:
Use the TBox DB Expert module in a TestCase |
Export the result of an SQL Statement into a CSV file
You can export the result of your SQL Statement into a comma separated CSV file. You can do so for TestSteps created from the following Modules:
To export the result, follow the steps below:
-
Enter the following command into the Value column of Result Table: {EXPORTTOCSV[<file path>]}
-
Replace <file path> with the absolute path to the file.
If the file doesn't exist, the Database Engine 3.0 creates it. If a file with the same name already exists, the Engine overwrites the existing file.
-
Use the default ActionMode Select. The export also works with Input but none of the other ActionModes.
-
To export the result table, run your TestCase.
In this example, Tosca exports the result table of your SQL Statement into the file Customers.csv located at C:\Temp.
Export to C:\Temp\Customers.csv |