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 diff --git a/Libraries/TestReport.psm1 b/Libraries/TestReport.psm1 index a65f6ce8f2..dd5f706b33 100644 --- a/Libraries/TestReport.psm1 +++ b/Libraries/TestReport.psm1 @@ -123,8 +123,9 @@ Class JUnitReportGenerator [System.Xml.XmlElement] $ReportRootNode [object] $TestSuiteLogTable [object] $TestSuiteCaseLogTable - - JUnitReportGenerator([string]$ReportPath) + [string] $TestCategory + [string] $ovlname + JUnitReportGenerator([string]$ReportPath,[string]$TestCategory,[string]$ovlname) { $this.JunitReportPath = $ReportPath $this.JunitReport = New-Object System.Xml.XmlDocument @@ -132,6 +133,8 @@ Class JUnitReportGenerator $this.ReportRootNode = $this.JunitReport.AppendChild($newElement) $this.TestSuiteLogTable = @{} $this.TestSuiteCaseLogTable = @{} + $this.TestCategory=$TestCategory + $this.ovlname=$ovlname } [void] SaveLogReport() @@ -156,6 +159,11 @@ Class JUnitReportGenerator $newElement.SetAttribute("errors", 0) $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 ) + } $testsuiteNode = $this.ReportRootNode.AppendChild($newElement) $testsuite = [ReportNode]::New($testsuiteNode) diff --git a/TestControllers/TestController.psm1 b/TestControllers/TestController.psm1 index 26d3937a0e..b66909ed56 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 @@ -270,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) @@ -302,11 +304,19 @@ Class TestController { foreach ($CustomParameter in $CustomTestParameters) { $ReplaceThis = $CustomParameter.Split("=")[0] $ReplaceWith = $CustomParameter.Substring($CustomParameter.IndexOf("=") + 1) + if($ReplaceThis -eq "ovlname") + { + $this.ovlname=$ReplaceWith + } + else { + + $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." } @@ -323,12 +333,12 @@ 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 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 +374,7 @@ Class TestController { $parallelTestsDoc.Save("$parallelTestsFilePath") } } + } } [void] PrepareTestImage() {} @@ -903,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.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)