Skip to content

Instantly share code, notes, and snippets.

@RobWunderlich
Last active May 6, 2019 12:56
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save RobWunderlich/c9dbc34342c5e8d3a3ed52a82ec63c06 to your computer and use it in GitHub Desktop.
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