Data engineering


These commands, from the data engineering family group, cover the need to setup (or cleanup) the content of some tables of a relational database before (or after) executing a tests. To use them you’re required to proceed to the installation of an extension specific to the RDBMS targetted by the tests.

Except the attribute connection-string all the attributes accept literal values, and variables including formatting and inline transformations.

Bulk loading or truncating a table

  • table-reset: this command delete all the rows of a table (truncation).
  • table-load: this command fill a table on base of a csv file (bulk load). The xml attribute named file expects the name of the csv file to load. The content of the csv file will be appended to the existing rows in the table.

For all of them, The xml attribute named name expects the name of the impacted (truncated or loaded) table.

<setup>
	<table-reset  name="NewUsers"
		connection-string="..."
	/>
	<table-load   name="NewUsers"
		file ="NewUsers.csv"
		connection-string="..."
	/>
</setup>

If you want, you can also reference a connection-string in the xml attribute named connection-string. If you want to avoid to repeat this connection-string within all your commands, you can create a default value for the connection-string in the settings at the top of your test-suite where the value for the xml attribute apply-to must be set setup-cleanup.

<settings>
	<default apply-to="setup-cleanup">
		<connection-string>Data Source=(local)\SQL2012;Initial Catalog=AdventureWorksDW2012;Integrated Security=true</connection-string>
	</default>
</settings>

Important note: This command is executed on the server running the test-suite (not on a remote server).

Executing a SQL script

  • sql-run: this command run a batch of sql commands on your Sql Server instance.

The xml attribute named name expects the name of the file containing the Sql commands. The attribute path is the path for the folder containing this file. This path must be relative to the test-suite. The attribute connection-string lets you define the connection-string for the targeted database. This connection-string but me a SqlClient connection-string and cannot be an OleDb or ODBC connection-string (avoid provider or driver parameters).

<setup>
  <sql-run
    name="MyCommands.Sql"
    path="SQL\"
    connection-string="..."
  />
</setup>

Running ETL

  • etl-run: this command let you start a new run for your Etl

The syntax to define an etl is defined at the page define an Etl.

Sample:

<test name="...">
  <setup>
    <etl-run name="Sample.dtsx" path="Etl\">
      <parameter name="DataToLoadPath">C:\data.csv</parameter>
    </etl-run>
  </setup></test>

Referencing a connection-string

If you want, you can also reference a connection-string in the xml attributes named connection-string. Useful, to avoid to repeat this connection-string within all your commands, you can create a default value for the connection-string in the settings at the top of your test-suite where the value for the xml attribute apply-to must be set setup-cleanup.

<settings>
  <default apply-to="setup-cleanup">
    <connection-string>Data Source=(local)\SQL2012;Initial Catalog=AdventureWorksDW2012;Integrated Security=true</connection-string>
  </default>
</settings>