Closed heilwood closed 5 years ago
@heilwood please try static ReportPortal.Shared.Log
class.
@nvborisenko Like that should work? currently i'm receiving only bytes in reportportal logs
byte[] imgdata = System.IO.File.ReadAllBytes(new
ScreenshotHelper(_driver,CurrentScenarioContext).GetScreenshotPath());
ReportPortal.Shared.Log.Message(new AddLogItemRequest
{
Text = "Screenshot",
Time = DateTime.UtcNow,
Attach = new Attach("Image", "image/png", imgdata),
Level = LogLevel.Info
});
Should work, just try.
@nvborisenko in reportportal i dont see attachments, just this message:
2019-06-16 13:20:19 -> {"Attach":{"Data":[137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,7,128,0,0,4,56,8,6,0,0,0,232,211,193,67,0,0,0,4,103,65,77,65,0,0,177,143,11,252,97,5,0,0,0,9,112,72,89,115,0,0,14,195,0,0,14,195,1,199,111,168,100,0,0,255,178,73,68,65,84,120,94,236,189,7,124,93,103,125,184,239,31,165,45,109,161,165,109,90,210,95,233,191,105,75,147,64,40,9,97,7,250,11,144,50,10,20,40,27,66,105,160,197,141,227,20,147,237,56,195,113,226,196,78,226,36,78,108,39,150,100,201,26,150,108,89,30,178,229,189,229,189,247,148,135,188,247,94,26,30,223,255,249,158,123,95,233,189,71,239,185,62,146,174,172,43,221,231,249,124,158,143,116,207,190,231,28,41,160,199,239,185,93,164,184,139,32,34,34,34,34,34,34,34,34,34,34,34,34,98,7,19,192,1,1,24,17,17,17,17,17,17,17,17,17,17,17,17,177,35,10,224,128,0,140,136,136,136,136,136,136,136,136,136,136,136,136,216,17,5,112,64,0,70,68,68,68,68,68,68,68,68,68,68,68,68,236,136,2,56,32,0,35,34,34,34,34,34,34,34,34,34,34,34,34,118,68,1,28,16,128,17,17,17,17,17,17,17,17,17,17,17,17,17,59,162,0,14,8,192,136,136,136,136,136,136,136,136,136,136,136,136,136,29,81,0,7,4,96,68,68,68,68,68,68,68,68,68,68,68,68,196,142,40,128,3,2,48,34,34,34,"MimeType":"image\/png","Name":"Image"},"Level":2,"TestItemId":null,"Text":"Screenshot","Time":"\/Date(1568618417213+0300)\/"}
It's not easy to say what is wrong. Please prepare simple test project with instructions how you execute tests. It helps to investigate issue.
@nvborisenko Here is it: Craiglist.Automation.zip
In Hooks.cs (Craiglist.Automation project) i'm calling method AttachScreenshot() which should add screenshot as attachment to test.
You need to adjust ReportPortal.config.json. Screenshot saved in TestResults folder which is located right in the solution folder.
Tests was executed from Azure DevOps using /logger:ReportPortal. Test Platform 15.9.0
@heilwood do you see this "strange" message on Report Portal for all expected tests? I cannot reproduce it on my workstation.
If yes, the issue that SpecRun overrides user's output and adds ->
at the beginning of all messages. Agent should consider it when identifies whether this is internal message. Seems as easy fix.
@nvborisenko i see this strange message for all tests where i calling method AttachScreenshot() which should send attachment to report portal. Also i see this "->" symbol in report portal for each step output. If i correct understood the question :)
Fixed in v2.3.1
working fine, thank you so much !!
How to find current testItemId, i'm using ReportPortal VStest logger to send items to reportportal, i found example with NUnit.
Cannot figure out how to add attachment to the test. (Test adapter specrun)
Thank you!