Процесс перехода от одного скрипта к другому в PowerShell - PullRequest
0 голосов
/ 06 февраля 2019

MainFunction, которую я хочу проверить при написании другого скрипта.

Короче говоря, я просто хочу проверить определенную часть mainfunctiona и вернуться к pester.

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 script для серединычасть функции.

 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
    } 

Итак, вопрос в том, как я могу отправить свой процесс из строки 14 mainfunction.ps1 обратно в тестовую функцию, чтобы подтвердить некоторую информацию.Я не хочу проверять после строки 14 в mainfunction.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...