Block-level reporting (statement injection)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Block-level reporting (statement injection)

Klaus L.
Hi folks,

I asked this question on the geb-user forum first (https://groups.google.com/forum/#!topic/geb-user/RFkG0Ab8P2w ), but it seems to be a Spock topic rather than Geb-related.

I would like to inject some statements into features/iterations of Spock specs. More specifically, I would like to inject them on block level!
The use case: report commands for Geb, taking screenshots and web page snapshots.

I know there are extensions allowing for snapshots automatically to be taken at finish or in case of error.
But in our context, "snapshot journals" for the whole story would really be a sexy feature.

So given a testcase like:

def "my testcase"() {
  given
: "initial state"
 
...

 
when: "data X is entered"
 
...

 
then: "result Y is displayed"
 
...

}

how to dynamically "extend" it (using a custom base spec, or some trait etc) to effectively become:

def "my testcase"() {
  given
: "initial state"
 
...
  report
("GIVEN initial state")

 
when: "data X is entered"
 
...
  report
("WHEN data X is entered")

 
then: "result Y is displayed"
 
...
  report
("THEN result Y is displayed")
}

Yes, that would be a lot of files. But on some occasions that would be really helpful for us in order to communicate with business stakeholders.

Applying ex-post reporting (like Spock Reports Extension) would not help, as current state during test execution matters.

Maybe the challenge can be resolved with an extension (cf. https://groups.google.com/forum/#!topic/spockframework/Hqa6WT4LAEU ), but currently I can't see how any IRunListener implementation could accomplish this.

Any hints or ideas?

Thanks in advance,
Klaus

--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Loading...