reportportal / logger-net-nlog

Integration point for .NET NLog
Apache License 2.0
1 stars 1 forks source link

Can't post screenshots to Report Portal #1

Closed wsbaser closed 7 years ago

wsbaser commented 7 years ago

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");

nvborisenko commented 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 commented 5 years ago

Refer to example https://github.com/reportportal/example-net-nunit/blob/master/src/Example/Tests/Class1.cs

KunalShokeen432 commented 5 years ago

@DzmitryHumianiuk Can you please provide an example to attach screenshot for TestNG + Java ? Thanks

DzmitryHumianiuk commented 5 years ago

@KunalShokeen432 https://github.com/reportportal/example-java-TestNG/blob/master/logback/src/main/java/com/epam/rp/tests/logging/LoggingTest.java

shilpa25comp commented 4 years ago

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?

nvborisenko commented 4 years ago

@shilpa25comp please create a separate issue with details:

Thanks for understanding.

PriyankaMahanty commented 3 years ago

@DzmitryHumianiuk Can you please provide an example to attach screenshot for failed test cases in cucumber js ?

DzmitryHumianiuk commented 3 years ago

@PriyankaMahanty https://github.com/reportportal/agent-js-cucumber https://github.com/reportportal/agent-js-cucumber#attachments https://github.com/reportportal/examples-js/tree/master/example-cucumber