Given the following script script.ps1:
function foo {
return $true
}
and the following (invalid) script.tests.ps1:
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
. "$here\scripts.ps1"
Describe "my tests" {
Context "my context" {
It "should do stuff" {
foo | should be $true
}
}
# note the misssing closing brace
When I run invoke-pester -OutputFile output.xml -outputFormat nunitxml, i get the following test xml file:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<test-results xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="nunit_schema_2.5.xsd" name="Pester" total="1" errors="0" failures="1" not-run="0" inconclusive="0" ignored="0" skipped="0" invalid="0" date="2016-02-05" time="16:46:46">
<environment user="matt" machine-name="XXX" cwd="C:\temp\" user-domain="XXX" platform="Microsoft Windows 7 Enterprise |C:\Windows|\Device\Harddisk0\Partition2" nunit-version="2.5.8.0" os-version="6.1.7601" clr-version="4.0.30319.42000" />
<culture-info current-culture="en-GB" current-uiculture="en-US" />
<test-suite type="Powershell" name="Pester" executed="True" result="Failure" success="False" time="0.0224" asserts="0">
<results>
<test-suite type="TestFixture" name="" executed="True" result="Failure" success="False" time="0.0224" asserts="0" description="">
<results>
<test-case description="Error occurred in test script 'C:\temp\scripts.Tests.ps1'" name=".Error occurred in test script 'C:\temp\scripts.Tests.ps1'" time="0.0224" asserts="0" success="False" result="Failure" executed="True">
<failure>
<message>At C:\temp\script.tests.ps1:4 char:21
+ Describe "my tests" {
+ ~
Missing closing '}' in statement block.
</message>
<stack-trace>at <ScriptBlock>, C:\Users\matt\Documents\WindowsPowerShell\Modules\Pester\Pester.psm1: line 199</stack-trace>
</failure>
</test-case>
</results>
</test-suite>
</results>
</test-suite>
</test-results>
Note that the attribute //test-results/test-suite/results/test-suite/@name is empty. This value is populated when the test file is valid.
This appears to cause issues with TeamCity importing the xml, as it doesn't have a valid test suite name.
Given the following script
script.ps1:and the following (invalid)
script.tests.ps1:When I run
invoke-pester -OutputFile output.xml -outputFormat nunitxml, i get the following test xml file:Note that the attribute
//test-results/test-suite/results/test-suite/@nameis empty. This value is populated when the test file is valid.This appears to cause issues with TeamCity importing the xml, as it doesn't have a valid test suite name.