You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by le...@cocoon.apache.org on 2004/07/02 21:53:09 UTC
[Cocoon Lenya Wiki] Updated: AntTaskTests
Date: 2004-07-02T12:53:09
Editor: ChristianEgli <eg...@apache.org>
Wiki: Cocoon Lenya Wiki
Page: AntTaskTests
URL: http://wiki.apache.org/cocoon-lenya/AntTaskTests
no comment
Change Log:
------------------------------------------------------------------------------
@@ -1,11 +1,11 @@
-== The !AntTaskTest Class ==
+== The AntTaskTest Class ==
The class {{{org.apache.lenya.cms.task.AntTaskTest}}} tests an {{{AntTask}}}-based task.
It ensures that no exception is thrown during execution and that the logfile
is created at the appropriate location. To use the {{{AntTaskTest}}} for your
specific task, just specify the target as a command line parameter.
-== Overriding the !AntTaskTest ==
+== Overriding the AntTaskTest ==
To test your own {{{AntTask}}}-based task, you can extend the
class {{{AntTaskTest}}}:
@@ -15,52 +15,51 @@
You can use the following template:
-{{{
-public class MyTest extends AntTaskTest {
-
- /** Creates a new object. */
- public MyTest(String test) {
- super(test);
- }
-
- /** Creates a test suite. */
- public static Test getSuite() {
- return new TestSuite(MyTest.class);
- }
-
- /**
- * The main program.
- * @param args The command line arguments
- */
- public static void main(String[] args) {
- AntTaskTest.initialize(args);
- TestRunner.run(getSuite());
- }
-
- public static final String DOCUMENT_ID = "tutorial";
-
- /** Checks if the test produced the correct results. */
- protected void evaluateTest() throws IOException {
- ...
- }
-
- /** Returns the task parameters. */
- protected Parameters getTaskParameters() {
- Parameters parameters = super.getTaskParameters();
- parameters.setParameter("properties.mytask.documentid", DOCUMENT_ID);
- return parameters;
- }
-
- /** Returns the target to execute. */
- protected String getTarget() {
- return "mytask";
- }
-}
+{{{
+public class MyTest extends AntTaskTest {
+
+ /** Creates a new object. */
+ public MyTest(String test) {
+ super(test);
+ }
+
+ /** Creates a test suite. */
+ public static Test getSuite() {
+ return new TestSuite(MyTest.class);
+ }
+
+ /**
+ * The main program.
+ * @param args The command line arguments
+ */
+ public static void main(String[] args) {
+ AntTaskTest.initialize(args);
+ TestRunner.run(getSuite());
+ }
+
+ public static final String DOCUMENT_ID = "tutorial";
+
+ /** Checks if the test produced the correct results. */
+ protected void evaluateTest() throws IOException {
+ ...
+ }
+
+ /** Returns the task parameters. */
+ protected Parameters getTaskParameters() {
+ Parameters parameters = super.getTaskParameters();
+ parameters.setParameter("properties.mytask.documentid", DOCUMENT_ID);
+ return parameters;
+ }
+
+ /** Returns the target to execute. */
+ protected String getTarget() {
+ return "mytask";
+ }
+}
}}}
-== Using a Separate !TestCase for Evaluation ==
+== Using a Separate TestCase for Evaluation ==
If you want to write your own !TestCase to check if everything is
OK, you can use the {{{AntTaskTest}}} class as it is.
-Just pass the target as a command-line argument and add your
-=== TestCase to the same target in ==={{{test-build.xml}}}.
+Just pass the target as a command-line argument and add your !TestCase to the same target in {{{test-build.xml}}}.
---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-dev-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-dev-help@cocoon.apache.org