How to customize the report.html

Hi All,

Based on project structure we got one requirement to in robot report.html. We need to add one more column on report.html and populate the dynamic data for each testcase in that column.

Can someone please help me to achieve this?

Hi Niranjan,

Are you looking at the All tab under Test details?:


If so, each line here is a test suite, usually a test suite is a robot file, so put the each test or group of test in a separate file in the same folder and tell robot to run the folder.

Here’s an example, this is my folder structure:

Issue-#184/
Issue-#184/Issue-#184.rfs
Issue-#184/test-folder-b
Issue-#184/test-folder-b/logvars.robot
Issue-#184/test-folder-common
Issue-#184/test-folder-common/resource.robot
Issue-#184/test-folder-a
Issue-#184/test-folder-a/logvars.robot
  • resource.robot doesn’t have any tests, just keywords common to the other files.
  • both logvars.robot files have 1 test each

When I run robot Issue-#184 (notice instead of giving robot a file to run, I give it the parent folder, that only has sub folders where my tests are)

And this is what I get in the report .html

Hopefully I’ve understood what you’re after?

Dave.

Hi,

@damies13, on my side I understood the need is to have an additional colum between Documentation and Tags for example, and display/list for each test dynamic data (rather a formatting issue than a suite organization)

There the question is what is considered as these data in the test (variables, keywords argument… ).

I’m not really familiar with the modification of the output html, so I’m not sure it’s possible to do this easily. This would probably need to work with the .xml and some .xsl file.

But I would be interested too, to know if some of you already did rework of the report and how.
As Documentation or Tags exist in the report, this would be interesting to be able to list/display variables used from its section, or keywords called also.

Regards

Charlie

1 Like

Hi damies,

Let me provide some additional context. Each test case generates a corresponding file, and we aim to display these files in the report as an additional column.

please have a look on the attached image.

Hi Niranjan,

Ah ok, I see what you want, I don’t know if these reports can be customised or not, I actually don’t use report.html myself, I only really use log.html when a test failed cause I want to see what caused the failure, but I don’t need to report test results either.

I’m not sure the report.html layout can be modified, at least not with the standard robot framework commands, but here are some suggestions:

  • A simple option might be to use Set Test Message to make those files appear in the Message column, I would try this first, as it looks to be the least difficult way to get what you want.

  • As @CharlieScene mentioned you could potentially write an XSLT to generate a custom report from the output.xml, some people go down this route but it requires knowledge XSLT transformations.

  • There is also the Reporting Test Results | ROBOT FRAMEWORK guide on using other reporting tools and dashboards with robot framework results, there are links there for several reporting tools for customised robot framework test reports.

I’ve not used any of these myself, but hopefully this helps.

Dave.

Thank you Damies,

Currently im using Set Test Message keyword and its populating the info in message column, but what we need exactly is to display in another column.

Hi Niranjan,

Well the Set Test Message keyword does allow you to use html, so I guess you could construct a small html table, 1 row and 2 columns, put the other info in the first column and the file name/path in the second. You won’t get the column headings, but you’ll effectively have the extra column.

As an alternative there is Set Test Documentation and Set Tags that you can also used depending on what you already have in those columns these might be an option.

I understand you want to add a column to the report, but as mentioned that’s not currently possible without using a custom XSLT or using another reporting tool.

You could raise a feature request to the robot framework dev team, maybe they will add something to rebot for that?

Sorry, I don’t know what else to suggest,

Dave.

The replies here have all been solid and I would only underscore that they are good ideas. If it turns out you just can’t get what you want, you can really level up and use the Reporting API. It’ll take a fair amount of work on your part (I hope your Python-fu is good!), but you can almost certainly get what you want.

1 Like