You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2006/02/28 21:50:37 UTC

DO NOT REPLY [Bug 38811] New: - Support JUnit 4

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38811>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38811

           Summary: Support JUnit 4
           Product: Ant
           Version: 1.6.5
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: Optional Tasks
        AssignedTo: jglick@netbeans.org
        ReportedBy: jglick@netbeans.org
                CC: dev@ant.apache.org,mpetras@netbeans.org


Currently Ant's <junit> is designed for JUnit 3.x. It is possible to run JUnit 4
tests (i.e. those which use annotations and do not extend TestCase) only if you
pollute your test code with the otherwise unnecessary

  public static Test suite() {
    return new JUnit4TestAdapter(ThisTest.class);
  }

Otherwise, running under Ant 1.6.5 you just get

junit.framework.AssertionFailedError: No tests found in MyTest

Ant can be patched to always accept JUnit 3.x tests, and to also accept "pure"
JUnit 4.x tests when junit-4.0.jar is in the classpath. Note that in the latter
case you _must_ be running on JDK 5 or later; even the "legacy" classes use the
JDK 5 classfile format.

Not terribly complicated but involves a bit of fine-tuning since the two
frameworks have some subtle differences. Patch tries to accomplish:

1. No change in behavior when using junit-3.x.jar.

2. Use junit-4.0.jar to run JUnit 3.x tests transparently in compatibility mode.
Use junit-4.0.jar to run JUnit 4.x tests transparently (currently also in
compatibility mode, to keep the task relatively simple). No user configuration
or change in <junit> task signature.

3. Treat Assert.* failures as real failures, not errors.

4. Use the @Test-annotated method name as the test case name in the expected way.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

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


DO NOT REPLY [Bug 38811] - Support JUnit 4

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38811>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38811





------- Additional Comments From jglick@netbeans.org  2006-02-28 22:06 -------
Created an attachment (id=17809)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=17809&action=view)
Manual test case

Checks successes, failures, and errors in 3-type and 4-type test classes.
Output ought to look similar.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

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


DO NOT REPLY [Bug 38811] - Support JUnit 4

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38811>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38811


jkf@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Matt.Eland@GMail.com




------- Additional Comments From jkf@apache.org  2006-09-04 04:22 -------
*** Bug 40406 has been marked as a duplicate of this bug. ***

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

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


DO NOT REPLY [Bug 38811] - Support JUnit 4

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38811>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38811





------- Additional Comments From jglick@netbeans.org  2006-03-01 23:11 -------
Tweak in revision 382127.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

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


DO NOT REPLY [Bug 38811] - Support JUnit 4

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38811>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38811


jglick@netbeans.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sonya_quist@yahoo.com




------- Additional Comments From jglick@netbeans.org  2006-08-22 23:54 -------
*** Bug 40289 has been marked as a duplicate of this bug. ***

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

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


DO NOT REPLY [Bug 38811] - Support JUnit 4

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38811>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38811


jglick@netbeans.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |1.7




------- Additional Comments From jglick@netbeans.org  2006-02-28 22:07 -------
revision 381780

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

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