0

我想检查编写另一个脚本的 MainFunction。

简而言之,我只想检查 mainfunctiona 的某些部分并返回纠缠。

param(
[int]$jobCardID = $(Throw '-jobCardID is required'),            # VSTS Job Card ID
[string]$filePath = $(Throw '-filePath is required'),           # Relative path to the file to test
[string]$step = $(Throw '-step is required'),                   # Step (verification / approval)
[string]$status = $null,                                        # Status (Approved / Rejected)
[string]$jenkinsJobID = $(Throw '-jenkinsJobID is required')    # Jenkins Job ID`enter code here`
)
$ScriptPath = Split-Path -parent $MyInvocation.MyCommand.Definition
Write-Output ("INFO: Script root path is {0}" -f $ScriptPath)
. "$ScriptPath\Helpers\Jenkins.ps1"
. "$ScriptPath\Helpers\MetaData.ps1"
. "$ScriptPath\Helpers\VSTS.ps1"
. "$ScriptPath\STA_AOI.ps1"

#region Variables Setup
$Passed = $true
$Errors = @()
$ManualCheck = @()
$ManualCheckNotRequired = $true
$SectionDelimiter = '{0}' -f ("-" * 112)
# End Variables Setup

函数中间部分的纠缠脚本。

 Context "checking internal metadata parameters" {
    #test1 start
    it "ScriptPath returns correct location as well as region scripts" {

        $Params = @{
            jobCardID = 9223
            filePath = '..\..\..\DataFiles\Test\Verification test\AOI\Staging\ctrPassTest.L5X'
            step = 'verification'
            status = ''
            jenkinsJobID = '321'
        }
        . ./Mainfunction.ps1 @Params #Can I put any condition here that will only allow to go up to 15 lines in actual function. 
        $ScriptPath | Should -be $PSScriptRoot
        "$ScriptPath\Helpers\Jenkins.ps1" | should -Exist
        "$ScriptPath\Helpers\MetaData.ps1" | should -Exist
        "$ScriptPath\Helpers\VSTS.ps1" | should -Exist
        "$ScriptPath\STA_AOI.ps1" | should -Exist
    } 

所以问题是我如何将我的进程从 mainfunction.ps1 第 14 行发送回测试函数以确认一些信息。我不想在 mainfunction 的第 14 行之后检查。

4

0 回答 0