forked from iabiev/bCertApi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAppendxUnitFramework.ps1
30 lines (25 loc) · 1 KB
/
AppendxUnitFramework.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
Param(
[string]$globPattern = "testRuns_*.testresults",
[string]$searchDirectory = $PSScriptRoot
)
# Find all files matching the glob pattern
$testResultFiles = Get-ChildItem -Path $searchDirectory -Filter $globPattern -Recurse
function getFrameworkNameFromFilename {
Param($file)
$frameworkName = $testResultFile.Name.Substring(0, $testResultFile.Name.Length - $testResultFile.Extension.Length)
$frameworkName = $frameworkName.Substring($frameworkName.LastIndexOf("-") + 1)
return $frameworkName;
}
function transformTestResultFile {
Param($testResultFile)
$frameworkName = getFrameworkNameFromFilename $testResultFile
$xmlContent = [xml](Get-Content $testResultFile)
$testNodes = $xmlContent.SelectNodes("//test/@type")
foreach ($testNode in $testNodes){
$testNode.Value = $frameworkName + "+" + $testNode.Value
}
$xmlContent.Save($testResultFile.FullName)
}
foreach ($testResultFile in $testResultFiles) {
transformTestResultFile $testResultFile
}