|
|
Thursday, November 4, 2004
|
|
| |
A common complaint of Maven's
integrated testing plugin is that it only allows you to define a
single test suite. I figured out a way to implement alternate test
suites by tweaking the project configuration and adding a little extra
jelly script. It would be nice if this was a standard feature of
Maven, but at least the amount of extra jelly required is minimal.
In my case, I wanted an acceptance testing suite that contained all
the integrated components tested as a whole.
- I put the acceptance tests in
${project.home}/src/acceptance-test (instead of
the Maven standard ${project.home}/src/test).
- I set the property
maven.test.search.classdir=true
in project.properties.
- I set the include pattern for tests in
project.xml
as **/*Test.*. This is because setting
maven.test.search.classdir=true requires Maven to
search for tests by class, not by source file. Doing this
allows Maven to find the unit tests in the unit test output
directory and the acceptance tests in the acceptance test
output directory.
- I put the following jelly code in
maven.xml. If
you wish, you can keep it in a separate file (say
acceptance-test.xml) and import it in your main
maven.xml with a <j:import inherit="true"
file="${basedir}/acceptance-test.xml" /> import
statement.
<?xml version="1.0"?>
<project xmlns:j="jelly:core"
xmlns:maven="jelly:maven"
xmlns:u="jelly:util"
xmlns:define="jelly:define"
xmlns:ant="jelly:ant">
<goal name="acceptance:init">
<j:set var="maven.test.dest" value="${maven.build.dir}/acc-test-classes" />
<j:set var="maven.test.reportsDirectory" value="${maven.build.dir}/acc-test-reports" />
<j:set var="maven.test.searchdir" value="${maven.src.dir}/acceptance-test" />
<ant:path id="maven.test.compile.src.set">
<ant:pathelement location="${maven.test.searchdir}" />
</ant:path>
</goal>
<goal name="acceptance:compile">
<attainGoal name="acceptance:init" />
<attainGoal name="test:compile" />
</goal>
<goal name="acceptance:test">
<attainGoal name="acceptance:init" />
<attainGoal name="test:test" />
</goal>
<goal name="acceptance:single">
<attainGoal name="acceptance:init" />
<attainGoal name="test:single" />
</goal>
</project>
4:50:28 PM
|
|
A critical part of XP is automated acceptance testing, whether
through the "Story-test driven development" of using FIT and fixtures
or through some other mechansim. A whole crop of functional web
testing frameworks exist of various quality:
Recently I came across an interesting
approach that combines Latka with Apache JMeter's proxy
record functionality and uses Maven to record a Latka script. Yeah, I
know, maven, latka and jelly, the bane of a java open source, but it
could be a quick way to get some web acceptance testing going.
11:26:48 AM
|
|
|
|
© Copyright
2005
Nick Sieger.
Last update:
2/3/05; 11:01:00 PM.
This theme is based on the SoundWaves
(blue) Manila theme. |
|
| November 2004 |
| Sun |
Mon |
Tue |
Wed |
Thu |
Fri |
Sat |
| |
1 |
2 |
3 |
4 |
5 |
6 |
| 7 |
8 |
9 |
10 |
11 |
12 |
13 |
| 14 |
15 |
16 |
17 |
18 |
19 |
20 |
| 21 |
22 |
23 |
24 |
25 |
26 |
27 |
| 28 |
29 |
30 |
|
|
|
|
| Oct Dec |
|