diff --git a/Tasks/QuickPerfTest/task.json b/Tasks/QuickPerfTest/task.json index 376994cd4431..914bde0b3e0f 100644 --- a/Tasks/QuickPerfTest/task.json +++ b/Tasks/QuickPerfTest/task.json @@ -3,7 +3,7 @@ "name": "QuickPerfTest", "friendlyName": "Cloud-based Web Performance Test", "description": "Runs a quick web performance test in the cloud with Visual Studio Team Services", - "helpMarkDown": "Triggers a cloud-based load test using Visual Studio Team Services. [Learn more](https://go.microsoft.com/fwlink/?linkid=613203).", + "helpMarkDown": "Triggers a cloud-based load test using Visual Studio Team Services. [Learn more](https://go.microsoft.com/fwlink/?linkid=613203)", "category": "Test", "visibility": [ "Build", @@ -13,7 +13,7 @@ "version": { "Major": 1, "Minor": 0, - "Patch": 21 + "Patch": 22 }, "demands": [ "msbuild", @@ -78,7 +78,7 @@ "type": "pickList", "label": "Load Location", "required": false, - "helpMarkDown": "Geographical region to generate the load from. See help for more details.", + "helpMarkDown": "Geographical region to generate the load from.", "defaultValue": "Default", "options": { "Default": "Default", diff --git a/Tasks/RunJMeterLoadTest/task.json b/Tasks/RunJMeterLoadTest/task.json index c6aec1a36db6..fa3b9fa4ba0e 100644 --- a/Tasks/RunJMeterLoadTest/task.json +++ b/Tasks/RunJMeterLoadTest/task.json @@ -3,7 +3,7 @@ "name": "ApacheJMeterLoadTest", "friendlyName": "Cloud-based Apache JMeter Load Test", "description": "Runs the Apache JMeter load test in cloud", - "helpMarkDown": "This task can be used to trigger an Apache JMeter load test in cloud using Visual Studio Team Services. [Learn more](https://go.microsoft.com/fwlink/?LinkId=784929).", + "helpMarkDown": "This task can be used to trigger an Apache JMeter load test in cloud using Visual Studio Team Services. [Learn more](https://go.microsoft.com/fwlink/?LinkId=784929)", "category": "Test", "visibility": [ "Build", @@ -13,7 +13,7 @@ "version": { "Major": 1, "Minor": 0, - "Patch": 12 + "Patch": 13 }, "demands": [ "azureps" diff --git a/Tasks/RunLoadTest/CltTasksUtility.ps1 b/Tasks/RunLoadTest/CltTasksUtility.ps1 index a6e0eeacea73..df0b12c29f05 100644 --- a/Tasks/RunLoadTest/CltTasksUtility.ps1 +++ b/Tasks/RunLoadTest/CltTasksUtility.ps1 @@ -127,7 +127,7 @@ function ComposeAccountUrl($connectedServiceUrl, $headers) #Load all dependent files for execution . $PSScriptRoot/VssConnectionHelper.ps1 $connectedServiceUrl = $connectedServiceUrl.TrimEnd('/') - Write-Host "Getting Clt Endpoint:" + Write-Host -NoNewline "Getting Clt Endpoint:" $elsUrl = Get-CltEndpoint $connectedServiceUrl $headers return $elsUrl @@ -149,34 +149,74 @@ function isNumericValue ($str) { return $isNum } -function ValidateFiles($inputName, $fileName) +function ValidateFiles($inputName, $loadtestDrop, $fileName, $testSettings) { - $file = Get-ChildItem -Path $TestDrop -recurse | where {$_.Name -eq $fileName} | Select -First 1 - if ($file) + # Upgrade scenario start.. + if (-Not([System.IO.Path]::IsPathRooted($loadtestDrop))) { - # Check for fileName - $global:ScopedTestDrop = $file.Directory.FullName - Write-Host -NoNewline ("Selected {0} is '{1}' under '{2}'" -f $inputName, $file.FullName, $global:ScopedTestDrop) + $loadtestDrop=[System.IO.Path]::Combine($env:SYSTEM_DEFAULTWORKINGDIRECTORY,$loadtestDrop); + Write-Host -NoNewline "Updated test drop location is $loadtestDrop"; + + if (-Not([string]::IsNullOrWhiteSpace($testSettings)) -and + -Not([System.IO.Path]::IsPathRooted($testSettings))) + { + $testSettings=[System.IO.Path]::Combine($env:SYSTEM_DEFAULTWORKINGDIRECTORY,$testSettings); + Write-Host -NoNewline "Updated test settings file is $testSettings"; + } } - else + # Upgrade scenario end.. + + # Validate if the drop folder location is correct... + if (-Not (Test-Path $loadtestDrop)) { - ErrorMessage "No $inputName is present in the test drop." + ErrorMessage "The path for the load test files $loadtestDrop does not exist. Please provide a valid path." } -} -function ValidateInputs($tfsCollectionUrl, $connectedServiceName, $testSettings, $testDrop, $loadtest) -{ - if (-Not (Test-Path $testSettings)) + $loadRunTestSettingsFile = $testSettings; + $file = Get-ChildItem -Path $loadtestDrop -recurse | Where-Object {$_.Name -eq $fileName} | Select-Object -First 1 + if ($file) { - ErrorMessage "The path for the test settings file does not exist. Please provide a valid path." - } + # Check for fileName + $global:ScopedTestDrop = $file.Directory.FullName; + $global:RunTestSettingsFile = ""; + Write-Host -NoNewline ("Selected load test file is '{0}' under '{1}'" -f $file.FullName, $global:ScopedTestDrop) + Write-Host -NoNewline "Test Drop location used for the run is $global:ScopedTestDrop. Please ensure all required files (test dlls, plugin dlls, dependent files) are part of this output folder" + if ([string]::IsNullOrWhiteSpace($loadRunTestSettingsFile)) + { + Write-Host -NoNewline "No test settings file specified"; + return; + } + + if (-Not (Test-Path $loadRunTestSettingsFile)) + { + Write-Host -NoNewline "The path for the test settings file $loadRunTestSettingsFile does not exist" + if (-Not([System.IO.Path]::IsPathRooted($loadRunTestSettingsFile))) + { + $loadRunTestSettingsFile = [System.IO.Path]::Combine($global:ScopedTestDrop, [System.IO.Path]::GetFileName($loadRunTestSettingsFile)); + Write-Host -NoNewline "Checking for test settings file $loadRunTestSettingsFile in the drop location" + } + + if (Test-Path $loadRunTestSettingsFile) + { + Write-Host -NoNewline "Test settings file $loadRunTestSettingsFile found in the drop location" + } + else + { + ErrorMessage "TestSettings file $loadRunTestSettingsFile not found" + } + } - if (-Not (Test-Path $testDrop)) + $global:RunTestSettingsFile = $loadRunTestSettingsFile; + } + else { - ErrorMessage "The path for the load test files does not exist. Please provide a valid path." + ErrorMessage "LoadTest file $inputName is not present in the test drop." } +} - ValidateFiles "load test file" $loadTest +function ValidateInputs($tfsCollectionUrl, $connectedServiceName, $testSettings, $loadtestDrop, $loadtest) +{ + ValidateFiles "load test file" $loadtestDrop $loadTest $testSettings } function Get($headers, $uri) @@ -226,7 +266,7 @@ function StopTestRun($headers, $run, $CltAccountUrl) { $stop = @" { - "state": "aborted" + "state": "aborted" } "@ $uri = [String]::Format("{0}/_apis/clt/testruns/{1}?{2}", $CltAccountUrl, $run.id, $global:apiVersion) @@ -238,22 +278,30 @@ function StopTestRun($headers, $run, $CltAccountUrl) function ComposeTestRunJson($name, $tdid, $machineType) { - $processPlatform = "x86" + $processPlatform = "x64" $setupScript="" $cleanupScript="" - [xml]$tsxml = Get-Content $TestSettings - if ($tsxml.TestSettings.Scripts.setupScript) - { - $setupScript = [System.IO.Path]::GetFileName($tsxml.TestSettings.Scripts.setupScript) - } - if ($tsxml.TestSettings.Scripts.cleanupScript) + if (-Not([string]::IsNullOrWhiteSpace($global:RunTestSettingsFile))) { - $cleanupScript = [System.IO.Path]::GetFileName($tsxml.TestSettings.Scripts.cleanupScript) - } - if ($tsxml.TestSettings.Execution.hostProcessPlatform) - { - $processPlatform = $tsxml.TestSettings.Execution.hostProcessPlatform + [xml]$tsxml = Get-Content $global:RunTestSettingsFile + if ($tsxml.TestSettings.Scripts.setupScript) + { + $setupScript = [System.IO.Path]::GetFileName($tsxml.TestSettings.Scripts.setupScript) + Write-Host -NoNewline "RunSettings SetupScript : $setupScript" + } + + if ($tsxml.TestSettings.Scripts.cleanupScript) + { + $cleanupScript = [System.IO.Path]::GetFileName($tsxml.TestSettings.Scripts.cleanupScript) + Write-Host -NoNewline "RunSettings CleanupScript : $cleanupScript" + } + + if ($tsxml.TestSettings.Execution.hostProcessPlatform) + { + $processPlatform = $tsxml.TestSettings.Execution.hostProcessPlatform + Write-Host -NoNewline "RunSettings ProcessPlatform : $cleanupScript" + } } $trjson = @" diff --git a/Tasks/RunLoadTest/Start-CloudLoadTest.ps1 b/Tasks/RunLoadTest/Start-CloudLoadTest.ps1 index 90852640631f..c447eeaf2cb8 100644 --- a/Tasks/RunLoadTest/Start-CloudLoadTest.ps1 +++ b/Tasks/RunLoadTest/Start-CloudLoadTest.ps1 @@ -9,7 +9,7 @@ $env:BUILD_BUILDID, [String] [Parameter(Mandatory = $false)] $connectedServiceName, -[String] [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] +[String] [Parameter(Mandatory = $false)] $TestSettings, [String] [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] $TestDrop, @@ -24,6 +24,7 @@ $MachineType $global:userAgent = "CloudLoadTestBuildTask" $global:apiVersion = "api-version=1.0" $global:ScopedTestDrop = $TestDrop +$global:RunTestSettingsFile = $TestSettings $ThresholdExceeded = $false $MonitorThresholds = $false @@ -74,14 +75,14 @@ import-module "Microsoft.TeamFoundation.DistributedTask.Task.Common" import-module "Microsoft.TeamFoundation.DistributedTask.Task.DTA" import-module "Microsoft.TeamFoundation.DistributedTask.Task.DevTestLabs" -Write-Output "Test settings = $testSettings" -Write-Output "Test drop = $testDrop" -Write-Output "Load test = $loadTest" -Write-Output "Load generator machine type = $machineType" +Write-Output "Test settings = $TestSettings" +Write-Output "Test drop = $TestDrop" +Write-Output "Load test = $LoadTest" +Write-Output "Load generator machine type = $MachineType" Write-Output "Run source identifier = build/$env:SYSTEM_DEFINITIONID/$env:BUILD_BUILDID" #Validate Input -ValidateInputs $env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI $connectedServiceName $testSettings $testDrop $loadTest +ValidateInputs $env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI $connectedServiceName $TestSettings $TestDrop $LoadTest #Setting monitoring of Threshold rule appropriately if ($ThresholdLimit -and $ThresholdLimit -ge 0) diff --git a/Tasks/RunLoadTest/Strings/resources.resjson/en-US/resources.resjson b/Tasks/RunLoadTest/Strings/resources.resjson/en-US/resources.resjson index 9b70f1f7e60f..5bf8f9d26ada 100644 --- a/Tasks/RunLoadTest/Strings/resources.resjson/en-US/resources.resjson +++ b/Tasks/RunLoadTest/Strings/resources.resjson/en-US/resources.resjson @@ -1,16 +1,16 @@ { "loc.friendlyName": "Cloud-based Load Test", - "loc.helpMarkDown": "This task triggers a cloud-based load test using Visual Studio Team Services. [Learn more](https://go.microsoft.com/fwlink/?linkid=546976).", + "loc.helpMarkDown": "This task triggers a cloud-based load test using Visual Studio Team Services. [Learn more](https://go.microsoft.com/fwlink/?linkid=546976)", "loc.description": "Runs the load test in the cloud with Visual Studio Team Services", "loc.instanceNameFormat": "Cloud Load Test $(LoadTest)", "loc.input.label.connectedServiceName": "VS Team Services Connection", "loc.input.help.connectedServiceName": "Select a previously registered service connection to talk to the cloud-based load test service. Choose 'Manage' to register a new connection.", - "loc.input.label.TestSettings": "Test settings file", - "loc.input.help.TestSettings": "Relative path from repo root for the test settings file to use for the load test.", "loc.input.label.TestDrop": "Load test files folder", - "loc.input.help.TestDrop": "Relative path from repo root where the load test solution build output will be available.", + "loc.input.help.TestDrop": "Output path where the load test and supporting files including plugins and data files are available. ", "loc.input.label.LoadTest": "Load test file", - "loc.input.help.LoadTest": "The load test filename to be used under the load test folder specified above.", + "loc.input.help.LoadTest": "The load test filename to be used from the load test files folder specified.", + "loc.input.label.TestSettings": "Test settings file", + "loc.input.help.TestSettings": "The testsettings file name to be used from the load test folder specifed above or a full path. ", "loc.input.label.ThresholdLimit": "Number of permissible threshold violations", "loc.input.help.ThresholdLimit": "Number of threshold violations above which the load test outcome is considered unsuccessful.", "loc.input.label.MachineType": "Run load test using" diff --git a/Tasks/RunLoadTest/VssConnectionHelper.ps1 b/Tasks/RunLoadTest/VssConnectionHelper.ps1 index 06cb56d398a4..65ce0047c796 100644 --- a/Tasks/RunLoadTest/VssConnectionHelper.ps1 +++ b/Tasks/RunLoadTest/VssConnectionHelper.ps1 @@ -3,7 +3,7 @@ function Get-CltEndpoint($connectedServiceUrl, $headers) # Load all dependent files for execution . $PSScriptRoot/CltTasksUtility.ps1 $vsoUrl = $connectedServiceUrl - Write-Host "Fetching the Clt endpoint for $vsoUrl" + Write-Host -NoNewline "Fetching the Clt endpoint for $vsoUrl" $spsLocation = Get-SpsLocation $vsoUrl $headers $cltLocation = Get-CltLocation $spsLocation $headers return $cltLocation @@ -12,7 +12,7 @@ function Get-CltEndpoint($connectedServiceUrl, $headers) function Get-SpsLocation($vsoUrl, $headers) { - Write-Host "Fetching the SPS endpoint for $vsoUrl" + Write-Host -NoNewline "Fetching the SPS endpoint for $vsoUrl" $spsUniqueIdentifier = "951917AC-A960-4999-8464-E3F0AA25B381" $spsLocation = Get-ServiceLocation $vsoUrl $headers $spsUniqueIdentifier return $spsLocation @@ -20,7 +20,7 @@ function Get-SpsLocation($vsoUrl, $headers) function Get-CltLocation($spsUrl, $headers) { - Write-Host "Fetching the CLT endpoint for $vsoUrl" + Write-Host -NoNewline "Fetching the CLT endpoint for $vsoUrl" $cltUniqueIdentifier = "6C404D78-EF65-4E65-8B6A-DF19D6361EAE" return Get-ServiceLocation $spsUrl $headers $cltUniqueIdentifier } @@ -35,5 +35,6 @@ function Get-ServiceLocation($baseUrl, $headers, $serviceUniqueIdentifier) { return $locationCallJsonResponse.locationMappings.location|Select -First 1 } + return $null } \ No newline at end of file diff --git a/Tasks/RunLoadTest/task.json b/Tasks/RunLoadTest/task.json index e80d41474fa0..ef7a6297eca8 100644 --- a/Tasks/RunLoadTest/task.json +++ b/Tasks/RunLoadTest/task.json @@ -3,7 +3,7 @@ "name": "CloudLoadTest", "friendlyName": "Cloud-based Load Test", "description": "Runs the load test in the cloud with Visual Studio Team Services", - "helpMarkDown": "This task triggers a cloud-based load test using Visual Studio Team Services. [Learn more](https://go.microsoft.com/fwlink/?linkid=546976).", + "helpMarkDown": "This task triggers a cloud-based load test using Visual Studio Team Services. [Learn more](https://go.microsoft.com/fwlink/?linkid=546976)", "category": "Test", "visibility": [ "Build", @@ -13,7 +13,7 @@ "version": { "Major": 1, "Minor": 0, - "Patch": 18 + "Patch": 19 }, "demands": [ "msbuild", @@ -28,21 +28,13 @@ "defaultValue": "", "helpMarkDown": "Select a previously registered service connection to talk to the cloud-based load test service. Choose 'Manage' to register a new connection." }, - { - "name": "TestSettings", - "type": "filePath", - "label": "Test settings file", - "defaultValue": "", - "required": true, - "helpMarkDown": "Relative path from repo root for the test settings file to use for the load test." - }, { "name": "TestDrop", - "type": "filePath", + "type": "string", "label": "Load test files folder", - "defaultValue": "", + "defaultValue": "$(System.DefaultWorkingDirectory)", "required": true, - "helpMarkDown": "Relative path from repo root where the load test solution build output will be available." + "helpMarkDown": "Output path where the load test and supporting files including plugins and data files are available. " }, { "name": "LoadTest", @@ -50,7 +42,15 @@ "label": "Load test file", "defaultValue": "", "required": true, - "helpMarkDown": "The load test filename to be used under the load test folder specified above." + "helpMarkDown": "The load test filename to be used from the load test files folder specified." + }, + { + "name": "TestSettings", + "type": "string", + "label": "Test settings file", + "defaultValue": "", + "required": false, + "helpMarkDown": "The testsettings file name to be used from the load test folder specifed above or a full path. " }, { "name": "ThresholdLimit", diff --git a/Tasks/RunLoadTest/task.loc.json b/Tasks/RunLoadTest/task.loc.json index 312509014f6b..4c06942f0d49 100644 --- a/Tasks/RunLoadTest/task.loc.json +++ b/Tasks/RunLoadTest/task.loc.json @@ -13,7 +13,7 @@ "version": { "Major": 1, "Minor": 0, - "Patch": 18 + "Patch": 19 }, "demands": [ "msbuild", @@ -28,19 +28,11 @@ "defaultValue": "", "helpMarkDown": "ms-resource:loc.input.help.connectedServiceName" }, - { - "name": "TestSettings", - "type": "filePath", - "label": "ms-resource:loc.input.label.TestSettings", - "defaultValue": "", - "required": true, - "helpMarkDown": "ms-resource:loc.input.help.TestSettings" - }, { "name": "TestDrop", - "type": "filePath", + "type": "string", "label": "ms-resource:loc.input.label.TestDrop", - "defaultValue": "", + "defaultValue": "$(System.DefaultWorkingDirectory)", "required": true, "helpMarkDown": "ms-resource:loc.input.help.TestDrop" }, @@ -52,6 +44,14 @@ "required": true, "helpMarkDown": "ms-resource:loc.input.help.LoadTest" }, + { + "name": "TestSettings", + "type": "string", + "label": "ms-resource:loc.input.label.TestSettings", + "defaultValue": "", + "required": false, + "helpMarkDown": "ms-resource:loc.input.help.TestSettings" + }, { "name": "ThresholdLimit", "type": "string",