From c34aeaac42b7d5b43e2c4690c38c032c007c3c2d Mon Sep 17 00:00:00 2001 From: Abhishek Tiwari Date: Tue, 13 Aug 2024 16:10:23 +0530 Subject: [PATCH 01/13] adding testcategory to junit --- Libraries/TestReport.psm1 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Libraries/TestReport.psm1 b/Libraries/TestReport.psm1 index a65f6ce8f2..92407195ef 100644 --- a/Libraries/TestReport.psm1 +++ b/Libraries/TestReport.psm1 @@ -124,7 +124,7 @@ Class JUnitReportGenerator [object] $TestSuiteLogTable [object] $TestSuiteCaseLogTable - JUnitReportGenerator([string]$ReportPath) + JUnitReportGenerator([string]$ReportPath,[string]$TestCategory) { $this.JunitReportPath = $ReportPath $this.JunitReport = New-Object System.Xml.XmlDocument @@ -132,6 +132,7 @@ Class JUnitReportGenerator $this.ReportRootNode = $this.JunitReport.AppendChild($newElement) $this.TestSuiteLogTable = @{} $this.TestSuiteCaseLogTable = @{} + $this.TestCategory=$TestCategory } [void] SaveLogReport() @@ -156,6 +157,13 @@ Class JUnitReportGenerator $newElement.SetAttribute("errors", 0) $newElement.SetAttribute("skipped", 0) $newElement.SetAttribute("time", 0) + $newElement.SetAttribute("TestCategory", $this.TestCategory) + if ( $global:BaseOSVHD ) { + $newElement.SetAttribute("ImageUnderTest", $global:BaseOSVHD ) + if ($global:deviceSoCFWVer.count -gt 0 -and $global:deviceSoCFWVer[0].length -gt 0) { + $newElement.SetAttribute("DeviceUnderTest", $global:deviceInfo[0] ) + } + } $testsuiteNode = $this.ReportRootNode.AppendChild($newElement) $testsuite = [ReportNode]::New($testsuiteNode) From 7be4fc0193608faf9863f3d3b759be3b5bf40d4a Mon Sep 17 00:00:00 2001 From: Abhishek Tiwari Date: Tue, 13 Aug 2024 16:30:02 +0530 Subject: [PATCH 02/13] adding testcategory to junit --- Libraries/TestReport.psm1 | 2 +- TestControllers/TestController.psm1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Libraries/TestReport.psm1 b/Libraries/TestReport.psm1 index 92407195ef..65e0bd3e8c 100644 --- a/Libraries/TestReport.psm1 +++ b/Libraries/TestReport.psm1 @@ -123,7 +123,7 @@ Class JUnitReportGenerator [System.Xml.XmlElement] $ReportRootNode [object] $TestSuiteLogTable [object] $TestSuiteCaseLogTable - + [string] $TestCategory JUnitReportGenerator([string]$ReportPath,[string]$TestCategory) { $this.JunitReportPath = $ReportPath diff --git a/TestControllers/TestController.psm1 b/TestControllers/TestController.psm1 index 26d3937a0e..a33358b559 100644 --- a/TestControllers/TestController.psm1 +++ b/TestControllers/TestController.psm1 @@ -903,7 +903,7 @@ Class TestController { Write-LogInfo "Prepare test log structure and start testing now ..." # Start JUnit XML report logger. - $this.JunitReport = [JUnitReportGenerator]::New($TestReportXmlPath) + $this.JunitReport = [JUnitReportGenerator]::New($TestReportXmlPath,$this.TestCategory) $this.JunitReport.StartLogTestSuite("LISAv2Test-$($this.TestPlatform)") $this.TestSummary = [TestSummary]::New($this.TestCategory, $this.TestArea, $this.TestNames, $this.TestTag, $this.TestPriority, $this.TotalCaseNum) From 5aa276d6c8cf4c91b60f5ecc1c064eb65d291261 Mon Sep 17 00:00:00 2001 From: Abhishek Tiwari Date: Tue, 13 Aug 2024 19:09:55 +0530 Subject: [PATCH 03/13] adding testcategory to junit --- Libraries/TestReport.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/TestReport.psm1 b/Libraries/TestReport.psm1 index 65e0bd3e8c..3d33061e16 100644 --- a/Libraries/TestReport.psm1 +++ b/Libraries/TestReport.psm1 @@ -161,7 +161,7 @@ Class JUnitReportGenerator if ( $global:BaseOSVHD ) { $newElement.SetAttribute("ImageUnderTest", $global:BaseOSVHD ) if ($global:deviceSoCFWVer.count -gt 0 -and $global:deviceSoCFWVer[0].length -gt 0) { - $newElement.SetAttribute("DeviceUnderTest", $global:deviceInfo[0] ) + $newElement.SetAttribute("DeviceUnderTest", $global:deviceInfo ) } } $testsuiteNode = $this.ReportRootNode.AppendChild($newElement) From eabba6827031922ee775fe80d1139cee629a171f Mon Sep 17 00:00:00 2001 From: Abhishek Tiwari Date: Tue, 13 Aug 2024 23:22:37 +0530 Subject: [PATCH 04/13] adding testcategory to junit --- Libraries/TestReport.psm1 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Libraries/TestReport.psm1 b/Libraries/TestReport.psm1 index 3d33061e16..c886b76f87 100644 --- a/Libraries/TestReport.psm1 +++ b/Libraries/TestReport.psm1 @@ -160,9 +160,7 @@ Class JUnitReportGenerator $newElement.SetAttribute("TestCategory", $this.TestCategory) if ( $global:BaseOSVHD ) { $newElement.SetAttribute("ImageUnderTest", $global:BaseOSVHD ) - if ($global:deviceSoCFWVer.count -gt 0 -and $global:deviceSoCFWVer[0].length -gt 0) { - $newElement.SetAttribute("DeviceUnderTest", $global:deviceInfo ) - } + $newElement.SetAttribute("DeviceUnderTest", $global:deviceInfo ) } $testsuiteNode = $this.ReportRootNode.AppendChild($newElement) From 6eee9a76a2aecc0b8e9915b75dec362d5adda61e Mon Sep 17 00:00:00 2001 From: Abhishek Tiwari Date: Wed, 14 Aug 2024 00:04:46 +0530 Subject: [PATCH 05/13] adding testcategory to junit --- Libraries/TestReport.psm1 | 1 - 1 file changed, 1 deletion(-) diff --git a/Libraries/TestReport.psm1 b/Libraries/TestReport.psm1 index c886b76f87..10bc19e388 100644 --- a/Libraries/TestReport.psm1 +++ b/Libraries/TestReport.psm1 @@ -160,7 +160,6 @@ Class JUnitReportGenerator $newElement.SetAttribute("TestCategory", $this.TestCategory) if ( $global:BaseOSVHD ) { $newElement.SetAttribute("ImageUnderTest", $global:BaseOSVHD ) - $newElement.SetAttribute("DeviceUnderTest", $global:deviceInfo ) } $testsuiteNode = $this.ReportRootNode.AppendChild($newElement) From 5e5b5124326e8fa02b2cfcec202af3ac9c25518b Mon Sep 17 00:00:00 2001 From: Abhishek Tiwari Date: Mon, 19 Aug 2024 19:41:40 +0530 Subject: [PATCH 06/13] changing throw to Write log info --- TestControllers/TestController.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestControllers/TestController.psm1 b/TestControllers/TestController.psm1 index a33358b559..bcc22d1bc2 100644 --- a/TestControllers/TestController.psm1 +++ b/TestControllers/TestController.psm1 @@ -323,7 +323,7 @@ Class TestController { } } if (!$allTests) { - Throw "Not able to collect any test cases from XML files" + Write-LogWarn "Not able to collect any test cases from XML files" } else { $collectedTCCount = $allTests.Count From 2c7d2b7483244fc446d5cadd025efc13b54d269c Mon Sep 17 00:00:00 2001 From: Abhishek Tiwari Date: Mon, 19 Aug 2024 19:49:55 +0530 Subject: [PATCH 07/13] changing throw to Write log info --- TestControllers/TestController.psm1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TestControllers/TestController.psm1 b/TestControllers/TestController.psm1 index bcc22d1bc2..25d78688e2 100644 --- a/TestControllers/TestController.psm1 +++ b/TestControllers/TestController.psm1 @@ -328,7 +328,7 @@ Class TestController { else { $collectedTCCount = $allTests.Count Write-LogInfo "$collectedTCCount Test Cases have been collected" - } + $this.PrepareSetupTypeToTestCases($this.SetupTypeToTestCases, $allTests) if (($this.TotalCaseNum -eq 0) -or ($allTests.Count -eq 0)) { Write-LogWarn "All collected test cases are skipped, because the test case has native SetupConfig that conflicts with current Run-LISAv2 parameters, or LISAv2 needs more specific parameters to run against selected test cases, please check again" @@ -364,6 +364,7 @@ Class TestController { $parallelTestsDoc.Save("$parallelTestsFilePath") } } + } } [void] PrepareTestImage() {} From fdacc1136777eef74657fcefa2976621ac24bd54 Mon Sep 17 00:00:00 2001 From: Abhishek Tiwari Date: Mon, 19 Aug 2024 21:16:11 +0530 Subject: [PATCH 08/13] changing throw to Write log info --- LISAv2-Framework.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LISAv2-Framework.psm1 b/LISAv2-Framework.psm1 index 398bf24879..b815434b4a 100644 --- a/LISAv2-Framework.psm1 +++ b/LISAv2-Framework.psm1 @@ -252,7 +252,7 @@ function Start-LISAv2 { } } - if (($failedCount -eq 0 -and $errorCount -eq 0 -and $testCount -gt 0) -or (-not $RunInParallel -and $TestIdInParallel)) { + if (($failedCount -eq 0 -and $errorCount -eq 0 -and $testCount -ge 0) -or (-not $RunInParallel -and $TestIdInParallel)) { $ExitCode = 0 } else { $ExitCode = 1 From d4a012d08d993edf075f474a0664f85203b681be Mon Sep 17 00:00:00 2001 From: Abhishek Tiwari Date: Tue, 20 Aug 2024 12:10:12 +0530 Subject: [PATCH 09/13] changing throw to Write log info --- LISAv2-Framework.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LISAv2-Framework.psm1 b/LISAv2-Framework.psm1 index b815434b4a..398bf24879 100644 --- a/LISAv2-Framework.psm1 +++ b/LISAv2-Framework.psm1 @@ -252,7 +252,7 @@ function Start-LISAv2 { } } - if (($failedCount -eq 0 -and $errorCount -eq 0 -and $testCount -ge 0) -or (-not $RunInParallel -and $TestIdInParallel)) { + if (($failedCount -eq 0 -and $errorCount -eq 0 -and $testCount -gt 0) -or (-not $RunInParallel -and $TestIdInParallel)) { $ExitCode = 0 } else { $ExitCode = 1 From 62f762f058d73633db4ab008730e762fec93c08e Mon Sep 17 00:00:00 2001 From: Abhishek Tiwari Date: Tue, 20 Aug 2024 12:57:56 +0530 Subject: [PATCH 10/13] changing throw to Write log info --- LISAv2-Framework.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LISAv2-Framework.psm1 b/LISAv2-Framework.psm1 index 398bf24879..b815434b4a 100644 --- a/LISAv2-Framework.psm1 +++ b/LISAv2-Framework.psm1 @@ -252,7 +252,7 @@ function Start-LISAv2 { } } - if (($failedCount -eq 0 -and $errorCount -eq 0 -and $testCount -gt 0) -or (-not $RunInParallel -and $TestIdInParallel)) { + if (($failedCount -eq 0 -and $errorCount -eq 0 -and $testCount -ge 0) -or (-not $RunInParallel -and $TestIdInParallel)) { $ExitCode = 0 } else { $ExitCode = 1 From 8fc36ea1374126713afc7f7ca1d07702e259f878 Mon Sep 17 00:00:00 2001 From: Abhishek Tiwari Date: Tue, 20 Aug 2024 14:48:18 +0530 Subject: [PATCH 11/13] changing throw to Write log info --- Libraries/TestReport.psm1 | 5 ++++- TestControllers/TestController.psm1 | 12 +++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Libraries/TestReport.psm1 b/Libraries/TestReport.psm1 index 10bc19e388..dd5f706b33 100644 --- a/Libraries/TestReport.psm1 +++ b/Libraries/TestReport.psm1 @@ -124,7 +124,8 @@ Class JUnitReportGenerator [object] $TestSuiteLogTable [object] $TestSuiteCaseLogTable [string] $TestCategory - JUnitReportGenerator([string]$ReportPath,[string]$TestCategory) + [string] $ovlname + JUnitReportGenerator([string]$ReportPath,[string]$TestCategory,[string]$ovlname) { $this.JunitReportPath = $ReportPath $this.JunitReport = New-Object System.Xml.XmlDocument @@ -133,6 +134,7 @@ Class JUnitReportGenerator $this.TestSuiteLogTable = @{} $this.TestSuiteCaseLogTable = @{} $this.TestCategory=$TestCategory + $this.ovlname=$ovlname } [void] SaveLogReport() @@ -158,6 +160,7 @@ Class JUnitReportGenerator $newElement.SetAttribute("skipped", 0) $newElement.SetAttribute("time", 0) $newElement.SetAttribute("TestCategory", $this.TestCategory) + $newElement.SetAttribute("ovlname", $this.ovlname) if ( $global:BaseOSVHD ) { $newElement.SetAttribute("ImageUnderTest", $global:BaseOSVHD ) } diff --git a/TestControllers/TestController.psm1 b/TestControllers/TestController.psm1 index 25d78688e2..45b33e1e0f 100644 --- a/TestControllers/TestController.psm1 +++ b/TestControllers/TestController.psm1 @@ -53,6 +53,7 @@ Class TestController { [string] $RGIdentifier [string] $OsVHD [string] $TestCategory + [string] $ovlname [string] $TestNames [string] $TestArea [string] $TestTag @@ -100,6 +101,7 @@ Class TestController { $this.RGIdentifier = $ParamTable["RGIdentifier"] $this.OsVHD = $ParamTable["OsVHD"] $this.TestCategory = $ParamTable["TestCategory"] + $this.ovlname="" $this.TestNames = $ParamTable["TestNames"] $this.TestArea = $ParamTable["TestArea"] $this.TestTag = $ParamTable["TestTag"] @@ -302,11 +304,19 @@ Class TestController { foreach ($CustomParameter in $CustomTestParameters) { $ReplaceThis = $CustomParameter.Split("=")[0] $ReplaceWith = $CustomParameter.Substring($CustomParameter.IndexOf("=") + 1) + if($ReplaceThis=="ovlname") + { + $this.ovlname=$ReplaceWith + } + else { + <# Action when all if and elseif conditions are false #> + $OldValue = ($ReplaceableTestParameters.ReplaceableTestParameters.Parameter | Where-Object ` { $_.ReplaceThis -eq $ReplaceThis }).ReplaceWith ($ReplaceableTestParameters.ReplaceableTestParameters.Parameter | Where-Object ` { $_.ReplaceThis -eq $ReplaceThis }).ReplaceWith = $ReplaceWith Write-LogInfo "Custom Parameter: $ReplaceThis=$OldValue --> $ReplaceWith" + } } Write-LogInfo "Custom parameter(s) are ready to be injected along with default parameters, if any." } @@ -904,7 +914,7 @@ Class TestController { Write-LogInfo "Prepare test log structure and start testing now ..." # Start JUnit XML report logger. - $this.JunitReport = [JUnitReportGenerator]::New($TestReportXmlPath,$this.TestCategory) + $this.JunitReport = [JUnitReportGenerator]::New($TestReportXmlPath,$this.TestCategory,$this.ovlname) $this.JunitReport.StartLogTestSuite("LISAv2Test-$($this.TestPlatform)") $this.TestSummary = [TestSummary]::New($this.TestCategory, $this.TestArea, $this.TestNames, $this.TestTag, $this.TestPriority, $this.TotalCaseNum) From 78040527eaf207365f4c4ccf2e8797efd911e4aa Mon Sep 17 00:00:00 2001 From: Abhishek Tiwari Date: Tue, 20 Aug 2024 15:10:19 +0530 Subject: [PATCH 12/13] changing throw to Write log info --- TestControllers/TestController.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestControllers/TestController.psm1 b/TestControllers/TestController.psm1 index 45b33e1e0f..12bd1b408c 100644 --- a/TestControllers/TestController.psm1 +++ b/TestControllers/TestController.psm1 @@ -101,7 +101,6 @@ Class TestController { $this.RGIdentifier = $ParamTable["RGIdentifier"] $this.OsVHD = $ParamTable["OsVHD"] $this.TestCategory = $ParamTable["TestCategory"] - $this.ovlname="" $this.TestNames = $ParamTable["TestNames"] $this.TestArea = $ParamTable["TestArea"] $this.TestTag = $ParamTable["TestTag"] @@ -272,6 +271,7 @@ Class TestController { $this.SetupTypeToTestCases = @{} $this.SetupTypeTable = @{} $allTests = $null + $this.ovlname="" $SetupTypeXMLs = Get-ChildItem -Path "$WorkingDirectory\XML\VMConfigurations\*.xml" foreach ($file in $SetupTypeXMLs.FullName) { $setupXml = [xml]( Get-Content -Path $file) From e8147146915ee5a44d94d8e83a36d6921bcb7e9a Mon Sep 17 00:00:00 2001 From: Abhishek Tiwari Date: Tue, 20 Aug 2024 15:20:00 +0530 Subject: [PATCH 13/13] changing throw to Write log info --- TestControllers/TestController.psm1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TestControllers/TestController.psm1 b/TestControllers/TestController.psm1 index 12bd1b408c..b66909ed56 100644 --- a/TestControllers/TestController.psm1 +++ b/TestControllers/TestController.psm1 @@ -304,12 +304,12 @@ Class TestController { foreach ($CustomParameter in $CustomTestParameters) { $ReplaceThis = $CustomParameter.Split("=")[0] $ReplaceWith = $CustomParameter.Substring($CustomParameter.IndexOf("=") + 1) - if($ReplaceThis=="ovlname") + if($ReplaceThis -eq "ovlname") { $this.ovlname=$ReplaceWith } else { - <# Action when all if and elseif conditions are false #> + $OldValue = ($ReplaceableTestParameters.ReplaceableTestParameters.Parameter | Where-Object ` { $_.ReplaceThis -eq $ReplaceThis }).ReplaceWith