GHPReporter / Ghpr.NUnit

Adapter for NUnit 3 (generate HTML report for NUnit 3)
http://ghpreporter.github.io/
MIT License
35 stars 14 forks source link

Support Attachment Nodes for Screenshot Mapping #37

Closed seanhotaling closed 6 years ago

seanhotaling commented 6 years ago

With recent releases of NUnit, AddTestAttachment(string filePath, string description = null); allows screenshots to now be mapped to the test case: https://github.com/nunit/docs/wiki/TestContext.

<test-case>
  <output>...</output>
  <attachments>
    <attachment description="This is a description of this screenshot.">
      <filePath></filePath>
    </attachment>
    <attachment description="This is a description of this screenshot.">
      <filePath></filePath>
    </attachment>
  </attachments>
</test-case>

This would reduce the need for ScreenHelper.

elv1s42 commented 6 years ago

Hi @sean-hotaling !

Thank you for this issue. Agreed to support NUnit test attachments in the generated report. But ScreenHelper will be supported because there are some upcoming changes with general Ghpr.Core structure to support the ability of saving test results ont only as local .json files but as database records too.

Thanks.

elv1s42 commented 6 years ago

All additional output will be stored under a separate tab like this: image

seanhotaling commented 6 years ago

@elv1s42, is this in reference to the above enhancement or #36?

elv1s42 commented 6 years ago

@sean-hotaling yes, sorry. I had both issues opened in different tabs.

elv1s42 commented 6 years ago

By default all attachments with extentions .png, .jpeg and .bmp will be considered as test screenshots and displayed in the report.

elv1s42 commented 6 years ago

This now has been released too. Please see the release notes here

seanhotaling commented 6 years ago

@elv1s42, thanks much! Will this be updated to be used from your console package? It looks like the suite output will show in the report but not the screenshots from the attachment nodes.

Edit: Nothing to do with the console package, sorry. I did notice though that you save the screenshots into a TestScreenshotDto within GhprTestCase, but nothing is ever done with those screenshots. It seems like the only screenshots making it into the json are the ones from GhprTestRun.Screenshots.

elv1s42 commented 6 years ago

Hi @sean-hotaling , This now should work for both NUnit Console Addin (this package) and Ghpr.Console package (used to generate reports from .xml results file).

Thank you.

elv1s42 commented 6 years ago

Please use the latest version which is v.0.9.1

seanhotaling commented 6 years ago

@elv1s42, thanks for the quick updates. Unfortunately, I installed 0.9.1 and am still not seeing those screenshots in the report. I see the /img/ folder created now with my screenshot copied over, but the controller isn't picking it up: screensInfo.length in the controller is 0.

elv1s42 commented 6 years ago

@sean-hotaling Sorry, I'll try to debug and fix it tomorrow then

elv1s42 commented 6 years ago

Hi @sean-hotaling, it should finally work in v0.9.1.1