Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publishing Test Results in Azure Pipelines gives invalid character error #99

Open
Divya1388 opened this issue Nov 19, 2019 · 3 comments

Comments

@Divya1388
Copy link

Configured a pipeline to test and publish results. The test is scripted to test a terraform Plan output.
when running the tasks:
go get -u github.com/jstemmer/go-junit-report
go test -v -timeout 60m 2>&1 | go-junit-report > report.xml
and Publish test results
The pipline passes but the publish test result task give the following error
##[warning]Failed to read D:\a\1\go\src\s***\CentralUS\Global\VirtualNetwork\test\report.xml. Error : '.', hexadecimal value 0x00, is an invalid character. Line 2, position 1..
No build level attachments to publish.
Finishing: Publish Test Results D:\a\1\go\src\s**\report.xml

@Divya1388
Copy link
Author

The Publish test results throws error on Windows agent with Error : '.', hexadecimal value 0x00, is an invalid character. Line 2, position 1..
It does not give error on Linux agent

@divyanshidm
Copy link

Hi, I am facing the same issue. Did you find a solution to this?

@jsoconno
Copy link

I was able to resolve this with something like the following:

<code here to generate the report in the wrong encoding>
Get-Content report.xml -Encoding Unicode | Set-Content -Encoding UTF8 report_utf8.xml

I had to do a similar thing when using Terratest and the terratest_log_parser on Windows:

go test -v -timeout 60m | tee -Variable content
$content | Set-Content -Encoding utf8 test_output.log
terratest_log_parser -testlog test_output.log -outputdir test_output

I don't have the same problem when running these commands on Linux:

go test -v -timeout 30m | tee test_output.log
terratest_log_parser -testlog test_output.log -outputdir test_output

Of course, you would then use the PublishTestResults@2 Azure DevOps task to publish targeting the properly encoded output file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants