Runs tSQLt tests for a specified database.
The cmdlet runs the tSQLt tests from the database project and can generate a separate report with the results.
Invoke-DevartDatabaseTests -InputObject <object> [-Class <string>] [-DataGeneratorProject <string>] [-FilterPath <string>] [-IncludeTestData <SwitchParameter>] [-InstalltSQLtFramework <SwitchParameter>] [-OutReportFileName <string>]
[-QueryBatchTimeout <int>] [-ReportFormat <TestReportFormat>] [-RewriteReport <SwitchParameter>] [-SynchronizationOptions <string>] [-TemporaryDatabaseServer <object>] [-UnInstalltSQLtFramework <SwitchParameter>] [-UnitTests <string>]
[<CommonParameters>]
Specifies the database on which to run the tSQLt tests. This can be a scripts folder, a NuGet package, or a database connection.
-InputObject <object>
| Property | Default value |
|---|---|
| Required | True |
| Position | Named |
| Default value | - |
| Accept pipeline input | False |
| Accept wildcard characters | False |
Installs a tSQLt Framework before executing tests.
-InstalltSQLtFramework <SwitchParameter>
| Property | Default value |
|---|---|
| Required | False |
| Position | Named |
| Default value | False |
| Accept pipeline input | False |
| Accept wildcard characters | False |
Uninstalls a tSQLt Framework after executing tests.
-UnInstalltSQLtFramework <SwitchParameter>
| Property | Default value |
|---|---|
| Required | False |
| Position | Named |
| Default value | False |
| Accept pipeline input | False |
| Accept wildcard characters | False |
Overwrites a report file.
-RewriteReport <SwitchParameter>
| Property | Default value |
|---|---|
| Required | False |
| Position | Named |
| Default value | False |
| Accept pipeline input | False |
| Accept wildcard characters | False |
Executes tests for the specified class; otherwise, runs all tests.
-Class <string>
| Property | Default value |
|---|---|
| Required | False |
| Position | Named |
| Default value | - |
| Accept pipeline input | False |
| Accept wildcard characters | False |
Runs a specific test or test suite; otherwise, runs all tests.
-UnitTests <string>
| Property | Default value |
|---|---|
| Required | False |
| Position | Named |
| Default value | - |
| Accept pipeline input | False |
| Accept wildcard characters | False |
Specifies the destination file path for exporting test results.
-OutReportFileName <string>
| Property | Default value |
|---|---|
| Required | False |
| Position | Named |
| Default value | - |
| Accept pipeline input | False |
| Accept wildcard characters | False |
Specifies the format of the test results file.
-ReportFormat <TestReportFormat>
| Property | Default value |
|---|---|
| Possible values | JUnit, MsTest |
| Required | False |
| Position | Named |
| Default value | JUnit |
| Accept pipeline input | False |
| Accept wildcard characters | False |
Populates the database with test data. Use the DataGeneratorProject parameter to specify the data source.
-IncludeTestData <SwitchParameter>
| Property | Default value |
|---|---|
| Required | False |
| Position | Named |
| Default value | False |
| Accept pipeline input | False |
| Accept wildcard characters | False |
Specifies a data generation project file (.dgen) that defines the data to insert into the test database.
-DataGeneratorProject <string>
| Property | Default value |
|---|---|
| Required | False |
| Position | Named |
| Default value | - |
| Accept pipeline input | False |
| Accept wildcard characters | False |
Specifies the schema comparison options to generate a synchronization script.
-SynchronizationOptions <string>
To include additional options, specify a list of the options, for example:
/IgnoreCase:Yes /IgnorePrimaryKeys:No
| Property | Default value |
|---|---|
| Required | False |
| Position | Named |
| Default value | - |
| Accept pipeline input | False |
| Accept wildcard characters | False |
For a complete list of synchronization options, see Command-line options.
Specifies the connection to the temporary database. This parameter can be used if a script folder, an object, or a NuGet package is specified as -InputObject. Otherwise, the parameter is ignored.
-TemporaryDatabaseServer <object>
| Property | Default value |
|---|---|
| Required | False |
| Position | Named |
| Default value | - |
| Accept pipeline input | False |
| Accept wildcard characters | False |
Controls how long a SQL query can run before PowerShell stops it. This parameter applies to each expression in the database creation script when the Connection parameter is a DevartDatabaseConnectionInfo object.
-QueryBatchTimeout <int>
| Property | Default value |
|---|---|
| Required | False |
| Position | Named |
| Default value | 30 |
| Accept pipeline input | False |
| Accept wildcard characters | False |
Specifies the schema comparison filter options used when generating the test database.
-FilterPath <string>
| Property | Default value |
|---|---|
| Required | False |
| Position | Named |
| Default value | - |
| Accept pipeline input | False |
| Accept wildcard characters | False |
<CommonParameters>
This cmdlet supports these common parameters:
Verbose – Provides detailed output about the command operation.Debug – Provides debugging information.ErrorAction – Specifies how to respond to errors.ErrorVariable – Stores error messages in a variable.WarningAction – Specifies how to respond to warnings.WarningVariable – Stores warning messages in a variable.InformationAction – Specifies how informational messages are handled.InformationVariable – Stores informational messages in a variable.OutBuffer – Controls the number of objects buffered before output.PipelineVariable – Stores the current pipeline object in a variable.OutVariable – Stores output objects in a variable.For more information, see About Common Parameters.
System.Boolean (returns true on success and false otherwise)
System.Boolean returns:
true if the operation was successful.false if the operation failed.$testResult = Invoke-DevartDatabaseTests -InputObject $connection -InstalltSQLtFramework -IncludeTestData -DataGeneratorProject "DatabaseName(MsSqlServer).dgen" -OutReportFileName "C:\TestResult.xml" -ReportFormat JUnit -RewriteReport
For information about how to generate a file containing filter options, see Using Object Filter.
For information on additional command-line options, see Automate SQL unit testing from the command line and Generate data.