Closed SundarHubTest closed 1 year ago
text/xml
works fine and shows in the Cucumber report.
Currently, this will not show in the Courgette html report because only image/png
and text/html
are supported. I will have to update the code to also include text/xml
Example:
String xml = "<courgette>\n" +
"<heading>Courgette-JVM</heading>\n" +
"<body>Attach this XML to the Cucumber report</body>\n" +
"</courgette>";
scenario.attach(xml, "text/xml", scenario.getName());
Cucumber report
I will include this in the next release.
Thank you for the Quick response. Let me wait for the new release, with the above changes incorporated. Thanks.
This is now released in Courgette 6.6.0
.
You should be able to see the xml embedded in the Courgette html report.
Note that you will see the full xml in the Courgette report modal and not within a link. This is similar to the way in which xml is rendered in Cucumber reports.
I am trying to convert "XML" to byteArray and attach the same to Courgette-report ( like we attach image screenshot ). But I am not able achieve it. I have tried all the below option. Please have a look and guide us.
//method to convert the xml file to byteArray : public static byte[] writeXMLasByteArray(File xml) { byte[] byteArr = new byte[0]; try { byteArr = FileUtils.readFileToByteArray(xml); } catch (IOException e) { System.out.println("Exception thrown"); } return byteArr; }
//method to attach the (converted xml to byteAttary) to the courgette-report using "Scenario.attach(byteArray,mediatype,name) scenario.attach(writeXMLasByteArray(xml), "application/xml", "RequestXML"); - No error still, the xml not shown up in report scenario.attach(writeXMLasByteArray(xml), "charset=utf-8", "RequestXML"); - No error still, the xml not shown up in report scenario.attach(writeXMLasByteArray(xml), "text/xml", "RequestXML"); - No error still, the xml not shown up in report scenario.attach(writeXMLasByteArray(xml), "text/html", "RequestXML"); - No error and I able to see all XML values alone in the report.
I am expecting a link as "RequestXML" in the report, when i click, the full xml should display.