Skip to content

Output Azure DevOps Logging Commands in Passthru to help find failed tests and exceptions #1364

@o-o00o-o

Description

@o-o00o-o

1. General summary of the issue

We are running Pester as part of a Deploy Pipeline on Azure DevOps, in hundreds of tests if an issue happens in one, it is very difficult to find in full log output.

2. Describe Your Environment

Pester version : 4.8.1 C:\Users\myusername\OneDrive - Value Retail Plc\Documents\WindowsPowerShell\Modules\Pester\4.8.1\Pester.psd1
PowerShell version : 5.1.17763.592
OS version : Microsoft Windows NT 10.0.17763.0

3. Expected Behavior

Azure DevOps provides some help for this. https://docs.microsoft.com/en-us/azure/devops/pipelines/scripts/logging-commands?view=azure-devops&tabs=bash

If you write to the output with a tag

##vso[task.logissue]error/warning message

It will highlight this in red and make it easy to find.

4.Current Behavior

example log output I'm seeing today

Executing script C:\vstsagent\A1_work\r1\a_VegaDW-CI\Deployment Package\test\suites\character-test\v2\GL Forecast\FactGLBudgetBalance.Tests.ps1
2019-09-17T16:17:47.3761564Z
2019-09-17T16:17:47.3775598Z Describing GL Forecast
2019-09-17T16:17:47.4150045Z [+] should have the correct sql count value in dbo.FactGLBudgetBalance 69ms
2019-09-17T16:17:47.4931722Z [+] should have the correct sql values in dbo.FactGLBudgetBalance 78ms
2019-09-17T16:17:47.4996016Z VERBOSE: Connecting to server:
2019-09-17T16:17:47.5006349Z "Provider=MSOLAP;DataSource=asazure://westeurope.asazure.windows.net/weu0assrv0dev0vegadw01;Integrated
2019-09-17T16:17:47.5017659Z Security=ClaimsToken; Database="VR_BI_1864"; Connect Timeout=30; Connect Timeout=5"
2019-09-17T16:17:47.5340229Z [-] Should have the correct cube values - GL Forecast by ForecastType 36ms
2019-09-17T16:17:47.6117988Z ArgumentException: Authentication failed: User ID and Password are required when user interface is not available.
2019-09-17T16:17:47.6130509Z at , C:\vstsagent\A1_work\r1\a_VegaDW-CI\Deployment Package\test\suites\character-test\v2\GL Forecast\FactGLBudgetBalance.Tests.ps1: line 71

No colouring or anything in the output to distinguish errors from normal log output that the ##vso pattern would provide

5. Possible Solution

using ##vso tags as indicated above. Perhaps with a -ADO flag to ask pester inject the appropriate text at the beginning of the exception/failure stdout output?

Any other ideas on how I could make this happen as is or will it need a code change?

6. Context

It is often useful to see the details in the log rather than using the Log output.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions