reportportal

How can I send files / pictures to Report Portal with .net client?


I'd like to send a binary attachment to Report Portal with .net client. How can I do it?


Solution

  • Example is in Tests project.

    https://github.com/reportportal/client-net/blob/master/ReportPortal.Client.Tests/LogItem/LogItem.cs

    Find CreateLogWithAttach test and see code.

    var data = new byte[] { 1, 2, 3 };
                var log = Service.AddLogItem(new AddLogItemRequest
                {
                    TestItemId = _testId,
                    Text = "Log1",
                    Time = DateTime.UtcNow,
                    Level = LogLevel.Info,
                    Attach = new Attach("file1", "application/octet-stream", data)
                });
    

    Related documentation: Log Data in ReportPortal