Invoke-DevartDatabaseTests

Synopsis

Runs tSQLt tests for a specified database.

Description

The cmdlet executes the tSQLt tests from the database project. The results can be presented as a separate report.

Syntax

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>]

Parameters

-InputObject <object>

Database to run the tSQLt tests on. It can be a scripts folder, a NuGet package, or a database connection.

Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false

-InstalltSQLtFramework <SwitchParameter>

Install tSQLt Framework before executing tests.

Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false

-UnInstalltSQLtFramework <SwitchParameter>

Uninstall tSQLt Framework after execution of tests.

Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false

-RewriteReport <SwitchParameter>

Use this parameter to rewrite a report file.

Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false

-Class <string>

Use this parameter to run specific class tests. If you don’t use this parameter, every test will be run.

Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false

-UnitTests <string>

Use this parameter to run a specific test or a specific test suite. If you don’t use this parameter, every test will be run.

Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false

-OutReportFileName <string>

File path to export the test results to.

Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false

-ReportFormat <TestReportFormat>

Format of the test results file.

Possible values: JUnit, MsTest

Required? false

Position? named

Default value JUnit

Accept pipeline input? false

Accept wildcard characters? false

-IncludeTestData <SwitchParameter>

Use this and DataGeneratorProject parameters to add test data to the database.

Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false

-DataGeneratorProject <string>

Use this parameter to specify a Data Generator project file (.dgen) that defines the data to be added to the test database.

Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false

-SynchronizationOptions <string>

Specifies the Schema Compare options used during creation of the script for validation.

To include additional options, specify a slash-separated list of the options.

For example: /IgnoreCase:Yes /IgnorePrimaryKeys:No

Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false

For more detailed information about options, see the Options used in the command line topic.

-TemporaryDatabaseServer <object>

Connection to the temporary database used for validation. This parameter can be used if a script folder, an object, or a NuGet package is specified as -InputObject. Otherwise, the parameter will be ignored.

Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false

-QueryBatchTimeout <int>

The parameter is applied for each of the following expressions if the InputObject parameter or the TemporaryDatabaseServer parameter is an object of the DevartDatabaseConnectionInfo type:

  • Temporary database creation script

  • Data generation script

  • Testing script

The default parameter value is 30 seconds.

Required? false

Position? named

Default value 30

Accept pipeline input? false

Accept wildcard characters? false

-FilterPath <string> 

Specifies the Schema Compare filter options used when generating a database to test against.

Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false

<CommonParameters>

This cmdlet supports the following common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, InformationAction, InformationVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see About Common Parameters.

Outputs

System.Boolean (returns true on success and false otherwise)

Examples

---------- EXAMPLE 1 ----------
$testResult = Invoke-DevartDatabaseTests -InputObject $connection -InstalltSQLtFramework -IncludeTestData -DataGeneratorProject "DababaseName(MsSqlServer).dgen"
-OutReportFileName:"C:\Test Result.xml" -ReportFormat JUnit -RewriteReport

See Options used in the command line for a complete list of supported SynchronizationOptions.

See Using Object Filter to learn how to generate a Schema Compare filter options file.

See Automate SQL unit testing using the command line and Generating data for information on additional command line options.

Want to Find out More?

Overview

Overview

Take a quick tour to learn all about the key benefits delivered by dbForge DevOps Automation for SQL Server.
Request a demo

Request a demo

If you consider employing the DevOps Automation for your business, request a demo to see it in action.
Ready to start using dbForge DevOps Automation for SQL Server?