/* JsUnit - a JUnit port for JavaScript Copyright (C) 2007 Joerg Schaible Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /*! \htmlonly
\endhtmlonly \page maven2 Apache Maven 2

Maven 2 is a build tool from the Apache Software Foundation generally used for Java development. It uses a Project Object Model defined in a pom.xml file to describe the build. Maven 2 uses a lifecycle where at each phase of this lifecycle different goals can be attached that are provided by plugins. The JsUnit plugin is automatically attached to the test test phase.

The JsUnit plugin uses \ref rhino to perform the JavaScript tests.

\section m2repo The Maven 2 Repository at BerliOS The artifacts of JsUnit and its plugin is located in the Maven 2 repository at BerliOS. The released versions will also be available at Maven's central repository, but the upload procedure may cause some time gap. The reports generated by Maven are also available. \section m2plugin Using the Maven 2 Plugin

The JsUnit Maven plugin has simply to be declared in the build section with the other plugins. As usual with Maven 2 all necessary dependencies are automatically available. The plugin itself is published with groupId de.berlios.jsunit and artifactDi jsunit-maven2-plugin in the Maven repository of JsUnit at BerliOS and in Maven's central repository also.

The configuration section of the plugin has following elements:

Name Description Default
printSummary A flag to enable a summary for the performed unit tests. ${maven.test.skip}
reportsDirectory The directory where the plugin writes the results of the unit tests. ${project.build.directory}/surefire-reports
skip A flag to skip the JavaScript unit tests completely. ${maven.test.skip}
skipExec A flag to skip the execution of the JavaScript unit tests, but the JavaScript code is still loaded into the JavaScript engine to detect possible syntax problems. ${maven.test.skip.exec}
sourceDirectory The root directory for the JavaScript sources. All source declarations are relative to this setting. ${basedir}/src/main/webapp/js
sources An array of source elements. Each element contains a name to a JavaScript source file (relative to the path given in sourceDirectory). The sequence of the source elements define the sequence the files are loaded into the JavaScript engine. ${basedir}/src/main/webapp/js
testFailureIgnore A flag to allow the current build to continue ignoring possible test failures. ${maven.test.failure.ignore}
testSourceDirectory The root directory for the JavaScript unit test sources. All include declarations in a testSuite are relative to this setting. ${basedir}/src/test/js
testSuites An array of testSuite elements.  

A testSuite contains following elements:

Name Description Default
includes An array of include elements. Each element defines a file pattern with a name relative to the testSourceDirectory element.  
name The name of the test suite.  
type The type of the test suite, one of the following values:
ALLTESTS
Looks for a class AllTests derived from TestSuite and runs its suite.
TESTSUITES
Looks for all classes ending with TestSuite and that are derived from TestSuite and run their suites.
TESTCASES
Looks for all classes ending with TestCase and that are derived from TestCase and runs them (the default).
TESTCASES
\section m2example Example build.xml The following JsUnit plugin declaration is used in the POM file of the samples directory. \dontinclude pom.xml \skip \until \htmlonly
\endhtmlonly */