Hi Samuel,

One of the ways to achieve it would be to extend ConfigurationLoader class
and use your new implementation in GebSpec.createConf() instead of the
current one. In your new configuration loader class you will then need to
override ConfigurationLoader#createConf(ConfigObject, GroovyClassLoader).
Assuming you will have BaseGebConfig.groovy resource file with all
configuration apart from the url and project specific GebConfig.groovy
resource files the following should be sufficient:

    protected createConf(ConfigObject rawConfig, GroovyClassLoader
classLoader) {
        def baseRawConfig
= loadRawConfig(classLoader.getResource('BaseGebConfig.groovy'),
classLoader)
        baseRawConfig.merge(rawConfig)
        new Configuration(baseRawConfig, properties,
createBuildAdapter(classLoader), classLoader)
    }

On Wed, Jan 17, 2018 at 11:33 PM, Samuel Rossinovic <
[email protected]> wrote:

> I could do that, but rather not, as it seems to me to be more a workaround
> than a solution. Creating a base class for specifications just to allow
> them to override a configuration value seems wrong, and I am concerned that
> it might come back to bite me later-on in the development (e.g if I'd
> actually want these specs to inherit behavior from existing base-specs,
> like common pre/post behaviour). I'd be happier confining specifications to
> deal w/test cases, and assign configuration to config files.
>
> On Wednesday, January 17, 2018 at 7:48:01 PM UTC+11, Roman Tretyak wrote:
>>
>> Why can't you just change the baseUrl for certain test/set of tests? Have
>> a separate 'parent' test for each web app which will set the baseUrl. For
>> example by setting browser.setBaseUrl(..) or by overriding createConf
>> method (only for geb-spock I guess).
>>
>> -Roman
>>
>> среда, 17 января 2018 г., 5:14:55 UTC+2 пользователь Samuel Rossinovic
>> написал:
>>>
>>> Hi.
>>> Trying to reuse geb stuff across multiple web apps (different urls). In
>>> particular, I'd like to reuse config in GebConfig.groovy.
>>> My GebConfig currently contains:
>>> * baseUrl
>>> * misc configuration (waiting, clear cookies, reportsDir, etc)
>>> * environments (per-browser), as-well as some utility methods for those
>>> envs.
>>>
>>> Would be good if I was able to extract everything other than the baseUrl
>>> to a common config ancestor, and have separate projects, each with a config
>>> that only defines its URL, and inheriting the rest from the common one.
>>>
>>> Appreciate some guidance on this...
>>>
>>> --
> 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/9ecc26e9-558f-458c-9db5-5e7651f6ab4d%40googlegroups.com
> <https://groups.google.com/d/msgid/geb-user/9ecc26e9-558f-458c-9db5-5e7651f6ab4d%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%2B52dQRWo5g8r1%3DnHYmuUkb-%3DNqWZ7EjdMvy%3DzooREL5K_HAXQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to