@@ -12,7 +12,7 @@ if (Test-Path -Path "$PSScriptRoot\..\WTTLog.ps1")
1212
1313$CurrentUseCase = @ {}
1414[System.Collections.Stack ] $UseCaseStack = New-Object System.Collections.Stack
15- filter timestamp {" $ ( Get-Date - Format HH:mm:ss.ffff) : $_ " }
15+ filter timestamp {" $ ( Get-Date - Format " yyyy-MM-dd HH:mm:ss.ffff" ) $_ " }
1616
1717
1818function Log-Info
@@ -51,14 +51,11 @@ function Log-JSONReport
5151 [string ] $Message
5252 )
5353 if ($Message )
54- {
55- if ($Message.Contains (" : [" ))
56- {
57- $time = $Message.Substring (0 , $Message.IndexOf (" : [" ))
58- }
54+ {
5955 if ($Message.Contains (" [START]" ))
6056 {
61- $name = $Message.Substring ($Message.LastIndexOf (" :" ) + 1 ).Trim().Replace(" ######" , " " ).Trim()
57+ $time = $Message.Substring (0 , $Message.IndexOf (" [" )).Trim()
58+ $name = $Message.Substring ($Message.LastIndexOf (" :" ) + 1 ).Trim()
6259 if ($UseCaseStack.Count )
6360 {
6461 $nestedUseCase = @ {
@@ -81,14 +78,19 @@ function Log-JSONReport
8178 }
8279 elseif ($Message.Contains (" [END]" ))
8380 {
81+ $time = $Message.Substring (0 , $Message.IndexOf (" [" )).Trim()
8482 $result = " "
8583 if ($UseCaseStack.Peek ().UseCase -and ($UseCaseStack.Peek ().UseCase | Where-Object {$_.Result -eq " FAIL" }))
8684 {
8785 $result = " FAIL"
8886 }
89- else
87+ elseif ($Message.Contains (" [RESULT = PASS]" ))
88+ {
89+ $result = " PASS"
90+ }
91+ elseif ($Message.Contains (" [RESULT = FAIL]" ))
9092 {
91- $result = $Message .Substring ( $Message .LastIndexOf ( " = " ) + 1 ).Trim().Replace( " ] ###### " , " " ).Trim()
93+ $result = " FAIL "
9294 }
9395 $UseCaseStack.Peek ().Add(" Result" , $result )
9496 $UseCaseStack.Peek ().Add(" EndTime" , $time )
@@ -256,7 +258,7 @@ function Invoke-Usecase
256258 Log- Info (" Skipping Usecase: $Name " )
257259 return
258260 }
259- Log- Info (" ###### [START] Usecase: $Name ###### `n " )
261+ Log- Info (" [START] Usecase: $Name `n " )
260262 if ($Global :wttLogFileName )
261263 {
262264 StartTest " CanaryGate:$Name "
@@ -278,7 +280,7 @@ function Invoke-Usecase
278280 {
279281 EndTest " CanaryGate:$Name " $true
280282 }
281- Log- Info (" ###### [END] Usecase: $Name ###### [RESULT = PASS] ###### `n " )
283+ Log- Info (" [END] [RESULT = PASS] Usecase: $Name `n " )
282284 return $result | Out-Null
283285 }
284286 catch [System.Exception ]
@@ -287,7 +289,7 @@ function Invoke-Usecase
287289 Log- Info (" ###### <FAULTING SCRIPTBLOCK> ######" )
288290 Log- Info (" $UsecaseBlock " )
289291 Log- Info (" ###### </FAULTING SCRIPTBLOCK> ######" )
290- Log- Error (" ###### [END] Usecase: $Name ###### [RESULT = FAIL] ###### `n " )
292+ Log- Error (" [END] [RESULT = FAIL] Usecase: $Name `n " )
291293 if ($Global :wttLogFileName )
292294 {
293295 EndTest " CanaryGate:$Name " $false
0 commit comments