Reports from block description

130 views
Skip to first unread message

Jan Ehrhardt

unread,
Jan 30, 2012, 12:13:47 PM1/30/12
to spockfr...@googlegroups.com
Hi,

I've read, that generating reports from block descriptions is on the roadmap. Is anyone already working on this topic?

If I would do it myself, how could access the block descriptions, since I'm new to the Spock source.

Regards
Jan Ehrhardt

Peter Niederwieser

unread,
Feb 9, 2012, 4:40:46 PM2/9/12
to spockfr...@googlegroups.com
We haven't started working on this yet. The biggest deal is to find
someone who helps us design an attractive HTML report.

The following shows how to access block descriptions from an extension:

https://github.com/spockframework/next-level-spock/blob/master/src/test/groovy/extension/custom/solution/ReportExtension.groovy

Cheers,
Peter

> --
> You received this message because you are subscribed to the Google
> Groups "Spock Framework - User" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/spockframework/-/dIpavgkEts4J.
> To post to this group, send email to spockfr...@googlegroups.com.
> To unsubscribe from this group, send email to
> spockframewor...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/spockframework?hl=en.

Chanwit Kaewkasi

unread,
Mar 9, 2012, 8:24:37 AM3/9/12
to spockfr...@googlegroups.com
Hi Peter,

Thank you for your stable APIs. I used your codes to build a quick report extension here:

Hi Jan,

The report is still a bit ugly, but readable. Any feedback is welcome.

Cheers,

Chanwit

Guillaume Laforge

unread,
Mar 9, 2012, 12:55:43 PM3/9/12
to spockfr...@googlegroups.com
You've got a sample report available somewhere? (to see how easy/hard is it to re-style it)
And why not using the markup builder, out of curiosity? Or even a Groovy template?

Guillaume

To view this discussion on the web visit https://groups.google.com/d/msg/spockframework/-/YQcinJ4BY38J.

To post to this group, send email to spockfr...@googlegroups.com.
To unsubscribe from this group, send email to spockframewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spockframework?hl=en.



--
Guillaume Laforge
Groovy Project Manager
SpringSource, a division of VMware


Chanwit Kaewkasi

unread,
Mar 9, 2012, 9:13:09 PM3/9/12
to spockfr...@googlegroups.com
Hi Guillaume,

On Sat, Mar 10, 2012 at 00:55, Guillaume Laforge <glaf...@gmail.com> wrote:
> You've got a sample report available somewhere? (to see how easy/hard is it
> to re-style it)

Here your are:
http://dl.dropbox.com/u/381580/spock/SPEC-roo.spock.app.entity.PersonSpec.html

> And why not using the markup builder, out of curiosity? Or even a Groovy
> template?

It's a quick and dirty to get 0.1 out. That can be refactored later :)

Chanwit

--
Chanwit Kaewkasi
code.google.com/p/zkgrails
twitter.com/chanwit

pangea

unread,
Mar 21, 2012, 10:41:23 PM3/21/12
to spockfr...@googlegroups.com
Hi Guillaume - If you are planning to create a custom style sheet then can you pls share it here...

To post to this group, send email to spockframework@googlegroups.com.
To unsubscribe from this group, send email to spockframework+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/spockframework?hl=en.

Renato Athaydes

unread,
Mar 21, 2014, 4:38:03 PM3/21/14
to spockfr...@googlegroups.com, jan.eh...@gmail.com
I wrote this extension some time ago already, and I use it in a few of my own projects.

https://github.com/renatoathaydes/spock-reports

I think the reports are extremely useful, especially because I can see which examples failed in a test which contains examples.

You can use your own stylesheets if you don't like the default ones. You can also configure where the reports should be saved.

See the design pages (real reports look exactly as the design ones):

http://codepen.io/renatoathaydes/full/ihGgt

http://codepen.io/renatoathaydes/full/mKckz

Notice that the sample reports are actually used in the tests, so they show pretty much all combinations of results possible (and hence can look a little too colorful).

Hope this helps others as well.

Renato

Michael Putters

unread,
Mar 22, 2014, 9:22:02 AM3/22/14
to spockfr...@googlegroups.com, jan.eh...@gmail.com
Funny thing, I was going to search for such a feature next week...

By any chance, is it feasible to generate a report without running the tests?

My use case is a REST API that's already heavily documented in JSON format (requests and responses, resources, documentation, constraints, etc), and I'd like to add the specifications to that documentation. Ideally it would involve generating annotations for the methods that are specified...

Renato Athaydes

unread,
Mar 22, 2014, 1:03:35 PM3/22/14
to spockfr...@googlegroups.com, jan.eh...@gmail.com
I don't think it's possible because this is a Spock extension, therefore the only way to create a report is by running Spock Specifications.

Also, the reports contain information about which tests passed/failed/errors which would not exist if you did not run tests. Reports even show the beautiful assertion failures you get when a Groovy assert statement fails.

To achieve what you want you'd have to use something other than Spock to parse the Specifications... you might even be able to re-use some code from the Spock code base if you look into it.

Renato
Reply all
Reply to author
Forward
0 new messages