DLM Automation

Switch from SQL CI Test command to PowerShell

This page shows you how to create a PowerShell script using the DLM Automation cmdlets that's equivalent to the SQL CI Test command.

The SQL CI Test command runs tSQLt tests against the NuGet package created by the Build command.

This example uses the Test command in SQL CI to create test results in the folder c:\testresults:

Command line example

sqlCI.exe Test /package="C:\packages\WidgetShop.1.0.nupkg" /outputFolder="c:\testresults"

Here's the same example using the DLM Automation PowerShell cmdlets:

PowerShell example

$package = "C:\packages\WidgetShop.1.0.nupkg"
$results = $package | Invoke-DlmDatabaseTests
$results | Export-DlmDatabaseTestResults -OutputFile "C:\testresults\WidgetShop.junit.xml"
$results | Export-DlmDatabaseTestResults -OutputFile "C:\testresults\WidgetShop.trx"

In the example above:

The file name and format for the test results are specified by the -OutputFile parameter of Export-DlmDatabaseTestResults.

Didn't find what you were looking for?