在Powershell中从一个脚本移动到另一个脚本的过程

时间:2019-02-06 02:36:48

标签: powershell pester powershell-v5.1

我要检查是否编写其他脚本的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

函数中间部分的Pester脚本。

 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行之后检查。

0 个答案:

没有答案