-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
VSTest task changes #2
Changes from 1 commit
a739056
303d97f
7da1a49
13020ef
a049319
4dbb7e5
d54e0be
20e5165
7737059
f4d912f
a082999
cdae2e8
efa798d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,13 +5,18 @@ param( | |
[string]$runSettingsFile, | ||
[string]$codeCoverageEnabled, | ||
[string]$pathtoCustomTestAdapters, | ||
[string]$otherConsoleOptions | ||
[string]$overrideTestrunParameters, | ||
[string]$otherConsoleOptions, | ||
[string]$platform, | ||
[string]$configuration | ||
) | ||
|
||
Write-Verbose "Entering script VSTestConsole.ps1" | ||
|
||
# Import the Task.Common dll that has all the cmdlets we need for Build | ||
import-module "Microsoft.TeamFoundation.DistributedTask.Task.Common" | ||
# Import the Task.TestResults dll that has the cmdlet we need for publishing results | ||
import-module "Microsoft.TeamFoundation.DistributedTask.Task.TestResults" | ||
|
||
if (!$testAssembly) | ||
{ | ||
|
@@ -38,9 +43,17 @@ if($testAssemblyFiles) | |
{ | ||
Write-Verbose "Calling Invoke-VSTest for all test assemblies" | ||
$timeline = Start-Timeline -Context $distributedTaskContext | ||
$cwd = Get-Location | ||
$projectName = Get-Variable -Context $distributedTaskContext -Name "System.TeamProject" | ||
$buildDir = Get-Variable -Context $distributedTaskContext -Name "Agent.BuildDirectory" -Global $FALSE | ||
$buildNumber = Get-Variable -Context $distributedTaskContext -Name "Build.BuildNumber" | ||
$buildUri = Get-Variable -Context $distributedTaskContext -Name "Build.BuildUri" | ||
$cwd = $buildDir+"\"+$projectName | ||
$testResultsDir = $buildDir+"\"+$projectName+"\"+"TestResults" | ||
$trxLocation = $buildDir+"\"+$projectName+"\"+"Temp" | ||
Write-Verbose "Calling Invoke-VSTest from working folder: $cwd" | ||
Invoke-VSTest -TestAssemblies $testAssemblyFiles -Timeline $timeline -VSTestVersion $vsTestVersion -TestFiltercriteria $testFiltercriteria -RunSettingsFile $runSettingsFile -PathtoCustomTestAdapters $pathtoCustomTestAdapters -CodeCoverageEnabled $codeCoverage -OtherConsoleOptions $otherConsoleOptions -WorkingFolder $cwd | ||
Invoke-VSTest -TestAssemblies $testAssemblyFiles -Timeline $timeline -VSTestVersion $vsTestVersion -TestFiltercriteria $testFiltercriteria -RunSettingsFile $runSettingsFile -PathtoCustomTestAdapters $pathtoCustomTestAdapters -CodeCoverageEnabled $codeCoverage -OverrideTestrunParameters $overrideTestrunParameters -OtherConsoleOptions $otherConsoleOptions -WorkingFolder $cwd -TestResultsDir $testResultsDir -ResultLocation $trxLocation | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you even populating the timeline anymore? I don't believe so and if not we should remove it. |
||
$connection = Get-VssConnection -TaskContext $distributedTaskContext | ||
Invoke-ResultPublisher -Connection $connection -ProjectName $projectName -ResultLocation $trxLocation -Extension "trx" -ReaderType "Trx" -BuildUri $buildUri -BuildNumber $buildNumber -Platform $platform -Configuration $configuration | ||
} | ||
else | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
"version": { | ||
"Major": 1, | ||
"Minor": 0, | ||
"Patch": 8 | ||
"Patch": 9 | ||
}, | ||
"demands": [ | ||
"vstest" | ||
|
@@ -37,30 +37,45 @@ | |
"required": false, | ||
"helpMarkDown": "Filter criteria for the tests." | ||
}, | ||
{ | ||
"name": "platform", | ||
"type": "string", | ||
"label": "Platform", | ||
"defaultValue":"", | ||
"required":false | ||
}, | ||
{ | ||
"name": "configuration", | ||
"type": "string", | ||
"label": "Configuration", | ||
"defaultValue":"", | ||
"required":false | ||
}, | ||
{ | ||
"name": "runSettingsFile", | ||
"type": "filePath", | ||
"type": "string", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you change this to a string? This should be a file path so I optionally get a picker and the infrastructure will automatically try to convert a relative path to a full path. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this should be a filePath |
||
"label": "Run Settings File", | ||
"defaultValue": "", | ||
"required": false, | ||
"helpMarkDown": "The run settings file to use." | ||
}, | ||
{ | ||
"name": "codeCoverageEnabled", | ||
"type": "boolean", | ||
"label": "Code Coverage Enabled", | ||
"defaultValue": "True", | ||
"required": false, | ||
"helpMarkDown": "Whether code coverage needs to be enabled." | ||
"helpMarkDown": "Path to runsettings file to use with the Tests. Use $(agent.BuildDirectory)\\$(system.teamProject) to access the Project folder" | ||
}, | ||
{ | ||
"name": "otherConsoleOptions", | ||
"name": "overrideTestrunParameters", | ||
"type": "string", | ||
"label": "Other console options", | ||
"label": "Override TestRun Parameters", | ||
"defaultValue": "", | ||
"required": false, | ||
"helpMarkDown": "Any other console options to be used." | ||
"helpMarkDown": "Override parameters defined in the TestRunParameters section of runsettings file. For example: Platform=$(platform);Port=8080" | ||
}, | ||
{ | ||
"name": "codeCoverageEnabled", | ||
"type": "boolean", | ||
"label": "Code Coverage Enabled", | ||
"defaultValue": "False", | ||
"required": false, | ||
"helpMarkDown": "Whether code coverage needs to be enabled.", | ||
"groupName":"advanced" | ||
}, | ||
{ | ||
"name": "vsTestVersion", | ||
"type": "pickList", | ||
|
@@ -82,6 +97,15 @@ | |
"required": false, | ||
"helpMarkDown": "Path to custom adapters.", | ||
"groupName":"advanced" | ||
}, | ||
{ | ||
"name": "otherConsoleOptions", | ||
"type": "string", | ||
"label": "Other console options", | ||
"defaultValue": "", | ||
"required": false, | ||
"helpMarkDown": "Other console options.", | ||
"groupName": "advanced" | ||
} | ||
], | ||
"instanceNameFormat": "Test Assemblies $(testAssembly)", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need project here BuildDir should be unique enough