hakandilek / spock

Automatically exported from code.google.com/p/spock
0 stars 0 forks source link

No junit failure description in ant 1.8 #147

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Currently 0.4 fails to output the reason for a failure when running ant 1.8 and 
junit 4.8 in classpath. The test will fail but the excellent description gets 
lost. Without this spock cannot be used in organizations building with a 
current ant release. 

To reproduce follow the ant getting started documentation and introduce a 
failing assertion (like replacing 5 with 55). 

With ANT_HOME set to 1.8.1 you get
 [junit] Testcase: can you figure out what I'm up to?(HelloSpock): FAILED
 [junit] null
 [junit] junit.framework.AssertionFailedError
 [junit]    at HelloSpock.can you figure out what I'm up to?(HelloSpock.groovy:6)

But with ANT_HOME set to 1.7.1 you get

   [junit] Testcase: can you figure out what I'm up to? took 0.17 sec
    [junit]     Caused an ERROR
    [junit] null
    [junit] Condition not satisfied:
    [junit] 
    [junit] name.size() == size
    [junit] |    |      |  |
    [junit] |    5      |  55
    [junit] Spock       false
    [junit] 
    [junit]     at HelloSpock.can you figure out what I'm up to?(HelloSpock.groovy:6)
    [junit] 
    [junit] Test HelloSpock FAILED

Following is on the classpath
$ ls lib
geb-core-0.4.jar        
groovy-all-1.7.2.jar        
maven-ant-tasks-2.1.1.jar   
spock-core-0.4-groovy-1.7.jar
geb-spock-0.4.jar       
junit-4.8.1.jar         
selenium-common-2.0a5.jar

A workaround is to use "-lib /usr/share/java/ant-1.7.1/lib/ant-junit.jar" 
argument to ant (1.8) or otherwise downgrading the junit task to 1.7 - but that 
is likely to cause other problems in the build. Another option may be a spock 
test-runner that discovers specs and runs them and returns a error code for the 
number of failures.

Original issue reported on code.google.com by peter.lu...@gmail.com on 25 Nov 2010 at 11:54

GoogleCodeExporter commented 9 years ago
0.5-SNAPSHOT fixes this problem, although the output now appears twice. I'll 
see if I can do something about that.

Original comment by pnied...@gmail.com on 25 Nov 2010 at 12:47

GoogleCodeExporter commented 9 years ago
With Ant 1.8.1 and Spock 0.5-SNAPSHOT, I'm getting the exact same output for 
specs as for JUnit tests. It's unfortunate that Ant prints exception output 
twice (once getMessage(), once toString()), but again the same problem exists 
for JUnit tests. Here is how I have configured the Ant JUnit task: 
http://code.google.com/p/spock/source/browse/branches/groovy-1.7/spock-example/b
uild.xml

If you are still experiencing problems, please raise a new issue.

Original comment by pnied...@gmail.com on 9 Dec 2010 at 12:01

GoogleCodeExporter commented 9 years ago
Great thank you!
What are the plans for 0.5? Given the usability and stability of spock I would 
consider bumping to 1.0 to ease spreading and acceptance in conservative 
organizations.

Original comment by peter.lu...@gmail.com on 9 Dec 2010 at 7:51

GoogleCodeExporter commented 9 years ago
Release of 0.5 is imminent. I agree that going 1.0 is important, but I won't 
make any promises.

Original comment by pnied...@gmail.com on 9 Dec 2010 at 12:06