Hi Paul,

The behaviour you are describing is as expected. This is because report
triggering is implemented in a cleanup method of GebReportingSpec which is,
I assume, a super class of your spec and cleanup methods are called by
Spock in the reverse order of inheritance.

If you wish to generate a report as soon as an error happens then I would
suggest not using GebReportingSpec but writing a global Spock extension
which installs an IRunListener onto each SpecInfo and implement the report
generation triggering in IRunListener#error(ErrorInfo) - see this
stackoverflow response for more details on how to implement an extension (
http://stackoverflow.com/questions/16420034/execute-some-action-when-spock-test-fails/16421436#16421436)
and sources of GebReportingSpec for how the report triggering is
implemented.

Marcin

On Fri, Aug 5, 2016 at 4:34 AM, Paul Wellner Bou <[email protected]> wrote:

> Hi,
>
> I have a failing webtest in this structure:
>
>     def "test"() {
>         when:
>         to LoginPage
>
>         and:
>         login("...", "...")
>
>         then:
>         at LoggedInPage
>
>         and:
>         waitFor {
>             assertHasAccess()
>         }
>
>         cleanup:
>         logout()
>     }
>
> Unfortunately the reports (HTML and Screenshot) are taken from the state
> after the logout, after the cleanup task, I would expect it to be reported
> before.
> Can I change this behaviour? Or am I doing something wrong when cleaning
> up?
>
> I am using:
>
>         groovyVersion = '2.4.5'
>         gebVersion = '0.13.1'
>         seleniumVersion = '2.51.0'
>
> Thanks and best regards
> Paul.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/geb-user/d6ec7fc3-f606-4a14-8cfd-9f3201ed062e%40googlegroups.com
> <https://groups.google.com/d/msgid/geb-user/d6ec7fc3-f606-4a14-8cfd-9f3201ed062e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQQy9V6QC-g0b%3DkkUNQ%3DiqOdmHgsORpNBb-%2Bsf%3Dc2A%2BCPQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to