-
Notifications
You must be signed in to change notification settings - Fork 351
/
Copy pathGenerateTestingScenariosChecklist.ps1
76 lines (58 loc) · 2 KB
/
GenerateTestingScenariosChecklist.ps1
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
64
65
66
67
68
69
70
71
72
73
74
75
76
Param(
[string]$FileName = "TestingScenariosChecklist.xlsx",
[string]$GitHubExt = "..\..\devhomegithubextension",
[string]$AzureExt = "..\..\devhomeazureextension",
[switch]$Help = $false
)
if ($Help) {
Write-Host @"
Copyright (c) Microsoft Corporation..
Licensed under the MIT License.
Syntax:
GenerateTestingScenariosChecklist.ps1 [options]
Description:
Generates a testing scenario validation Excel workbook
Options:
-FileName <name>
Name of the Excel workbook
Example -FileName "TestingScenariosChecklist.xlsx"
-GitHubExt <filepath>
Path to the GitHub Extension repo on the same device
Example: -GitHubExt "..\..\devhomegithubextension"
-AzureExt <filepath>
Path to the Azure Extension repo on the same device
Example: -AzureExt "..\..\devhomeazureextension"
-Help
Display this usage message.
"@
Exit
}
if (-not $fileName.EndsWith(".xlsx")) {
$fileName += ".xlsx"
}
if (Test-Path $fileName) {
Remove-Item $fileName
}
Install-Module -Name ImportExcel
Import-Module -Name ImportExcel
$repos = "..",$GitHubExt,$AzureExt
$worksheetNames = "Dev Home","GitHub Extension","Azure Extension"
For ($i=0;$i -lt $repos.count;$i++) {
if (Test-Path $repos[$i]) {
$files = Get-ChildItem $repos[$i] -recurse -Filter *.md | Where-Object {$_.FullName -like "*TestingScenarios*"}
$testNumber = 0
$data = "Test No;Test Scenario;Sign Off (Win10);Sign Off (Win11);Additional Sign Offs;Found Issues`n"
ForEach ($file in $files) {
$content = Get-Content $file.FullName
ForEach ($line in $content) {
if (-not $line.EndsWith(".md)") -and $line.StartsWith("1. ")) {
$testNumber++
$testScenario = $line.substring(3)
$data += "" + $testNumber + ";" + $testScenario + "`n"
}
}
}
$data = ConvertFrom-Csv $data -Delimiter ";"
$data | Export-Excel $fileName -WorksheetName $worksheetNames[$i]
}
}