powershell script to run Qlik Sense Scalability tool regression scenario and analyzer
#=== Configure the following variables for your environment ==== | |
# Directory where scenario json files are found | |
$scenarioDir="C:\QS-ScalabilityTools\scenario" | |
# Root directory of the QS Scalability tools | |
$scalabilityToolsDir = "C:\QS-scalabilitytools-5.0.0" | |
# SDK Exerciser version to use -- it's a subdirectory of SDKExerciser directory. | |
$SDKExerciserVersion = "Jun2018" | |
#=== End of local environment configuration === | |
$app = $args[0].trim() | |
#Relative paths don't work well in all contexts with these utilties. Set up absolute paths. | |
try { | |
# Location of this script | |
$scriptRoot = $PSScriptRoot | |
$tempDir = "$scriptRoot\temp" | |
Remove-Item -Path "$tempDir" -Filter *.* -Recurse | Out-Null | |
new-item -path $scriptRoot -name temp -itemtype directory | Out-Null | |
} | |
catch { | |
Write-Output "Terminating due to error: $_" | |
exit -1 | |
} | |
$scenario="$scenarioDir\$app.json" | |
#Baseline file should be here | |
$baselineDir = "$scriptRoot\baseline" | |
$resultsDir = "$tempDir\results" | |
$stdout = "$tempDir\stdout.txt" | |
$sdkout = "$tempDir\sdkout.txt" | |
#Run the Scenario to generate new compare file | |
$exerciserExe = "$scalabilityToolsDir\SDKExerciser\$SDKExerciserVersion\SDKExerciserConsole.exe" | |
&$exerciserExe "config=$scenario" "LogDir=$resultsDir" *> $sdkout | |
# Get the baseline filename | |
$baselineFile = Get-ChildItem -Path $baselineDir -Filter ($app + "*.log") | Select-Object FullName | ForEach-Object {$_.FullName} | |
#Get the compare filename | |
$compareFile = Get-ChildItem -Path $resultsDir -Filter ($app + "*.log") | Select-Object FullName | ForEach-Object {$_.FullName} | |
# Run RegressionAnalyzerConsole to compare baseline and compare output | |
Write-Output "Comparing $compareFile" | |
Write-Output "to baseline: $baselineFile" | |
$compareExe = "$scalabilityToolsDir\lib\RegressionAnalyzerConsole.exe" | |
&$compareExe "$baselineFile" "$compareFile" *> $stdout | |
# Parse the RegressionAnalyzerConsole output to determine if any differences were detected. | |
if (Select-String -LiteralPath $stdout -Pattern "diff detected" -SimpleMatch -Quiet) { | |
Write-Output "Differences found" | |
exit 1 | |
} | |
else { | |
Write-Output "No differences found" | |
exit 0 | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment