This project is read-only.

Database Extensions

Need to interact with a database? These extensions allow you to perform database operations and provide a range of asserts that you might need as part of your tests.
  • Run any Sql command you need, assert against the number of rows affected
  • Run any Sql query, assert against the number of rows returned (statement must be SELECT COUNT(*)...)
  • Run any Sql script using sqlcmd.exe
  • Check a server has a specific login (Sql2008)
  • Check a database has a specific user (Sql2008)
  • Check a user is a member of a set of roles (Sql2008)


Each extension requires a "connection name" - the name of the connection string in the app.config to use to connect to the database server. This can get tedious so you can now add an appSetting to your test app.config called "DefaultSqlConnection", the value of this should be name of the connection string to use. If you only have one connection string then you don't even need to have the appSetting either, TripleA will just use the connection string. Each extension has been modified to provide an overload that does not require you to pass the "connection name" - it will attempt to discover it via the appSetting/use the only connection.

Run a Sql script

The RunSqlScript extension allows you to run a script using sqlcmd.exe. You can pass the location of sqlcmd.exe to the extension or you can create an appSetting called "SqlCmdPath" that should point to your sqlcmd.exe and use the extension overload that does not require the sqlcmd path. The returncode from sqlcmd.exe is used to indicate success or failure. If there is a script error then the return code will be non-zero and the task will fail...the output from sqlcmd is also used as the message of the exception that is thrown so you will know what went wrong.

Last edited Oct 10, 2012 at 3:17 PM by jimbobdog, version 4


No comments yet.