diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java index f25e5ce7f..13ad520b2 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java @@ -64,7 +64,12 @@ import java.util.*; import java.io.File; /** - * Create JUnitTests from a list of files. + *
Create then run JUnitTest
's based on the list of files given by the fileset attribute.
+ *
+ *
Every A wrapper for the implementations of For example,
+ * Either the Quick way to use a standard formatter.
+ *
+ * At the moment, there are three supported standard formatters.
+ * Sets Set name of class to be used as the formatter.
+ *
+ * This class must implement Set the file which the formatte should log to.
+ *
+ * Note that logging to file must be enabled .
+ */
void setOutfile(File out) {
this.outFile = out;
}
+ /**
+ * Set output stream for formatter to use.
+ *
+ * Defaults to standard out.
+ */
public void setOutput(OutputStream out) {
this.out = out;
}
+ /**
+ * Set whether the formatter should log to file.
+ */
public void setUseFile(boolean useFile) {
this.useFile = useFile;
}
+ /**
+ * Get whether the formatter should log to file.
+ */
boolean getUseFile() {
return useFile;
}
@@ -160,7 +212,9 @@ public class FormatterElement {
}
/**
- * Enumerated attribute with the values "plain" and "xml".
+ * Enumerated attribute with the values "plain", "xml" and "brief".
+ *
+ * Use to enumerate options for Run a single JUnit test.
+ *
+ * The JUnit test is actually run by {@link JUnitTestRunner}.
+ * So read the doc comments for that class :)
*
* @author Thomas Haas
* @author Stefan Bodewig,
* @author Stephane Bailliez
+ *
+ * @see JUnitTask
+ * @see JUnitTestRunner
*/
public class JUnitTest extends BaseTest {
@@ -99,19 +106,30 @@ public class JUnitTest extends BaseTest {
this.haltOnFail = haltOnFail;
}
+ /**
+ * Set the name of the test class.
+ */
public void setName(String value) {
name = value;
}
+ /**
+ * Set the name of the output file.
+ */
public void setOutfile(String value) {
outfile = value;
}
+ /**
+ * Get the name of the test class.
+ */
public String getName() {
return name;
}
/**
+ * Get the name of the output file
+ *
* @return the name of the output file.
*/
public String getOutfile() {
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
index 3021a7172..5d57aa469 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
@@ -70,12 +70,15 @@ import java.util.Vector;
*
* This TestRunner expects a name of a TestCase class as its
* argument. If this class provides a static suite() method it will be
- * called and the resulting Test will be run.
+ * called and the resulting Test will be run. So, the signature should be
+ * Otherwise all public methods starting with "test" and taking no
- * argument will be run.
+ * If no such method exists, all public methods starting with "test" and taking no
+ * argument will be run.
*
- * Summary output is generated at the end.
+ * Summary output is generated at the end.
*
* @author Stefan Bodewig
* @author Erik Hatcher
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLConstants.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLConstants.java
index 303968b21..ede45026c 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLConstants.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLConstants.java
@@ -54,12 +54,14 @@
package org.apache.tools.ant.taskdefs.optional.junit;
/**
- * Interface that groups all constants used throughout the XML
+ * Interface groups XML constants.
+ * Interface that groups all constants used throughout the XML
* documents that are generated by the XMLJUnitResultFormatter
* As of now the DTD is:
- *
+ * This is an helper class that will aggregate all testsuites under a specific
* directory and create a new single document. It is not particulary clean but
* should be helpful while I am thinking about another technique.
*
- * The main problem is due to the fact that a JVM can be forked for a testcase
+ * The main problem is due to the fact that a JVM can be forked for a testcase
* thus making it impossible to aggregate all testcases since the listener is
* (obviously) in the forked JVM. A solution could be to write a
* TestListener that will receive events from the TestRunner via sockets. This
@@ -119,7 +119,7 @@ public class XMLResultAggregator extends Task implements XMLConstants {
/**
* Set the name of the file aggregating the results. It must be relative
- * from the todir attribute. If not set it will use {@link DEFAULT_FILENAME}
+ * from the todir attribute. If not set it will use {@link #DEFAULT_FILENAME}
* @param value the name of the file.
* @see #setTodir(File)
*/
@@ -129,7 +129,7 @@ public class XMLResultAggregator extends Task implements XMLConstants {
/**
* Set the destination directory where the results should be written. If not
- * set if will use {@link DEFAULT_DIR}. When given a relative directory
+ * set if will use {@link #DEFAULT_DIR}. When given a relative directory
* it will resolve it from the project directory.
* @param value the directory where to write the results, absolute or
* relative.
@@ -172,7 +172,7 @@ public class XMLResultAggregator extends Task implements XMLConstants {
}
/**
- * get the full destination file where to write the result. It is made of
+ * Get the full destination file where to write the result. It is made of
* the todir and tofile attributes.
* @return the destination file where should be written the result file.
*/
@@ -187,6 +187,8 @@ public class XMLResultAggregator extends Task implements XMLConstants {
}
/**
+ * Get all Create a DOM tree.
+ * Has 'testsuites' as firstchild and aggregates all
* testsuite results that exists in the base directory.
* @return the root element of DOM tree that aggregates all testsuites.
*/
@@ -277,9 +280,10 @@ public class XMLResultAggregator extends Task implements XMLConstants {
}
/**
- * Add a new testsuite node to the document, the main difference is that it
+ * Add a new testsuite node to the document.
+ * The main difference is that it
* split the previous fully qualified name into a package and a name.
- * For example: org.apache.Whatever will be splitted in
+ * For example: org.apache.Whatever will be split into
* org.apache and Whatever.
* @param root the root element to which the testsuite node should
* be appended.
.java
or .class
file in the fileset is
+ * assumed to be a testcase.
+ * A JUnitTest
is created for each of these named classes with basic setup
+ * inherited from the parent BatchTest
.
*
* @author Jeff Martin
* @author Stefan Bodewig
@@ -99,10 +104,9 @@ public final class BatchTest extends BaseTest {
}
/**
- * return all JUnitTest instances obtain by applying the fileset rules.
+ * Return all JUnitTest instances obtain by applying the fileset rules.
* @return an enumeration of all elements of this batchtest that are
* a JUnitTest instance.
- * @see addTestsTo(Vector)
*/
public final Enumeration elements(){
JUnitTest[] tests = createAllJUnitTest();
@@ -142,7 +146,7 @@ public final class BatchTest extends BaseTest {
* Iterate over all filesets and return the filename of all files
* that end with .java or .class. This is to avoid
* wrapping a JUnitTest over an xml file for example. A Testcase
- * is obviouslly a java file (compiled or not).
+ * is obviously a java file (compiled or not).
* @return an array of filenames without their extension. As they should
* normally be taken from their root, filenames should match their fully
* qualified class name (If it is not the case it will fail when running the test).
@@ -172,7 +176,7 @@ public final class BatchTest extends BaseTest {
}
/**
- * convenient method to convert a pathname without extension to a
+ * Convenient method to convert a pathname without extension to a
* fully qualified classname. For example org/apache/Whatever will
* be converted to org.apache.Whatever
* @param filename the filename to "convert" to a classname.
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java
index 5c9f84229..0a63415fe 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java
@@ -61,7 +61,11 @@ import junit.framework.*;
/**
* Prints plain text output of the test to a specified Writer.
* Inspired by the PlainJUnitResultFormatter.
+ *
* @author Robert Watkins
+ *
+ * @see FormatterElement
+ * @see PlainJUnitResultFormatter
*/
public class BriefJUnitResultFormatter implements JUnitResultFormatter {
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/FormatterElement.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/FormatterElement.java
index 53ab58e7f..a985a69a6 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/FormatterElement.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/FormatterElement.java
@@ -62,10 +62,26 @@ import java.io.FileOutputStream;
import java.io.OutputStream;
/**
- * Serves as a wrapper the implementations of JUnitResultFormatter,
- * for example as a nested JUnitResultFormatter
.
+ * In particular, used as a nested <formatter>
element in a <junit>
task.
+ *
+ * adds a
+ * <junit printsummary="no" haltonfailure="yes" fork="false">
+ * <formatter type="plain" usefile="false" />
+ * <test name="org.apache.ecs.InternationalCharTest" />
+ * </junit>
plain
type implementation (PlainJUnitResultFormatter
) to display the results of the test.
+ *
+ * type
or the classname
attribute
+ * must be set.
*
* @author Stefan Bodewig
+ *
+ * @see JUnitTask
+ * @see XMLJUnitResultFormatter
+ * @see BriefJUnitResultFormatter
+ * @see PlainJUnitResultFormatter
+ * @see JUnitResultFormatter
*/
public class FormatterElement {
@@ -75,6 +91,18 @@ public class FormatterElement {
private File outFile;
private boolean useFile = true;
+ /**
+ *
+ *
+ *
+ * xml
type uses a XMLJUnitResultFormatter
.
+ * brief
type uses a BriefJUnitResultFormatter
.
+ * plain
type (the default) uses a PlainJUnitResultFormatter
.
+ * classname
attribute - so you can't use that attribute if you use this one.
+ */
public void setType(TypeAttribute type) {
if ("xml".equals(type.getValue())) {
setClassname("org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter");
@@ -89,10 +117,18 @@ public class FormatterElement {
}
}
+ /**
+ * JUnitResultFormatter
+ */
public void setClassname(String classname) {
this.classname = classname;
}
+ /**
+ * Get name of class to be used as the formatter.
+ */
public String getClassname() {
return classname;
}
@@ -105,18 +141,34 @@ public class FormatterElement {
return extension;
}
+ /**
+ * type
attribute.
*/
public static class TypeAttribute extends EnumeratedAttribute {
public String[] getValues() {
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTest.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTest.java
index a7a17294a..3646b9b6b 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTest.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTest.java
@@ -64,10 +64,17 @@ import java.util.Properties;
import java.util.Vector;
/**
+ *
*
- *
+ * public static junit.framework.Test suite()
+ *
* @author Stephane Bailliez
* @see XMLJUnitResultFormatter
* @see XMLResultAggregator
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java
index ed45cca24..b93642357 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java
@@ -72,6 +72,8 @@ import junit.framework.TestCase;
*
* @author Stefan Bodewig
* @author Erik Hatcher
+ *
+ * @see FormatterElement
*/
public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstants {
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java
index e3a384ac6..9cd3b38c9 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java
@@ -79,11 +79,11 @@ import org.apache.tools.ant.util.DOMElementWriter;
/**
- * This is an helper class that will aggregate all testsuites under a specific
+ *
* <----------------- @todo describe DTDs ---------------------->
*
+ *
.xml
files in the fileset.
+ *
* @return all files in the fileset that end with a '.xml'.
*/
protected File[] getFiles() {
@@ -234,7 +236,8 @@ public class XMLResultAggregator extends Task implements XMLConstants {
}
/**
- * Create a DOM tree with firstchild as 'testsuites' and aggregates all
+ *