-
Notifications
You must be signed in to change notification settings - Fork 470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
provide a mechanism to log spock-blocks on the fly #645
Comments
No feedback on it? |
I have not received any response on this yet... Waiting for someone to actually comment in this. |
FYI, if you need a workaround until PR #111 is available as a feature, see my StackOverflow answer which I am quoting here. By using import spock.lang.Specification
class LabelPrinter {
def _(def message) {
println message
true
}
}
Specification.mixin LabelPrinter Now if we have a spec like this (please note the unobtrusive underscores, e.g. package de.scrum_master.testing
import spock.lang.Specification
class MySpockTest extends Specification {
def "interaction"() {
given:_ "My given comment"
def foo = 11
def bar = foo + 4
println "blah"
expect:_ "My expect comment"
interaction {
foo = 2
bar = 5
true
}
println "foo"
foo * bar == 10
foo + bar == 7
and:_ "My and comment"
true
}
} We get a console log like this:
|
Since this issue is just another aspect of #538 I'm closing it so that the discussion is not spread out in multiple issues. |
Very good, thanks. No more need for me cross-posting. :-) |
Issue description
Spock should provide a mechanism/option to let users log/report spock block labels on the fly when the test execution is happening.
Having the BDD reports in logs can be a good addition and provides a context of what is happening when we analyze really huge console logs in test runs.
Context for this enhacement
We are working on a huge enterprise application Integration and are leveraging spock to write tests
Our specifications include verifying contents across multiple apps and validate the contents using Spock.
How to reproduce / Show me how it should look?
This is how a simple test case of ours looks like
This is the kind of logging I am trying to Achieve
What have I done before raising this issue
I tried creating my own Spock extension with mySpockRunListener registered, I customize logging and reporting and got below log.
The text was updated successfully, but these errors were encountered: