You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2014/10/28 06:16:51 UTC

[Bug 57156] New: haltonfailure and haltonerror are not working with JUnit 4 tests

https://issues.apache.org/bugzilla/show_bug.cgi?id=57156

            Bug ID: 57156
           Summary: haltonfailure and haltonerror are not working with
                    JUnit 4 tests
           Product: Ant
           Version: 1.9.2
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Optional Tasks
          Assignee: notifications@ant.apache.org
          Reporter: hotterd@gmail.com

Created attachment 32154
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=32154&action=edit
the build xml file

Per the doc, the junit task setting with haltonfailure should halt the build
process if any of failures or errors happens. Similarly, haltonerror should
halt the build process if any of errors happens.  While this is true for JUnit
3 style test classes, it is not working for JUnit 4 style test classes.

Tested with ant 1.9.2 and junit 4.11.

Reproduce steps:
====

1. download attached build file and junit files, placed them into the same dir

2. modify the location of junit jar as needed in junit.xml at line 6

3. ant -f junit.xml build
   // this builds the junit 3 style class HellowWorldTest.java and junit 4
style class HellowWorldJUnit4.java

4. ant -f junit.xml runJUnit3
   // you can see the junit run halts as expected as soon as the first failure
occurs.

5. ant -f junit.xml runJUnit4
   // you can see it does not halt after the failure occurs.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 57156] haltonfailure and haltonerror are not working with JUnit 4 tests

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57156

Gan Dong <ho...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hotterd@gmail.com

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 57156] haltonfailure and haltonerror are not working with JUnit 4 tests

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57156

--- Comment #3 from Michael Clarke <mc...@apache.org> ---
I've not tried running this yet, but can you give more detail:
1. Is the issue that JUnit runs the rest of the test class, or the rest of the
suite instead of halting (i.e. how much further does JUnit go than was
expected)?
2. Is JUnit 4 haltonerror something that has worked for you previously, has it
never worked for JUnit 4, or have you not tried it it any other version of Ant?

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 57156] haltonfailure and haltonerror are not working with JUnit 4 tests

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57156

--- Comment #1 from Gan Dong <ho...@gmail.com> ---
Created attachment 32155
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=32155&action=edit
JUnit 3 style class

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 57156] haltonfailure and haltonerror are not working with JUnit 4 tests

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57156

--- Comment #4 from Gan Dong <ho...@gmail.com> ---
Thanks for looking into this.

Replied inline:

(In reply to Michael Clarke from comment #3)
> I've not tried running this yet, but can you give more detail:
> 1. Is the issue that JUnit runs the rest of the test class, or the rest of
> the suite instead of halting (i.e. how much further does JUnit go than was
> expected)?

It does not stop until the end of the run (i.e. All the rest of the test class
and suite are going to run). It only changes the result status from "BUILD
SUCCESSFUL" to "BUILD FAILED".

> 2. Is JUnit 4 haltonerror something that has worked for you previously, has
> it never worked for JUnit 4, or have you not tried it it any other version
> of Ant?

No, I think it never worked for JUnit 4 as I went through the ant code and
junit code. I haven't try older versions of ant, but I don't think that'll make
a difference.



Thanks,
Gan

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 57156] haltonfailure and haltonerror are not working with JUnit 4 tests

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57156

--- Comment #2 from Gan Dong <ho...@gmail.com> ---
Created attachment 32156
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=32156&action=edit
JUnit 4 style class

-- 
You are receiving this mail because:
You are the assignee for the bug.