Integration test lifecycle

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Integration test lifecycle

Rob Fletcher
Hi

I'm trying to write some integration tests that require an application to be running for execution & wondering what the best way is to manage this in gradle.

I have defined an `integrationTest` task of type _Test_ and tried the following methods to start and stop the application:

- using `doFirst` and `doLast`
- using `beforeSuite` and `afterSuite`
- using Ant style dependency chaining

With all these the problem I find is that the application is not stopped if the tests fail & is still running after gradle exits. Is there a 'correct' way to handle this scenario?

--
Rob Fletcher
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)



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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Integration test lifecycle

Rob Fletcher
Actually, I just noticed that when using `afterSuite` I have a different problem. I get the following error message:

> Failed to notify test listener.
> Cannot start long running operation, as the task artifact state cache (/Users/rob/Workspace/gr8conf.2012/gradle-vertx/.gradle/1.0-rc-3/taskArtifacts) has not been locked.


I guess this is because the task used to stop my application does so in a separate thread.

--
Rob Fletcher
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


On Thursday, 7 June 2012 at 23:01, Rob Fletcher wrote:

> Hi
>
> I'm trying to write some integration tests that require an application to be running for execution & wondering what the best way is to manage this in gradle.
>
> I have defined an `integrationTest` task of type _Test_ and tried the following methods to start and stop the application:
>
> - using `doFirst` and `doLast`
> - using `beforeSuite` and `afterSuite`
> - using Ant style dependency chaining
>
> With all these the problem I find is that the application is not stopped if the tests fail & is still running after gradle exits. Is there a 'correct' way to handle this scenario?
>
> --
> Rob Fletcher
> Sent with Sparrow (http://www.sparrowmailapp.com/?sig)




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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Integration test lifecycle

Luke Daley-2
Is this still an issue Rob, or did you find a solution?

On 07/06/2012, at 10:21 PM, Rob Fletcher wrote:

> Actually, I just noticed that when using `afterSuite` I have a different problem. I get the following error message:
>
>> Failed to notify test listener.
>> Cannot start long running operation, as the task artifact state cache (/Users/rob/Workspace/gr8conf.2012/gradle-vertx/.gradle/1.0-rc-3/taskArtifacts) has not been locked.
>
>
> I guess this is because the task used to stop my application does so in a separate thread.
>
> --
> Rob Fletcher
> Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
>
>
> On Thursday, 7 June 2012 at 23:01, Rob Fletcher wrote:
>
>> Hi
>>
>> I'm trying to write some integration tests that require an application to be running for execution & wondering what the best way is to manage this in gradle.
>>
>> I have defined an `integrationTest` task of type _Test_ and tried the following methods to start and stop the application:
>>
>> - using `doFirst` and `doLast`
>> - using `beforeSuite` and `afterSuite`
>> - using Ant style dependency chaining
>>
>> With all these the problem I find is that the application is not stopped if the tests fail & is still running after gradle exits. Is there a 'correct' way to handle this scenario?
>>
>> --
>> Rob Fletcher
>> Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

--
Luke Daley
Principal Engineer, Gradleware
http://gradleware.com


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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Integration test lifecycle

Rob Fletcher
I managed to get it working by using a TaskExecutionListener: https://github.com/robfletcher/gradle-vertx/blob/master/examples/groovy/build.gradle#L45


--
Rob Fletcher
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


On Monday, 11 June 2012 at 18:18, Luke Daley wrote:

> Is this still an issue Rob, or did you find a solution?
>
> On 07/06/2012, at 10:21 PM, Rob Fletcher wrote:
>
> > Actually, I just noticed that when using `afterSuite` I have a different problem. I get the following error message:
> >
> > > Failed to notify test listener.
> > > Cannot start long running operation, as the task artifact state cache (/Users/rob/Workspace/gr8conf.2012/gradle-vertx/.gradle/1.0-rc-3/taskArtifacts) has not been locked.
> >
> >
> >
> >
> > I guess this is because the task used to stop my application does so in a separate thread.
> >
> > --
> > Rob Fletcher
> > Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
> >
> >
> > On Thursday, 7 June 2012 at 23:01, Rob Fletcher wrote:
> >
> > > Hi
> > >
> > > I'm trying to write some integration tests that require an application to be running for execution & wondering what the best way is to manage this in gradle.
> > >
> > > I have defined an `integrationTest` task of type _Test_ and tried the following methods to start and stop the application:
> > >
> > > - using `doFirst` and `doLast`
> > > - using `beforeSuite` and `afterSuite`
> > > - using Ant style dependency chaining
> > >
> > > With all these the problem I find is that the application is not stopped if the tests fail & is still running after gradle exits. Is there a 'correct' way to handle this scenario?
> > >
> > > --
> > > Rob Fletcher
> > > Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
> >
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list, please visit:
> >
> > http://xircles.codehaus.org/manage_email
>
> --
> Luke Daley
> Principal Engineer, Gradleware
> http://gradleware.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email 



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

    http://xircles.codehaus.org/manage_email