question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support `[[ATTACHMENT|path/to/file]]`?

See original GitHub issue

Please support the Attachment pattern:

<system-out>
....
[[ATTACHMENT|/absolute/path/to/some/file]]
....
</system-out>

(see Jenkins or MSDN Forums)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
pavel-kolesnikovcommented, Jul 25, 2021

any links generated would have to be in cooperation of the webserver hosting the junit html

The simplest way is to make href or src of a link in report be exactly equal to ATTACHMENT value (URLencoded, though). And that attachment value could be relative path to report file. Relative path works well for both local path and Web scenario. It is the junit2html user’s duty to make the attachment available for the web server on that path.

So, that algorithm is such:

  • [test author] writes a file to the path relative to the XML report. E.g. logs/test-11111.log and shots/shot-01.png.
  • [test author] writes [[ATTACHMENT|logs/test-11111.log]] to the test’s stdout. Now we have it in our report.
  • [junit2html user] calls junit2html to make HTML report from XML.
  • [junit2html] sees [[ATTACHMENT|.....]] and checks file’s MIME type.
    • if MIME type is image/* the <img src= is used.
    • if MIME type is video/* the <video src= is used.
    • if MIME type is something other <a href= is used.
  • [junit2html user] copies converted HTML report and all the files around it (with logs/test-11111.log included) to some location served by HTTP server, like /www/reports/my-great-product/unique-test-id.
  • [HTTP server] serves HTML report from (lets say) https://reports.local
    • The url of the example report then will be https://reports.local/my-great-product/unique-test-id/report.html (or even index.html, but that is easily achieved outside of junit2html)
    • There are <img src="shots/shot-01.png"> and <a href="logs/test-11111.log"/>logs/test-11111.log</a> in the report. They still works cause they’re relative to the report’s file.

Other scenarios could be achieved by the [test author] as (s)he knows how the report server works and change [[ATTACHMENT|....]] text accordingly.

0reactions
inortoncommented, Nov 23, 2021

Hi @BenjaminLaschkar This seems to be a feature of a jenkins plugin rather than part of the junit spec.

I don’t think I will include this into junit2html.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Service Desk createAttachment API? - SolarWinds THWACK
We have an important requirement to include attachment during creating new incident using Service Desk REST APIs. I was able to execute createIncident...
Read more >
Using HTTP POST action with Samanage API
I am trying to attach a file to an incident in Samange using the generic HTTP action. Samanage's API documentation to do this...
Read more >
Unable to create a ticket with attachment New-JiraIssue #336
I'm trying to create a new JIRA issue with a required field of attachment. No matter how I format it I've been unable...
Read more >
WireMail::attachment() method - ProcessWire API
Multiple calls will append attachments. To remove the supplied attachments, specify NULL as the value. Attachments may or may not be supported by...
Read more >
SolarWinds ITSM API - Service Desk
SolarWinds Service Desk API (0.2.2) · General Concepts · Incident · Problem · Change · Change Catalog · Change Request · Release.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found