Example: Running a test suite

This example shows how to run a test suite using the BiG EVAL PowerShell module. It also shows how to get the detailed test results when the suite run completed.

$suiteId = 1
$serverUrl = "https://lt001.bigeval.com/"
$clientId = "f85eb6171a4e077b56022e892e5cd941"
$clientSecret = "83b29028cd7e4a8392b861462b62d038"

# Stop the script whenever an error occures.
$ErrorActionPreference = "Stop"

# Connect to BiG EVAL server
Write-Host -NoNewline "Connecting to BiG EVAL instance... "
$connection = Connect-BeInstance -ServerUrl $serverUrl -ClientId $clientId -ClientSecret $clientSecret
Write-Host "Success"

# 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

# Get statistics about the last Suite-Run
$runStats = Get-BeSuiteRunStatistics -SuiteId $suiteId -Take 1 -Connection $connection
$runStat = $runStats.items[0]
$lastRunId = $runStats.items[0].runId #store ID of the last run.

# Write some statistics about the last run to the console
Write-Host ("Run-ID:           " + $runStat.runId)
Write-Host ("Tests run:        " + $runStat.totalCount)
Write-Host ("Tests succeeded:  " + $runStat.succeededCount)
Write-Host ("Tests failed:     " + $runStat.failedCount)
Write-Host ("Tests excepted:   " + $runStat.exceptionsCount)
Write-Host ("Success-Rate:     " + ($runStat.succeededCount / $runStat.totalCount * 100) + "%")

# Get detailed testresults of the last Suite-Run
$testresults = Get-BeTestresults -RunId $lastRunId -Take 100 -Connection $connection
$testresults

# Get detailed testresults of one specific test of the last Suite-Run
$testresults = Get-BeTestresults -RunId $lastRunId -Search "#15" -Take 1 -Connection $connection
$testresults
Table of Contents