SQL Change Automation 4

Export-DatabaseTestResults

Exports a TestResults object to disk.

Syntax

Export-DatabaseTestResults [-InputObject] <TestResults> -OutputFile <string> [-Format <TestResultsFormat>] [-Force] [<CommonParameters>]

Description

The Export-DatabaseTestResults cmdlet takes a TestResults results object produced by the Invoke-DatabaseTests cmdlet and exports it to a JUnit or MsTest file.

Parameters

-InputObject <RedGate.Versioning.Automation.Compare.SchemaTesting.TestResults>

The TestResults object to be exported.

Aliases None
Required? true
Position? 0
Default Value None
Accept Pipeline Input true (ByValue)
Accept Wildcard Characters false

-OutputFile <System.String>

The file path to export the TestResults to.

Aliases None
Required? true
Position? named
Default Value None
Accept Pipeline Input false
Accept Wildcard Characters false

-Format <RedGate.Versioning.Automation.Compare.SchemaTesting.Export.TestResultsFormat>

The format of the TestResults file. This can be JUnit or MsTest.

If you don't use this parameter, or if you set it to Default, the format will be chosen automatically depending on the file extension of the OutputFile.

Possible values: Default, JUnit, MsTest

Aliases None
Required? false
Position? named
Default Value Default
Accept Pipeline Input false
Accept Wildcard Characters false

-Force <System.Management.Automation.SwitchParameter>

Use this parameter to overwrite any existing file specified by OutputFile.

Aliases None
Required? false
Position? named
Default Value False
Accept Pipeline Input false
Accept Wildcard Characters false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see http://technet.microsoft.com/en-us/library/hh847884.aspx.

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • RedGate.Versioning.Automation.Compare.SchemaTesting.TestResults

    The TestResults object to be exported.

Return values

The output type is the type of the objects that the cmdlet emits.

  • None

Examples

---------- EXAMPLE 1 ----------

$testResultsFile = "C:\Export\scripts.junit.xml"
$results = Invoke-DatabaseTests "C:\Work\testproject\AdventureWorks2014.Database.Tests\AdventureWorks2014.Database.Tests.sqlproj"
Export-DatabaseTestResults $results -OutputFile $testResultsFile

This example demonstrates the simplest use of Export-DatabaseTestResults with a SQL Change Automation project, only specifying the OutputFile parameter to export the results of the tests to a JUnit file.

---------- EXAMPLE 2 ----------

$testResultsFile = "C:\Export\scripts.junit.xml"
$results = Invoke-DatabaseTests "C:\Work\Scripts"
Export-DatabaseTestResults $results -OutputFile $testResultsFile

This example demonstrates the simplest use of Export-DatabaseTestResults with a SQL Source Control project, only specifying the OutputFile parameter to export the results of the tests to a JUnit file.

---------- EXAMPLE 3 ----------

$testResultsFile = "C:\Export\scripts.xml"
Invoke-DatabaseTests "C:\Work\testproject\AdventureWorks2014.Database.Tests\AdventureWorks2014.Database.Tests.sqlproj" | Export-DatabaseTestResults -OutputFile $testResultsFile -Format MSTest

This example shows how to specify the format of the test results file. This can be JUnit or MSTest.

If you don't use the Format parameter, or if you set it to Default, the format will be chosen automatically depending on the file extension of the OutputFile.

---------- EXAMPLE 4 ----------

$testResultsFile = "C:\Export\scripts.junit.xml"
$results = Invoke-DatabaseTests "C:\Work\testproject\AdventureWorks2014.Database.Tests\AdventureWorks2014.Database.Tests.sqlproj"
Export-DatabaseTestResults $results -OutputFile $testResultsFile -Force

This example shows how to overwrite an existing test results file using the Force parameter.


Didn't find what you were looking for?