Hi Alex,

Sorry for a late reply.

You wouldn't be really passing anything to writeReport() as it's a method
called by Geb internally. What you need is a geb.report.Reporter
implementation that has a reference to your proxy. I can see two ways of
doing it:
- making your proxy reference a singleton accessible in static context,
that way you can start/reset your proxy from setup() method in a base spec
class class and access it to save the file from your reporter
implementation registered via the config file
- start/instantiate your proxy from setup/setupSpec() method in a base
spec, then pass it to a new instance of the reporter which should then be
configured to be used by Geb via geb.Configuration#setReporter() (there's a
configuration instance available on geb.Browser instances), possibly
using geb.report.CompositeReporter if you want to keep the reporters that
are shipped with Geb, and finally tear down the proxy in
cleanup/cleanupSpec()

I hope that this helps.

On Mon, Jun 17, 2019 at 7:47 PM AlexB <[email protected]> wrote:

> Hi All,
>
> I use BrowserMobProxy as a proxy for ChromeDriver to collect data in HAR
> file and then save it to a file. I use the file as an additional source of
> information (together with PageSource and Screenshots) when analyzing test
> results.
>
> Currently If initiate and start an instance of BrowserMobProxy in my Spec
> class. And I save the HAR to a file in cleanup() method.
>
> I wanted to find a way to move the saving HAR to file code from cleanup()
> method into a CustomReporter class. So whenever a test fails - this report
> would save HAR file.
> However I wasn't able to understand how to pass the BrowserMobProxy object
> into the writeReport() method that does everything in CustomReporter
> classes.
>
> Do you have an idea how this could be done?
>
> Regards, Alex
>
> --
> 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/06b5bdbc-fa5b-4529-b9d6-eb798172e936%40googlegroups.com
> <https://groups.google.com/d/msgid/geb-user/06b5bdbc-fa5b-4529-b9d6-eb798172e936%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%2B52dQQM1VQcLBbGCEf4774SUTweaSnAzrFbAYVwt7_kDZbJjA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to