Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page Scripting test result visualizer & updated test analyzer logic. #1423

Draft
wants to merge 31 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
cfa1cf5
Page Scripting tests analyzer added
spetersenms Jan 28, 2025
d847c20
Running page scripting tests
spetersenms Jan 28, 2025
d6eb5d3
Unique identifier for each test analyzer step.
spetersenms Jan 28, 2025
548333f
Moved TestResultAnalyzer load outside if statement.
spetersenms Jan 28, 2025
ff3c795
Removed commented code
spetersenms Jan 28, 2025
c8ab211
Updated return message when no BCPT test result file found.
spetersenms Jan 28, 2025
8c97234
cleanup
spetersenms Jan 28, 2025
dc18262
Aligned pageScripting analyzer with other analyzer logic
spetersenms Jan 28, 2025
a963376
Added documentation for new param
spetersenms Jan 28, 2025
6f277ed
Each analyzer step now depends on setting related to the analyzed typ…
spetersenms Jan 28, 2025
8a0e951
pre-commit
spetersenms Jan 28, 2025
0500101
Renamed default testsToAnalyzer param to app
spetersenms Jan 28, 2025
0999647
Adding additional test analyzer steps to AppSource template yaml
spetersenms Jan 28, 2025
6c3ed9c
Aligning Write-Host in pageScripting fucntion to original design
spetersenms Jan 28, 2025
82522f4
Merge branch 'main' into PageScriptReporter
spetersenms Jan 28, 2025
f7cc15b
Renamed testsToAnalyze param to testType, and included a ValidateSet …
spetersenms Jan 29, 2025
d172421
Reading do not run settings for bcpt and page scripting tests
spetersenms Jan 29, 2025
14ec8de
Using switch statement.
spetersenms Feb 13, 2025
d8191b0
Helper functions to build MD and html content.
spetersenms Feb 13, 2025
fa88a33
Using new helper functions
spetersenms Feb 13, 2025
9a516a9
Fixed output type.
spetersenms Feb 14, 2025
1e92ee4
Cleanup of old code.
spetersenms Feb 14, 2025
6f289ca
pre-commit
spetersenms Feb 14, 2025
a0a0b47
renamed parameter.
spetersenms Feb 14, 2025
e66d313
Changed parameter type
spetersenms Feb 14, 2025
5a615fe
Added generic MD table creator in own helper file.
spetersenms Feb 18, 2025
3cf09ec
Pre-commit
spetersenms Feb 19, 2025
1f7f2a7
Using new helper function.
spetersenms Feb 19, 2025
80a89b8
typo in file name.
spetersenms Feb 20, 2025
e9c7297
Type error
spetersenms Feb 20, 2025
01aceb3
Importing md helper correctly.
spetersenms Feb 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 38 additions & 26 deletions Actions/AnalyzeTests/AnalyzeTests.ps1
Original file line number Diff line number Diff line change
@@ -1,45 +1,57 @@
Param(
[Parameter(HelpMessage = "Project to analyze", Mandatory = $false)]
[string] $project = '.'
[string] $project = '.',
[Parameter(HelpMessage = "Tests to analyze", Mandatory = $false)]
[ValidateSet('normal', 'bcpt', 'pageScripting')]
[string] $testType = 'normal'
)

. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)

. (Join-Path -Path $PSScriptRoot 'TestResultAnalyzer.ps1')

$testResultsFile = Join-Path $ENV:GITHUB_WORKSPACE "$project\TestResults.xml"
$testResultsSummaryMD, $testResultsfailuresMD, $testResultsFailuresSummaryMD = GetTestResultSummaryMD -testResultsFile $testResultsFile
$testResultsSummaryMD = ''
$testResultsfailuresMD = ''
$testResultsFailuresSummaryMD = ''

$settings = $env:Settings | ConvertFrom-Json
$bcptTestResultsFile = Join-Path $ENV:GITHUB_WORKSPACE "$project\bcptTestResults.json"
$bcptBaseLineFile = Join-Path $ENV:GITHUB_WORKSPACE "$project\bcptBaseLine.json"
$bcptThresholdsFile = Join-Path $ENV:GITHUB_WORKSPACE "$project\bcptThresholds.json"
$bcptSummaryMD = GetBcptSummaryMD `
-bcptTestResultsFile $bcptTestResultsFile `
-baseLinePath $bcptBaseLineFile `
-thresholdsPath $bcptThresholdsFile `
-bcptThresholds ($settings.bcptThresholds | ConvertTo-HashTable)
switch ($testType) {
'normal' {
$testResultsFile = Join-Path $ENV:GITHUB_WORKSPACE "$project\TestResults.xml"
$testResultsSummaryMD, $testResultsfailuresMD, $testResultsFailuresSummaryMD = GetTestResultSummaryMD -testResultsFile $testResultsFile
$testTitle = "Test results"
}
'bcpt' {
$settings = $env:Settings | ConvertFrom-Json
$bcptTestResultsFile = Join-Path $ENV:GITHUB_WORKSPACE "$project\bcptTestResults.json"
$bcptBaseLineFile = Join-Path $ENV:GITHUB_WORKSPACE "$project\bcptBaseLine.json"
$bcptThresholdsFile = Join-Path $ENV:GITHUB_WORKSPACE "$project\bcptThresholds.json"
$testResultsSummaryMD = GetBcptSummaryMD `
-bcptTestResultsFile $bcptTestResultsFile `
-baseLinePath $bcptBaseLineFile `
-thresholdsPath $bcptThresholdsFile `
-bcptThresholds ($settings.bcptThresholds | ConvertTo-HashTable)
$testTitle = "Performance test results"
}
'pageScripting' {
$testResultsFile = Join-Path $ENV:GITHUB_WORKSPACE "$project\PageScriptingTestResults.xml"
$testResultsSummaryMD, $testResultsfailuresMD, $testResultsFailuresSummaryMD = GetPageScriptingTestResultSummaryMD -testResultsFile $testResultsFile
$testTitle = "Page Scripting test results"
}
default {
Write-Host "::error:: Unknown test type: $testType"
return ''
}
}

# If summary fits, we will display it in the GitHub summary
if ($testResultsSummaryMD.Length -gt 65000) {
# If Test results summary is too long, we will not display it in the GitHub summary, instead we will display a message to download the test results
$testResultsSummaryMD = "<i>Test results summary size exceeds GitHub summary capacity. Download **TestResults** artifact to see details.</i>"
}
# If summary AND BCPT summary fits, we will display both in the GitHub summary
if ($testResultsSummaryMD.Length + $bcptSummaryMD.Length -gt 65000) {
# If Combined Test Results and BCPT summary exceeds GitHub summary capacity, we will not display the BCPT summary
$bcptSummaryMD = "<i>Performance test results summary size exceeds GitHub summary capacity. Download **BcptTestResults** artifact to see details.</i>"
}
# If summary AND BCPT summary AND failures summary fits, we will display all in the GitHub summary
if ($testResultsSummaryMD.Length + $testResultsfailuresMD.Length + $bcptSummaryMD.Length -gt 65000) {
# If Combined Test Results, failures and BCPT summary exceeds GitHub summary capacity, we will not display the failures details, only the failures summary
if ($testResultsSummaryMD.Length + $testResultsfailuresMD.Length -gt 65000) {
# If Combined Test Results and failures exceeds GitHub summary capacity, we will not display the failures details, only the failures summary
$testResultsfailuresMD = $testResultsFailuresSummaryMD
}

Add-Content -Encoding UTF8 -path $ENV:GITHUB_STEP_SUMMARY -value "## Test results`n`n"
Add-Content -Encoding UTF8 -path $ENV:GITHUB_STEP_SUMMARY -value "## $testTitle`n`n"
Add-Content -Encoding UTF8 -path $ENV:GITHUB_STEP_SUMMARY -value "$($testResultsSummaryMD.Replace("\n","`n"))`n`n"
Add-Content -Encoding UTF8 -path $ENV:GITHUB_STEP_SUMMARY -value "$($testResultsfailuresMD.Replace("\n","`n"))`n`n"
if ($bcptSummaryMD) {
Add-Content -Encoding UTF8 -path $ENV:GITHUB_STEP_SUMMARY -value "## Performance test results`n`n"
Add-Content -Encoding UTF8 -path $ENV:GITHUB_STEP_SUMMARY -value "$($bcptSummaryMD.Replace("\n","`n"))`n`n"
}
1 change: 1 addition & 0 deletions Actions/AnalyzeTests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ none
| :-- | :-: | :-- | :-- |
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
| project | Yes | Name of project to analyze or . if the repository is setup for single project | |
| testType | No | Which type of tests to analyze. Should be one of ('normal', 'bcpt', 'pageScripting') | normal |

## OUTPUT
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the action has output. OUTPUT variables might need to be cleaned up.


Expand Down
Loading
Loading