renatoathaydes / spock-reports

This project creates a global extension to Spock to create test reports.
Apache License 2.0
274 stars 68 forks source link

Is it possible to access the Spock.lang.Title annotation value of each spec from summary report #146

Closed SueNag closed 6 years ago

SueNag commented 6 years ago

I want to create a single page report with all the details for the business and using class names for the spec stats doesn't make mush sense to them. I see that TemplateReportAggregator is filtering selected info from SpecData. Is there a way to extend it so that I get all the Spec info in the summary Report?

renatoathaydes commented 6 years ago

The data seems to be all available in the summary report.

See this line:

    engine.createTemplate( template )
            .make( [ data          : allData,
                     'utils'       : Utils,
                     'fmt'         : new StringFormatHelper(),
                     projectName   : projectName,
                     projectVersion: projectVersion ] )
    .toString()

data seems to contain everything... can you specify something that you think is missing from it?

renatoathaydes commented 6 years ago

You can see the contents of allData in the build/spock-reports/aggregated_report.json file spock-reports creates... It does not include metadata from annotations like @Title and @Narrative, I guess that's what you would be looking for?

SueNag commented 6 years ago

Yes, allData just has list of executed feature names, list of ignored features and a map of spec stats. For the requirement, I am talking about, it would be nice to have all specData included along with spec stats

renatoathaydes commented 6 years ago

That's a good idea, it is not hard to add further information to the data field, but notice that this data is serialized as JSON so it needs to be just simple data like spec title, narrative etc. If there's any specific information about the spec you want, let me know.

SueNag commented 6 years ago

I was thinking more along the lines of adding a map of specData (spec name to Spec Data) like spec stats. The requirement was to generate one long report of summary file & all spec files like what Cucumber does . I do see your point about JSON serialization.

SueNag commented 6 years ago

I think having spec title and narrative would make the Summary report much more readable.

renatoathaydes commented 6 years ago

Released version 1.6.0 which includes in the data Map the following additional fields: title and narrative.

I also added title to the HTML summary report, by default, and allowed that to be configured so you can show class name, title, or both.

SueNag commented 6 years ago

Awsome, I will pull in the latest version. Thanks a bunch.