Branches/Get-TestObjectsForBranch.ps1
function Get-TestObjectsForBranch { Param( [Parameter(Mandatory=$true)] [string]$BranchPath, [Parameter(Mandatory=$false)] [bool]$IncludeStandardTests = $false ) $OutputFiles = @() $TestsDirectory = Create-TempDirectory #get the test libraries and test runner from corresponding base branch $BaseBranchPath = Get-BaseBranchForBranch -BranchPath $BranchPath $TestsPath = Join-Path $BaseBranchPath 'Tests' $Tests = Invoke-TFSAPI -Url "_apis/tfvc/items?scopePath=$TestsPath&recursionLevel=Full" foreach ($Test in $Tests.value) { if (!$Test.isFolder) { if ((($Test.path.Contains('TestCodeunits')) -and $IncludeStandardTests) -or (!$Test.path.Contains('TestCodeunits'))) { Get-ObjectsFromTFSBranch -BranchPath $Test.path -DestinationPath (Join-Path $TestsDirectory (Split-Path $Test.path -Leaf)) -Type File $OutputFiles += (Join-Path $TestsDirectory (Split-Path $Test.path -Leaf)) } } } #custom tests $TestsPaths = '{0},{1}' -f (Join-Path (Split-Path $BranchPath -Parent) 'Tests'), (Join-Path $BranchPath 'Tests') $TestsPaths = $TestsPaths.Split(',') foreach ($TestsPath in $TestsPaths) { $Tests = Invoke-TFSAPI -Url "_apis/tfvc/items?scopePath=$TestsPath&recursionLevel=Full" foreach ($Test in $Tests.value) { if (!$Test.isFolder) { $TestsContent += Invoke-TFSAPI $Test.url } } } $TestsPath = Join-Path $TestsDirectory 'Tests.TXT' Add-Content $TestsPath -Value $TestsContent $OutputFiles += $TestsPath $OutputFiles } Export-ModuleMember -Function Get-TestObjectsForBranch |