Search code examples
getgauge

When using Gauge for UI Automation is there a way to get all screenshots in the same folder as the report


I am using the Gauge framework for UI Automation.

My hope is that I am able somehow to write screenshots to the folder being made to contain the html report for an execution. The trick is that the folder and its contents for a report are not made until after execution completes so I can't write screenshots inside the reports folder as I am taking them during my tests.

Currently the screenshots that I take are written to a folder in the reports folder (root level) of the project. When trying to copy the entire html report to another location I have to also move the screenshots and then have to manually manage the screenshots in that extra screenshots folder as I delete old reports. There are a lot of after the fact steps that I could do but was hoping for a simpler solution.

I am hoping that I was missing something and there was a way to write the screenshots into each reports folder (when reports are not being overwritten) so that I don't have to mangage (move/delete) the screenshots separately and so that the links in the report to the screenshots stay consistent.


Solution

  • Screenshots in gauge's html-report are embedded inside the html as a base64 encoded string. So they currently don't exist as a separate file that you can manipulate.

    Some options for your use case:

    1) Implement a Custom Screenshot Grabber and intercept the screenshot, save it to any location you like.

    2) build a custom reporting plugin (ex, build on this seed example) and collect the screenshots independent of the html report.

    If you do not want the reports to be overwritten, you can set overwrite_reports=false in your properties file. See ref.

    Note that you can also change the html-report's theme if you want a different report structure.