Switches used in the command line

Command line usage

unittest /testsupport [/switch1[:value | [parameter1:value parameter2:value ..]] /switch2 ..]

The first argument for unittest is usually an operation switch that corresponds to the operation you want to perform with the application.

Available command-line switches

Switch Usage
/argfile /argfile:<path>
  Path to command-line arguments file. Options specified in the command line have higher priority than the options given in the file.
/activate /activate /key:
  Activate a product using the activation key.
/deactivate Deactivate a product.
/testsupport Run tSQLt tests.
/quiet (/q) Hide console window in console mode. It should be used after the main operation switch.

Switch parameters

/testsupport

Switch Usage
class Usage: /class:<class_name>
  Specifies the unit test class. If it is not specified or left empty, the tests will be executed for all classes.
connection Usage: /connection:<connection_string>
  Specifies the connection string.
install_tsqlt Usage: /install_tsqlt:<expression>
  Install tSQLt framework on the database before executing tests.
  Specifies the mask expression. To turn the option on or off, specify: True, Y, False, N.
outreport Usage: /outreport:<filepath\fileName.[extension]>
  Specifies the test report filename and the extension of the output file. If empty - the result will be printed to the console.
password Usage: /password:<yourpassword>
  Specifies the server password. Overrides the password specified in the connection string.
reportformat Usage: /reportformat:<JUnit MsTest>
  Specifies the format of the test report file. It can be JUnit or MsTest.
  If you don’t use this parameter, the format will be selected automatically based on the file extension specified in the ‘outreport’ parameter.
rewritereport Usage: /rewritereport:<expression>
  Indicates whether to overwrite an existing report file or not. To turn the option on or off, specify: True, Y, False, N.
uninstall_tsqlt Usage: /uninstall_tsqlt:<expression>
  Uninstalls tSQLt framework after executing tests. To turn the option on or off, specify: True, Y, False, N.
utests Usage: /utests:<TestName1, TestName2> or /utests:<test[space]TestName1, test[space]TestName2>
  Allows to provide a comma-separated list of the test names.

Worked Examples

1. Install the tSQLt framework and execute tests of the specified class.

/testsupport /connection:"Data Source=SQL_SERVER;Initial Catalog=TEST_DB;User ID=yourusername;Password=yourpassword" /class:"test_class01" /install_tsqlt:true

2. Execute all tests in the database and uninstall the tSQLt framework.

/testsupport /connection:"Data Source=SQL_SERVER;Initial Catalog=TEST_DB;User ID=yourusername;Password=yourpassword" /uninstall_tsqlt:true

3. Execute the specified tests and report results to an XML file.

/testsupport /connection:"Data Source=SQL_SERVER;Initial Catalog=TEST_DB;User ID=yourusername;Password=yourpassword" /utests: "TEST01,TEST03" /outreport:D:\Result.xml

4. Execute the specified tests from different classes and report to a TXT file with the MSTest output format.

/testsupport /connection:"Data Source=SQL_SERVER;Initial Catalog=TEST_DB;User ID=yourusername;Password=yourpassword" /utests:"TEST01, TEST04" /outreport:D:\result.txt /reportformat:mstest

5. Execute the tests and report results to a file with overwriting.

/testsupport /connection:"Data Source=SQL_SERVER;Initial Catalog=TEST_DB;User ID=yourusername;Password=yourpassword" /outreport:D:\result.xml /reportformat:junit /rewritereport:true