ok, I found a workaround for this: 

ext.myUrl= project.hasProperty('myUrl') ? project.getProperty('myUrl') : 'No 
url delivered'

task 'example'(type: Test) {
    ....
    systemProperty "geb.build.baseUrl", myUrl
}


>gradle example -PshopUrl=...
...
BUILD SUCCESSFUL



Am Mittwoch, 7. Dezember 2016 11:58:38 UTC+1 schrieb tu Mimi:
>
> Hi Marcin, 
>
> first of all thanks a lot for your work investigated to Geb. I love this 
> cool framework!
>
> Based on your geb-example-gradle-master project from github I added the 
> project properties to "build.gradle"
>
> test {
>     if (project.hasProperty("baseUrl")) {
>         systemProperties("geb.build.baseUrl": project.baseUrl)
>     }
>     dependsOn drivers.collect { tasks["${it}Test"] }
>     enabled = false
> }
>
>
> and deactivated the baseUrl in "GebConfig.groovy" 
>
> // To run the tests with all browsers just run “./gradlew test”
> // baseUrl = "http://gebish.org";
>
>
> But following error is thrown if I tried to pass the baseUrl via command 
> line (only GebishOrgSpec was unter test, GebishOrgTest was out of the test 
> scope)
>
> > gradle -PbaseUrl="http://gebish.org"; chromeTest
> :compileJava UP-TO-DATE
> :compileGroovy UP-TO-DATE
> :processResources UP-TO-DATE
> :classes UP-TO-DATE
> :compileTestJava UP-TO-DATE
> :compileTestGroovy UP-TO-DATE
> :processTestResources
> :testClasses
> :downloadChromeDriver UP-TO-DATE
> :unzipChromeDriver UP-TO-DATE
> :chromeTest
>
> GebishOrgSpec > can get to the current Book of Geb FAILED
>     org.openqa.selenium.WebDriverException at GebishOrgSpec.groovy:7
>         Caused by: org.openqa.selenium.remote.ScreenshotException at 
> GebishOrgSpec.groovy:7
>             Caused by: org.openqa.selenium.WebDriverException
>
> 1 test completed, 1 failed
> :chromeTest FAILED
>
> FAILURE: Build failed with an exception.
>
> Do you know what´s wrong? Do I miss any thing?
>
> Kind regards
> Tu 
>
>
>
> Am Samstag, 20. Februar 2016 19:45:18 UTC+1 schrieb Marcin Erdmann:
>>
>> To pass the baseUrl from command line when invoking gradle you need to 
>> set the system property on the test task because the system properties set 
>> for the build are not by default passed to the jvm running the tests. In 
>> your gradle build script you need to add:
>>
>> test {
>>     systemProperties("geb.build.baseUrl": 
>> System.getProperty("geb.build.baseUrl"))
>> }
>>
>> You can also use project properties instead of system properties when 
>> passing the build url from the command line to save yourself some typing:
>>
>> test {
>>     if (project.hasProperty("baseUrl") {
>>         systemProperties("geb.build.baseUrl": project.baseUrl)
>>     }
>> }
>>
>> and:
>>
>> ./gradlew -PbaseUrl="https://dev-admin.domain.info"; test
>>
>>
>> To run a single test you can use the --tests switch (
>> https://docs.gradle.org/current/userguide/java_plugin.html#test_filtering
>> ):
>>
>> ./gradlew test --tests="*LoginSpec"
>>
>> On Thu, Feb 18, 2016 at 2:27 PM, Geemang <[email protected]> wrote:
>>
>>> I'm attempting to do: ./gradlew -Dgeb.build.baseUrl=
>>> https://dev-admin.domain.info -Dtest.single=LoginSpec test
>>>
>>>
>>> LoginSpec > can get to the login page FAILED
>>>     geb.error.NoBaseUrlDefinedException at LoginSpec.groovy:21
>>>
>>>
>>> 2 Questions:
>>>
>>> 1) Is it possible to pass the baseUrl using gradle?
>>> 2) How do you target a specific test?
>>>
>>> TIA,
>>> Geemang
>>>
>>> -- 
>>> 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/43f44d99-8921-44a8-8dce-3ceabfbc94e3%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/geb-user/43f44d99-8921-44a8-8dce-3ceabfbc94e3%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/7bd9b4cf-afc8-480a-bede-d6096900a36b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to