-
Notifications
You must be signed in to change notification settings - Fork 110
Expand file tree
/
Copy pathtSQLt_ValidateRunExampleTests.ps1
More file actions
63 lines (57 loc) · 2.76 KB
/
Copy pathtSQLt_ValidateRunExampleTests.ps1
File metadata and controls
63 lines (57 loc) · 2.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# <param name="execute.sql.filename" value="temp/Validate/tSQLt.tests/Drop(master.tSQLt_testutil).sql" />
# <param name="execute.sql.filename" value="temp/Validate/tSQLt.tests/temp_create_example.sql" />
# <param name="execute.sql.statement" value="EXEC tSQLt_testutil.PrepMultiRunLogTable;EXEC tSQLt.SetSummaryError @SummaryError=0;" />
# <param name="execute.sql.outputfile" value="temp/Validate/TestResults/TestResults_Example.xml" />
# <param name="execute.sql.testcasefilename" value="ExampleDB" />
# <param name="execute.sql.statement" value="PRINT DB_NAME();EXEC tSQLt.Run 'ExampleDeployed';" />
# <param name="execute.sql.statement" value="EXEC tSQLt.SetSummaryError @SummaryError=1;EXEC tSQLt_testutil.CheckMultiRunResults @noError=1;EXEC tSQLt_testutil.StoreBuildLog @TableName='${logtable.name}',@RunGroup='Example';" />
$TestDbName = 'tSQLt_Example';
Log-Output("Run All Tests... Cleanup master ...")
$parameters = @{
SqlServerConnection = $SqlServerConnection
HelperSQLPath = $HelperSQLPath
Elevated = $true
Files = @(
(Join-Path $TestsPath "Drop(master.tSQLt_testutil).sql" | Resolve-Path)
)
DatabaseName = "tempdb"
AdditionalParameters = @{NewDbName = $TestDbName}
}
Invoke-SQLFileOrQuery @parameters;
Log-Output("Run All Tests... Create Database $TestDbName and deploy example code ...")
$parameters = @{
SqlServerConnection = $SqlServerConnection
HelperSQLPath = $HelperSQLPath
Elevated = $true
Files = @(
(Join-Path $TestsPath "temp_create_example.sql" | Resolve-Path)
)
DatabaseName = "tempdb"
AdditionalParameters = @{NewDbName = $TestDbName}
}
Invoke-SQLFileOrQuery @parameters;
Log-Output('Run All Tests... Set SummaryError Off, PrepMultiRun...')
$parameters = @{
SqlServerConnection = $SqlServerConnection
HelperSQLPath = $HelperSQLPath
Query = "EXEC tSQLt_testutil.PrepMultiRunLogTable;EXEC tSQLt.SetSummaryError @SummaryError=0;"
DatabaseName = $TestDbName
}
Invoke-SQLFileOrQuery @parameters;
Log-Output('Run All Tests... TestUtil Tests...')
$parameters = @{
SqlServerConnection = $SqlServerConnection
HelperSQLPath = $HelperSQLPath
DatabaseName = $TestDbName
TestFilePath = (Join-Path $TestsPath "TestThatExamplesAreDeployed.sql")
OutputFile = (Join-Path $ResultsPath "TestResults_Example.xml")
}
Invoke-TestsFromFile @parameters;
Log-Output('Run All Tests... Set SummaryError O, Capture MultiRun Results...')
$parameters = @{
SqlServerConnection = $SqlServerConnection
HelperSQLPath = $HelperSQLPath
Query = "EXEC tSQLt.SetSummaryError @SummaryError=1;EXEC tSQLt_testutil.CheckMultiRunResults @noError=1;EXEC tSQLt_testutil.StoreBuildLog @TableName='$LogTableName',@RunGroup='AllTests_Example';"
DatabaseName = $TestDbName
}
Invoke-SQLFileOrQuery @parameters;