Git/Get-TestObjectsForRepo.ps1
function Get-TestObjectsForRepo { Param( [Parameter(Mandatory=$true)] [string]$RepoPath, [Parameter(Mandatory=$false)] [bool]$IncludeStandardTests = $false, [Parameter(Mandatory=$false)] [string]$BaseBranchPath = '' ) $OutputFiles = @() $TestsDirectory = Create-TempDirectory #get the test libraries and test runner from corresponding base branch if ($BaseBranchPath -eq '') { $BaseBranchPath = Get-GitRepoBasePath -RepoPath $RepoPath } $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 if (Test-Path (Join-Path $RepoPath 'Tests')) { $Tests = Get-ChildItem (Join-Path $RepoPath 'Tests') foreach ($Test in $Tests) { [string]$TestsContent += Get-Content $Test.FullName -Raw } $TestsPath = Join-Path $TestsDirectory 'Tests.TXT' Add-Content $TestsPath -Value $TestsContent $OutputFiles += $TestsPath } $OutputFiles } Export-ModuleMember -Function Get-TestObjectsForRepo |