Closed wsbaser closed 7 years ago
You can use another approach via ReportPortal.Client.
Example of code to send a screenshot directly to ReportPortal in your code/test/addin:
var image = ScreenshotCapture.TakeScreenshot(true);
var imageConverter = new ImageConverter();
Bridge.Service.AddLogItem(new AddLogItemRequest
{
Level = LogLevel.Info,
TestItemId = Bridge.Context.TestId,
Text = "Screenshot",
Time = DateTime.UtcNow,
Attach = new Attach("Screenshot", "image/png", (byte[])imageConverter.ConvertTo(image, typeof(byte[])))
});
where Bridge.Service is object to interact with RP API, Bridge.Context.TestId is your running test.
The behavior might be changed due we need support several tests under running.
@DzmitryHumianiuk Can you please provide an example to attach screenshot for TestNG + Java ? Thanks
I am using mstest:
screenshot = (this.driver).GetScreenshot(); this.testContext.AddResultFile(fullFilePath); screenshot.SaveAsFile(fullFilePath, System.Drawing.Imaging.ImageFormat.Jpeg); Logger.LogInfo(relativeFilePath);
I am seeing a log with relative path in RP with attachment but attachment is blank. Can you please help me understand what am I missing?
@shilpa25comp please create a separate issue with details:
ReportPortal.*.log
filesThanks for understanding.
@DzmitryHumianiuk Can you please provide an example to attach screenshot for failed test cases in cucumber js ?
Approach using RP_MESSAGE prefix, that I saw in example-java-TestNG-logback project does not work. Log.Info($"RP_MESSAGE#BASE64#{base64String}#I'm logging content via BASE64");