Hi Steve,

Yes, the behaviour you're describing is as expected. This is due to the
fact that there is an instance of geb.Browser created before the first test
in each test class (e.g. for Spock integration
https://github.com/geb/geb/blob/d25f58566f8da2bf6397f43dfa5672547100f09b/module/geb-spock/src/main/groovy/geb/spock/GebSpec.groovy#L43).
Browser needs an instance of geb.Configuration which is loaded using
geb.ConfigurationLoader (
https://github.com/geb/geb/blob/d25f58566f8da2bf6397f43dfa5672547100f09b/module/geb-spock/src/main/groovy/geb/spock/GebSpec.groovy#L34)
which executes the config script.

If you do not wish to execute the config script once for each test class
then you could for example create a base specification, load the
configuration into a static field of that base specification and override
GebSpec.createConf() method (
https://github.com/geb/geb/blob/d25f58566f8da2bf6397f43dfa5672547100f09b/module/geb-spock/src/main/groovy/geb/spock/GebSpec.groovy#L33)
to return that static field.

Hope that helps,
Marcin

On Fri, Jun 2, 2017 at 12:48 PM, <[email protected]>
wrote:

> Hello.  I notice that each test class results in a re-loading of my
> GebConfig.groovy configuration.  We have multiple environments, and one of
> them (called "local") has some code that looks for the user's profile.
> When it finds the profile, it prints "Using ${profile} profile" and
> then creates a new FirefoxDriver(profile) in the driver = {} closure.  I am
> seeing this output once before every test class runs.  Should this be
> happening each and every time?
>
> Thanks,
> Steve
>
> --
> 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/91a1e543-972f-4a6e-b44a-fb612a2aa506%40googlegroups.com
> <https://groups.google.com/d/msgid/geb-user/91a1e543-972f-4a6e-b44a-fb612a2aa506%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%2B52dQS78%2BUUaY79eUECWs-swET7QdnkrCh_c-RjWaU-NFZBkQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to