You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Jan Nielsen <ja...@gmail.com> on 2007/10/13 01:56:02 UTC

Functional Testing of Web Applications

We are new to Maven and Selenium. We are developing a set of portlets
and have chosen to use Selenium to test the functionality of these
web-applications (each portlet is a web-application). To be tested,
the portlets must be compiled, packaged into a WAR, and deployed to
our portal. Then the Selenium functional tests must be executed on
each of the portlets. The Selenium Plug-ins for Maven allow us to
start the Selenium server appropriately, but it seems like we need to
execute Maven twice to get to do the functional testing:

  mvn compile package deploy
  mvn test (or mvn integration-test)

Seems like the Maven build lifecycle does not have good support for this:

  validate
  generate-sources
  process-sources
  generate-resources
  process-resources
  compile
  process-classes
  generate-test-sources
  process-test-sources
  generate-test-resources
  process-test-resources
  test-compile
  test
  prepare-package (2.1)
  package
  pre-integration-test
  integration-test
  post-integration-test
  verify
  install
  deploy

We have to "deploy" our portlets before we can do the
"integration-test", right!?! Is there a way to define our own phases
to do what we need? One solution is to wrap Maven with another tool
like Ant to do the steps we need done, but I'm hoping a more elegant
solution is available...

Any thoughts you are willing share are greatly appreciated.


Thanks,

-Jan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Functional Testing of Web Applications

Posted by Wendy Smoak <ws...@gmail.com>.
[moved to users@maven from dev]

On 10/13/07, Jan Nielsen <ja...@gmail.com> wrote:
> Ahh, thanks, Wendy - if the "deploy" is just a deploy to the
> repository then, presumably, we would execute an
> application-server-deploy of the package artifact during the
> "pre-integration-test" phase, right?
>
> Our project is structured as a multi-module project ala Proficio with
> pom.xml files at each module level:
>
>   foo-bar\widget\widget-api\src\main\java
>   foo-bar\widget\widget-cli\src\main\java
>   foo-bar\widget\widget-cli\src\test\java
>   foo-bar\widget\widget-jsf-portlet\src\main\java
>   foo-bar\widget\widget-jsf-portlet\src\main\webapp\WEB-INF\classes
>   foo-bar\widget\widget-jsf-portlet\src\main\webapp\jsp
>   foo-bar\widget\widget-jsf-portlet\src\test
>   foo-bar\widget\widget-jsf-portlet\src\test\java
>   foo-bar\widget\widget-jsf-portlet\web
>   foo-bar\widget\widget-jsf-portlet\web\WEB-INF
>   foo-bar\widget\widget-migration\src\main\java
>   foo-bar\widget\widget-migration\src\test\java
>   foo-bar\widget\widget-persistence\src\main\java
>   foo-bar\widget\widget-persistence\src\test\java
>   foo-bar\widget\src\site\xdoc
>   foo-bar\migration\src\main\java\foo
>   foo-bar\migration\src\schema
>   foo-bar\migration\src\test\java
>   foo-bar\resources
>   foo-bar\src\site\resources
>   foo-bar\src\site\xdoc
>
> The functional tests are not currently in a separate module, though
> that is something we are considering. Is there an advantage to this?

Yes.  You typically don't want to run this kind of test every time you
build, and having them in a separate module makes it easier to control
when they run.  Also, Maven's support for integration testing isn't as
good as for regular unit testing.  But it can work as long as you
don't _also_ have unit tests in that same module.

There are some notes on the wiki:
http://docs.codehaus.org/display/MAVENUSER/Maven+and+Integration+Testing

If you're using Surefire to execute the tests, then you can use the
usual test phase.  Or, you can use 'pom' packaging and explicitly bind
executions of things where you need them.  Take a look at Cargo to
start and stop the app server.  It's best done with the Java API and
not with the Maven plugin.

There are also some issues with the order of the phases-- as you
pointed out, deploy is at the end, right after install (to the local
repo).  So if your test tries to grab something from the repository,
be aware that you're not testing the current build.

I haven't worked on this problem for quite a while so I'm sure more
progress has been made.

-- 
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Functional Testing of Web Applications

Posted by Wendy Smoak <ws...@gmail.com>.
On 10/13/07, Jan Nielsen <ja...@gmail.com> wrote:

> Ahh, thanks, Wendy - if the "deploy" is just a deploy to the
> repository then, presumably, we would execute an
> application-server-deploy of the package artifact during the
> "pre-integration-test" phase, right?
...

Oops, I didn't notice this was on the dev list.  Let's move over to
user@ for this, I'll follow up there.

-- 
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Functional Testing of Web Applications

Posted by Jan Nielsen <ja...@gmail.com>.
Ahh, thanks, Wendy - if the "deploy" is just a deploy to the
repository then, presumably, we would execute an
application-server-deploy of the package artifact during the
"pre-integration-test" phase, right?

Our project is structured as a multi-module project ala Proficio with
pom.xml files at each module level:

  foo-bar\widget\widget-api\src\main\java
  foo-bar\widget\widget-cli\src\main\java
  foo-bar\widget\widget-cli\src\test\java
  foo-bar\widget\widget-jsf-portlet\src\main\java
  foo-bar\widget\widget-jsf-portlet\src\main\webapp\WEB-INF\classes
  foo-bar\widget\widget-jsf-portlet\src\main\webapp\jsp
  foo-bar\widget\widget-jsf-portlet\src\test
  foo-bar\widget\widget-jsf-portlet\src\test\java
  foo-bar\widget\widget-jsf-portlet\web
  foo-bar\widget\widget-jsf-portlet\web\WEB-INF
  foo-bar\widget\widget-migration\src\main\java
  foo-bar\widget\widget-migration\src\test\java
  foo-bar\widget\widget-persistence\src\main\java
  foo-bar\widget\widget-persistence\src\test\java
  foo-bar\widget\src\site\xdoc
  foo-bar\migration\src\main\java\foo
  foo-bar\migration\src\schema
  foo-bar\migration\src\test\java
  foo-bar\resources
  foo-bar\src\site\resources
  foo-bar\src\site\xdoc

The functional tests are not currently in a separate module, though
that is something we are considering. Is there an advantage to this?

Thanks,

-Jan

On 10/12/07, Wendy Smoak <ws...@gmail.com> wrote:
> On 10/12/07, Jan Nielsen <ja...@gmail.com> wrote:
>
> > package
> > pre-integration-test
> > integration-test
> > post-integration-test
> > verify
> > install
> > deploy
> ...
> > We have to "deploy" our portlets before we can do the
> > "integration-test", right!?!
> ...
> >
> > Any thoughts you are willing share are greatly appreciated.
>
> The 'deploy' phase in the Maven build lifecycle is for deploying to
> the artifact repository, not to an application server.
>
> How is your project structured?  Are the functional tests in a separate module?
>
> --
> Wendy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Functional Testing of Web Applications

Posted by Wendy Smoak <ws...@gmail.com>.
On 10/12/07, Jan Nielsen <ja...@gmail.com> wrote:

> package
> pre-integration-test
> integration-test
> post-integration-test
> verify
> install
> deploy
...
> We have to "deploy" our portlets before we can do the
> "integration-test", right!?!
...
>
> Any thoughts you are willing share are greatly appreciated.

The 'deploy' phase in the Maven build lifecycle is for deploying to
the artifact repository, not to an application server.

How is your project structured?  Are the functional tests in a separate module?

-- 
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org