Wait-BeJob

Waits until a job reaches a completion status.

Wait-BeJob
    -Connection <Connection>
    -JobId <String>
    [-Timeout <Timespan>]

Description

The Wait-BeJob cmdlet blocks the script until a specific BiG EVAL job reaches a completion state (Failed, Succeeded or Canceled) or until the timeout gets reached.

Example

The following example shows how to run a test suite, return its job ID and wait for job completion.

$suiteId = 1

# Start suite
Write-Host -NoNewline "Starting suite run... "
$startSuiteResult = Start-BeSuiteRun -Connection $connection -SuiteId $suiteId
$jobId = $startSuiteResult.jobId
Write-Host "Done (Job-ID: $jobId)"

# Wait until the job has finished
Write-Host -NoNewline "Waiting until the job completes... "
$waitResult = Wait-BeJob -JobId $jobId -Timeout (New-TimeSpan -Minutes 15) -Connection $connection
Write-Host $waitResult.Status

Parameters

-Connection

Pass the connection-object returned by the Connect-BeInstance cmdlet.

Type:Connection
Mandatory:Yes
Position:Named
Default Value:None

-JobId

The ID of the job.

Type:String
Mandatory:Yes
Position:Named
Default Value:None

-Timeout

The amount of time the cmdlet waits. If that timeout expires, the command failes by throwing an exception.

Type:Timespan
Mandatory:No
Position:Named
Default Value:15 minutes

Output

The cmdlet outputs a Job-object that contains the following attributes.

NameData TypeDescription
JobIdStringThe ID of the job.
StatusStringThe current status of the job. This can be one of the following values:
– New
– Queued
– Running
– Succeeded
– Failed
– Canceled
MessageStringDepending on the outcome of the job, there may be a message like an error message. This attribute can also be empty.
Table of Contents