So I double checked and for the Spock integration, the failure report (the
one taken with label "failure") is taken as soon as the exception happens
and before any cleanup methods are called. The only cases where other code
might be executed in-between the exception and the report being taken are:
- the failing feature method has a cleanup: block which will be executed
before reporting
- an implementation of org.spockframework.runtime.IRunListener which has a
non-empty implementation of error(ErrorInfo) method is registered with the
spec before geb.spock.ReportingOnFailureExtension.visitSpec() which
registers geb.spock.OnFailureReporter as a listener is executed

Basically, in most cases the failure report will be written as soon as the
exception happens. Is this not what you are seeing, Ben?

Marcin

On Sun, Nov 8, 2020 at 11:09 PM Ben Frey <spartanho...@gmail.com> wrote:

> Oh, I didn't realize that the test framework would have such an impact.
> I'm using Spock in this case.
>
> Ben
>
> On Sun, Nov 8, 2020, 3:40 PM Marcin Erdmann <marcin.erdm...@proxerd.pl>
> wrote:
>
>> Hi Ben,
>>
>> I know by default Geb creates a report if the test reached the end but
>>> failed.
>>
>>
>> I don't think that this is entirely true. The time of when the report is
>> being taken upon a test failure is test framework (as in Spock, JUnit,
>> TestNG) integration dependent but I believe that the report is taken as
>> soon as the hook used by the integration reports a failure. For some of the
>> integrations it might actually happen after cleanup code is executed. Can
>> you please describe in detail which test framework you are using, what
>> behaviour with regards to reporting on failureyou are observing and what
>> behaviour you are expecting?
>>
>>
>>> Is there a way to create a report if an exception was thrown during the
>>> test?
>>
>>
>> That will depend on the test framework we are talking about exposing a
>> hook which is called as soon as an exception is being thrown from within a
>> test. If there is a better mechanism for detecting the exception being
>> thrown or test failure occurring than what we are currently using for the
>> framework in question then I'd be more than happy to switch the integration
>> to that hook.
>>
>> Marcin
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Geb User Mailing List" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/geb-user/sQjkMRaBqdA/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> geb-user+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/geb-user/CA%2B52dQQ6E0J2ezq-ET%3D%3DSYAvurd85VEOMJf50MfGaPokp3MjBQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/geb-user/CA%2B52dQQ6E0J2ezq-ET%3D%3DSYAvurd85VEOMJf50MfGaPokp3MjBQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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 geb-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/CAG7nOpiAa5fO_%2Bz8Q1RSCF11xMmNrQMKi71iWwDV%2BkNotQLG-g%40mail.gmail.com
> <https://groups.google.com/d/msgid/geb-user/CAG7nOpiAa5fO_%2Bz8Q1RSCF11xMmNrQMKi71iWwDV%2BkNotQLG-g%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQT4Uj2w6%3DdefFVh_dNXz4bdXko-avZc9wzxnwcw_2iNuw%40mail.gmail.com.

Reply via email to