Serenity Reports Logo Change

2019-07-30 04:26发布

I am using Serenity with Jbehave. i would like to know how to replace the current reports default logo of serenity to a custom company logo. what is the code changes need to be done for changing the default logo.

1条回答
看我几分像从前
2楼-- · 2019-07-30 04:43

You can do that by replacing the serenity-bdd-logo.png in serenity-report-resources-x.x.xx.jar. Save your logo and name it likewise, then copy and overwrite the existing one. Mine is stored in the following location:

serenity-report-resources-x.x.xx.jar\report-resources\images\

This should work for any project running on your machine and using that single jar file. It is made easier with Maven as it stores all downloaded dependencies in one location.

Otherwise, I doubt there is any legitimate way to perform this trick. You can write Java code to rename your logo and copy it to reports location each time you run serenity reports, but all that are just hacks really :)

Serenity reports are built out of FreeMaket Template Language (.ftl) files stored in serenity-report-resources-x.x.xx.jar (another possible solution is to overwrite these and reference your own file each time serenity-bdd-logo.png is mentioned). Ideally you would want to create your own jar and force serenity to use this one. However, that seems a lot work just to replace a logo. Makes sense if you want to overhaul the whole look and feel of the reports.

查看更多
登录 后发表回答