running geb tests as plain unit tests

running geb tests as plain unit tests

Hi,

Geb tests are normally started using the functional test phase. This means that during development of the tests, you spend most of the time waiting for the application to start :(
By executing:
RuntimeAdapter.baseUrl = 'http://localhost:8080/myapp/' RuntimeAdapter.reportDir = new File('testreportsdir/geb')
before starting the geb test (f.e. in setup), you can start the test from within the IDE (assuming your application is already running).

While trying this out, I noticed that geb looses the http session in between tests when running with test-app while it remembers the session when started as described above.

So my question is: is there a way to control the session behavior of geb tests?

Re: running geb tests as plain unit tests

>
> Hi,
>
> Geb tests are normally started using the functional test phase. This means
> that during development of the tests, you spend most of the time waiting for
> the application to start :(
> By executing:
> RuntimeAdapter.baseUrl = 'http://localhost:8080/myapp/'> RuntimeAdapter.reportDir = new File('testreportsdir/geb')
> before starting the geb test (f.e. in setup), you can start the test from
> within the IDE (assuming your application is already running).
>
> While trying this out, I noticed that geb looses the http session in between
> tests when running with test-app while it remembers the session when started
> as described above.
>
> So my question is: is there a way to control the session behavior of geb
> tests?
>
> Regards,
> Ivo
> --
> View this message in context: http://grails.1312388.n4.nabble.com/running-geb-tests-as-plain-unit-tests-tp3217745p3217745.html> Sent from the Grails - user mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

Re: running geb tests as plain unit tests

> Geb tests are normally started using the functional test phase. This means
> that during development of the tests, you spend most of the time waiting for
> the application to start :(
> By executing:
> RuntimeAdapter.baseUrl = 'http://localhost:8080/myapp/'> RuntimeAdapter.reportDir = new File('testreportsdir/geb')
> before starting the geb test (f.e. in setup), you can start the test from
> within the IDE (assuming your application is already running).
>
> While trying this out, I noticed that geb looses the http session in between
> tests when running with test-app while it remembers the session when started
> as described above.
>
> So my question is: is there a way to control the session behavior of geb
> tests?

What superclass are you using for your tests?

The provided superclasses for JUnit3, JUnit4 and Spock all call the geb.Browser#clearCookiesQuietly() method.

If you don't want to use one of these classes then you can just call this method after each test.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

So I will just call "RuntimeAdapter.baseUrl = 'http://localhost:8080/myapp/'" in setUp
and call "browser.clearCookiesQuietly()" in tearDown().
This way it will behave the same wether running from grails commandline or from IDEA :)

Thanks for pointing out.
Ivo
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

Re: running geb tests as plain unit tests

On 18/01/2011, at 7:12 AM, Ivo Houbrechts wrote:

>>
>>
>> What superclass are you using for your tests?
>>
> grails.plugin.geb.GebTests
>
>> The provided superclasses for JUnit3, JUnit4 and Spock all call the geb.Browser#clearCookiesQuietly() method.
>>
>> https://github.com/geb/geb/blob/master/module/geb-core/src/main/groovy/geb/Browser.groovy#L174>>
>> If you don't want to use one of these classes then you can just call this method after each test.
>
> So I will just call "RuntimeAdapter.baseUrl = 'http://localhost:8080/myapp/'" in setUp
> and call "browser.clearCookiesQuietly()" in tearDown().
> This way it will behave the same wether running from grails commandline or from IDEA :)

It may be the case that JUnit4 won't call @After methods if it suspects the test case is JUnit3 based, which could be the case here because we use GroovyTestCase.
---------------------------------------------------------------------
To unsubscribe from this list, please visit: