LegiTest Actions, Assets and Asserts

LegiTest ›› Tutorials ››
Parent Previous Next

LegiTest Actions, Assets and Asserts

In a previous tutorial we covered the design surface of LegiTest. In this tutorial we’ll cover some of the terminology and look at the major components of LegiTest: Assets, Actions, and Asserts.

The LegiTest toolbox consists of three sets of tools, as mentioned Assets, Actions, and Assertions. Assets are the pieces that Actions will need to do their job. Examples might include connection strings, queries, etc.

Actions use the Assets to create some kind of outcome. For example they may execute a query to return a row count, process a cube, or execute a package. When an action returns information, such as a row count or data set (aka a grid), it is stored in a resource key.

Asserts are used to test the results of actions. For example, we might use an integer assert to compare the result of a query action which returns a row count with some predetermined value. Asserts will compare the values in resource keys to each other, or to a static value entered into the Assert.

Below is a list of LegiTest tools in each of the three categories, with a brief description of each.


  Comparison Manifest – Used to tell LegiTest how to compare the output of two Execute Query (Grid) actions.

  Connection – Holds a connection string to a SQL Server, SSAS, Oracle, or other OLEDB/ODBC database.

  Grid Collection – Holds a grid that can be loaded once and used for multiple comparisons.

  Package Reference – Contains a reference to a package. That package can be located in a file, on a SQL Server, or for SSIS 2012/2014 the catalog. Currently LegiTest supports three package reference asset types.

o   Package Reference (SSIS 2008)

o   Package Reference (SSIS 2012)

o   Package Reference (SSIS 2014)

  Query – A query to a target database. The query will be in the native language for the database the query is being run against. Thus it may be a SQL Server T-SQL query, but may also be MDX, DAX, DMX, PL/SQL, or another other query language specific to the database where the query is to be run.

  Text File – This will hold the contents of a text file which may be used for comparisons in the assets.

  T-SQL Backup/Restore – This Asset will hold the command to backup or restore a SQL Server database. It would then be called from an Execute Query (Command) action.

  T-SQL Bulk Insert – This asset stores the information needed to do a bulk insert.  Like the previous asset, it would be called from an Execute Query (Command) action.


  Directory Actions – These actions allow the test to manipulate directories as part of a test.

o   Directory Copy

o   Directory Create

o   Directory Delete

o   Directory Move

  File Actions – These will allow a test to manipulate files as part of a test.

o   File Copy

o   File Create

o   File Delete

o   File Line / Match Count

o   File Move

  Package Actions – The following actions work with packages.

o   Load Package – Loads a package into memory from a Package Reference Asset.

o   Execute Package – Executes a package which has been loaded using the Load Package action.

o   Execute Task – Executes a single task within a package which has been loaded using the Load Package action.

o   Get Properties – Retrieves properties from a package. This may be done prior to or after a package executes.

o   Set Properties – May be used to alter the properties of a package after it was loaded but before it is executed.

  Execute Process – This will allow a test to execute any command line program. For example, a PowerShell script could be executed, a DACPAC could be deployed as part of a test, or more.

  Query Actions – The actions below allow the test to execute queries, stored in Assets, against a target database.

o   Execute Query (Command) – Executes a query which does not return data of any type. An example may be a TRUNCATE TABLE command, or deletion of a database or data.

o   Execute Query (Grid) – Runs a query which returns a set of data. Think of the grid as analogues to the grid populated in SSMS when a query is executed.

o   Execute Query (Scalar) – Returns a single value from a query. This might be a single value returned by a stored procedure, function, or query.

  Load Asset – Loads a Text File Asset from a file on disk so that it may be used in an Assert.

  Load Grid from Asset – Loads a grid from the Grid Collection asset so that it can be used in an Assert.

  Cube Actions – LegiTest has the ability to process SSAS cubes, dimensions, or an entire SSAS database.

o   Process Cube

o   Process Database

o   Process Dimension

  Report Actions – LegiTest has the ability to not only execute a report but test its output.

o   Execute Report – LegiTest will run a report, then store the XML output by the report in a Resource Key.

o   XPath Extract – Can be used to extract elements of a report into a Resource Key which may then be used in an Assertion.


  LegiTest supports four types of Assertions. These compare the values in Resource Keys loaded by the Actions

o   File Content Comparison

o   Grid Comparison

o   Integer Comparison

o   Scalar Comparison