Running integration tests twice against different webapp configurations

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

Running integration tests twice against different webapp configurations

Ellis, Scott
Hi,

I have a project that builds a webapp and runs integration tests against it using the failsafe plugin and the jetty-maven-plugin.

That is, I use the jetty-maven-plugin to start jetty in the pre-integration-test phase, run the tests, then shut jetty down in the post-integration-test phase.

Now, my web app can have an entirely different configuration in addition to the existing one, so I need to start jetty with a new config and run a new suite of tests, while maintaining all the existing functionality.

So what I really want to do it run these phases twice:

pre-integration-test
integration-test
post-integration-test

First I want to run them with the my webapp configured the old way, and then run the same phases again with my webapp configured the new way.

Any advice on how to do this? The configurations can be set with system properties. The problem is how to run those phases twice in that order.

Thanks for any insight you can offer,
Scott
Reply | Threaded
Open this post in threaded view
|

Re: Running integration tests twice against different webapp configurations

Anders Hammar
I'd say you need two modules; one for each IT setup. Each module is a Maven
project and will then run the integration tests. The actual integration
test code could then be in a third module and you declare a dependency on
that artifact.

/Anders

On Thu, Oct 11, 2018 at 11:21 PM Ellis, Scott <[hidden email]>
wrote:

> Hi,
>
> I have a project that builds a webapp and runs integration tests against
> it using the failsafe plugin and the jetty-maven-plugin.
>
> That is, I use the jetty-maven-plugin to start jetty in the
> pre-integration-test phase, run the tests, then shut jetty down in the
> post-integration-test phase.
>
> Now, my web app can have an entirely different configuration in addition
> to the existing one, so I need to start jetty with a new config and run a
> new suite of tests, while maintaining all the existing functionality.
>
> So what I really want to do it run these phases twice:
>
> pre-integration-test
> integration-test
> post-integration-test
>
> First I want to run them with the my webapp configured the old way, and
> then run the same phases again with my webapp configured the new way.
>
> Any advice on how to do this? The configurations can be set with system
> properties. The problem is how to run those phases twice in that order.
>
> Thanks for any insight you can offer,
> Scott
>
Reply | Threaded
Open this post in threaded view
|

Re: Running integration tests twice against different webapp configurations

Thomas Broyer-2
Alternatively, if possible, you could possibly run the app with both
configurations in parallel (two executions of jetty-maven-plugin in
pre-integration-test and post-integration-test phase, using different
ports), and run you tests twice, for each app / port (two executions of
failsafe at integration-test phase)

On Fri, Oct 12, 2018 at 8:44 AM Anders Hammar <[hidden email]> wrote:

> I'd say you need two modules; one for each IT setup. Each module is a Maven
> project and will then run the integration tests. The actual integration
> test code could then be in a third module and you declare a dependency on
> that artifact.
>
> /Anders
>
> On Thu, Oct 11, 2018 at 11:21 PM Ellis, Scott <[hidden email]
> >
> wrote:
>
> > Hi,
> >
> > I have a project that builds a webapp and runs integration tests against
> > it using the failsafe plugin and the jetty-maven-plugin.
> >
> > That is, I use the jetty-maven-plugin to start jetty in the
> > pre-integration-test phase, run the tests, then shut jetty down in the
> > post-integration-test phase.
> >
> > Now, my web app can have an entirely different configuration in addition
> > to the existing one, so I need to start jetty with a new config and run a
> > new suite of tests, while maintaining all the existing functionality.
> >
> > So what I really want to do it run these phases twice:
> >
> > pre-integration-test
> > integration-test
> > post-integration-test
> >
> > First I want to run them with the my webapp configured the old way, and
> > then run the same phases again with my webapp configured the new way.
> >
> > Any advice on how to do this? The configurations can be set with system
> > properties. The problem is how to run those phases twice in that order.
> >
> > Thanks for any insight you can offer,
> > Scott
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Running integration tests twice against different webapp configurations

Paul Hammant
In reply to this post by Ellis, Scott
There's Cuppa which is super cool and allows to control such things to a
very fine level.

https://github.com/cuppa-framework/cuppa/

It is not clear that Cuppa has multi-year life though. I wish it did.

On Thu, Oct 11, 2018 at 10:21 PM Ellis, Scott <[hidden email]>
wrote:

> Hi,
>
> I have a project that builds a webapp and runs integration tests against
> it using the failsafe plugin and the jetty-maven-plugin.
>
> That is, I use the jetty-maven-plugin to start jetty in the
> pre-integration-test phase, run the tests, then shut jetty down in the
> post-integration-test phase.
>
> Now, my web app can have an entirely different configuration in addition
> to the existing one, so I need to start jetty with a new config and run a
> new suite of tests, while maintaining all the existing functionality.
>
> So what I really want to do it run these phases twice:
>
> pre-integration-test
> integration-test
> post-integration-test
>
> First I want to run them with the my webapp configured the old way, and
> then run the same phases again with my webapp configured the new way.
>
> Any advice on how to do this? The configurations can be set with system
> properties. The problem is how to run those phases twice in that order.
>
> Thanks for any insight you can offer,
> Scott
>
Reply | Threaded
Open this post in threaded view
|

RE: [SUSPICIOUS] Re: Running integration tests twice against different webapp configurations

Ellis, Scott
In reply to this post by Thomas Broyer-2
Thank you Thomas! The parallel solution worked  or me. And thanks for the other replies too.

For the record, the second jetty instance must use the run-forked goal, because  the ShutdownMonitor thread in jetty is declared static. A design flaw in my opinion. Trying to run a second jetty instance in the same vm fails with error "ShutdownMonitor already started,"  even with a different key and port.

Thanks,
Scott

-----Original Message-----
From: Thomas Broyer [mailto:[hidden email]]
Sent: Friday, October 12, 2018 2:34 AM
To: Maven Users List <[hidden email]>
Subject: [SUSPICIOUS] Re: Running integration tests twice against different webapp configurations

Alternatively, if possible, you could possibly run the app with both configurations in parallel (two executions of jetty-maven-plugin in pre-integration-test and post-integration-test phase, using different ports), and run you tests twice, for each app / port (two executions of failsafe at integration-test phase)

On Fri, Oct 12, 2018 at 8:44 AM Anders Hammar <[hidden email]> wrote:

> I'd say you need two modules; one for each IT setup. Each module is a
> Maven project and will then run the integration tests. The actual
> integration test code could then be in a third module and you declare
> a dependency on that artifact.
>
> /Anders
>
> On Thu, Oct 11, 2018 at 11:21 PM Ellis, Scott
> <[hidden email]
> >
> wrote:
>
> > Hi,
> >
> > I have a project that builds a webapp and runs integration tests
> > against it using the failsafe plugin and the jetty-maven-plugin.
> >
> > That is, I use the jetty-maven-plugin to start jetty in the
> > pre-integration-test phase, run the tests, then shut jetty down in
> > the post-integration-test phase.
> >
> > Now, my web app can have an entirely different configuration in
> > addition to the existing one, so I need to start jetty with a new
> > config and run a new suite of tests, while maintaining all the existing functionality.
> >
> > So what I really want to do it run these phases twice:
> >
> > pre-integration-test
> > integration-test
> > post-integration-test
> >
> > First I want to run them with the my webapp configured the old way,
> > and then run the same phases again with my webapp configured the new way.
> >
> > Any advice on how to do this? The configurations can be set with
> > system properties. The problem is how to run those phases twice in that order.
> >
> > Thanks for any insight you can offer, Scott
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: [SUSPICIOUS] Re: Running integration tests twice against different webapp configurations

Paul Hammant
You're explicitly calling stop() on both Jetty instances ... (pass or fail)
and not just letting it fall through to the Shutdown hook which is static ?


On Sat, Oct 13, 2018 at 1:31 AM Ellis, Scott <[hidden email]>
wrote:

> Thank you Thomas! The parallel solution worked  or me. And thanks for the
> other replies too.
>
> For the record, the second jetty instance must use the run-forked goal,
> because  the ShutdownMonitor thread in jetty is declared static. A design
> flaw in my opinion. Trying to run a second jetty instance in the same vm
> fails with error "ShutdownMonitor already started,"  even with a different
> key and port.
>
> Thanks,
> Scott
>
> -----Original Message-----
> From: Thomas Broyer [mailto:[hidden email]]
> Sent: Friday, October 12, 2018 2:34 AM
> To: Maven Users List <[hidden email]>
> Subject: [SUSPICIOUS] Re: Running integration tests twice against
> different webapp configurations
>
> Alternatively, if possible, you could possibly run the app with both
> configurations in parallel (two executions of jetty-maven-plugin in
> pre-integration-test and post-integration-test phase, using different
> ports), and run you tests twice, for each app / port (two executions of
> failsafe at integration-test phase)
>
> On Fri, Oct 12, 2018 at 8:44 AM Anders Hammar <[hidden email]> wrote:
>
> > I'd say you need two modules; one for each IT setup. Each module is a
> > Maven project and will then run the integration tests. The actual
> > integration test code could then be in a third module and you declare
> > a dependency on that artifact.
> >
> > /Anders
> >
> > On Thu, Oct 11, 2018 at 11:21 PM Ellis, Scott
> > <[hidden email]
> > >
> > wrote:
> >
> > > Hi,
> > >
> > > I have a project that builds a webapp and runs integration tests
> > > against it using the failsafe plugin and the jetty-maven-plugin.
> > >
> > > That is, I use the jetty-maven-plugin to start jetty in the
> > > pre-integration-test phase, run the tests, then shut jetty down in
> > > the post-integration-test phase.
> > >
> > > Now, my web app can have an entirely different configuration in
> > > addition to the existing one, so I need to start jetty with a new
> > > config and run a new suite of tests, while maintaining all the
> existing functionality.
> > >
> > > So what I really want to do it run these phases twice:
> > >
> > > pre-integration-test
> > > integration-test
> > > post-integration-test
> > >
> > > First I want to run them with the my webapp configured the old way,
> > > and then run the same phases again with my webapp configured the new
> way.
> > >
> > > Any advice on how to do this? The configurations can be set with
> > > system properties. The problem is how to run those phases twice in
> that order.
> > >
> > > Thanks for any insight you can offer, Scott
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Running integration tests twice against different webapp configurations

Ellis, Scott
In reply to this post by Ellis, Scott
If you try to call the start goal twice in the pre-integration-test phase, the second one fails with the IllegalStateException "ShutdownMonitor already started." It must be run-forked in order to start properly.
Thanks,
Scott

-----Original Message-----
From: Paul Hammant [mailto:[hidden email]]
Sent: Saturday, October 13, 2018 9:00 AM
To: Maven Users List <[hidden email]>
Subject: [SUSPICIOUS] Re: [SUSPICIOUS] Re: Running integration tests twice against different webapp configurations

You're explicitly calling stop() on both Jetty instances ... (pass or fail) and not just letting it fall through to the Shutdown hook which is static ?


On Sat, Oct 13, 2018 at 1:31 AM Ellis, Scott <[hidden email]>
wrote:

> Thank you Thomas! The parallel solution worked  or me. And thanks for
> the other replies too.
>
> For the record, the second jetty instance must use the run-forked
> goal, because  the ShutdownMonitor thread in jetty is declared static.
> A design flaw in my opinion. Trying to run a second jetty instance in
> the same vm fails with error "ShutdownMonitor already started,"  even
> with a different key and port.
>
> Thanks,
> Scott
>
> -----Original Message-----
> From: Thomas Broyer [mailto:[hidden email]]
> Sent: Friday, October 12, 2018 2:34 AM
> To: Maven Users List <[hidden email]>
> Subject: [SUSPICIOUS] Re: Running integration tests twice against
> different webapp configurations
>
> Alternatively, if possible, you could possibly run the app with both
> configurations in parallel (two executions of jetty-maven-plugin in
> pre-integration-test and post-integration-test phase, using different
> ports), and run you tests twice, for each app / port (two executions
> of failsafe at integration-test phase)
>
> On Fri, Oct 12, 2018 at 8:44 AM Anders Hammar <[hidden email]> wrote:
>
> > I'd say you need two modules; one for each IT setup. Each module is
> > a Maven project and will then run the integration tests. The actual
> > integration test code could then be in a third module and you
> > declare a dependency on that artifact.
> >
> > /Anders
> >
> > On Thu, Oct 11, 2018 at 11:21 PM Ellis, Scott
> > <[hidden email]
> > >
> > wrote:
> >
> > > Hi,
> > >
> > > I have a project that builds a webapp and runs integration tests
> > > against it using the failsafe plugin and the jetty-maven-plugin.
> > >
> > > That is, I use the jetty-maven-plugin to start jetty in the
> > > pre-integration-test phase, run the tests, then shut jetty down in
> > > the post-integration-test phase.
> > >
> > > Now, my web app can have an entirely different configuration in
> > > addition to the existing one, so I need to start jetty with a new
> > > config and run a new suite of tests, while maintaining all the
> existing functionality.
> > >
> > > So what I really want to do it run these phases twice:
> > >
> > > pre-integration-test
> > > integration-test
> > > post-integration-test
> > >
> > > First I want to run them with the my webapp configured the old
> > > way, and then run the same phases again with my webapp configured
> > > the new
> way.
> > >
> > > Any advice on how to do this? The configurations can be set with
> > > system properties. The problem is how to run those phases twice in
> that order.
> > >
> > > Thanks for any insight you can offer, Scott
> > >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]