Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ant junit tests expected exception always fail

 
Robert Panivino
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Having the above type of test, the ant task confirms that the correct exception is indeed thrown, but it registers the test as failed, because it probably isn't smart enough to parse the expected property on the @Test annotation.

Does anyone have any ideas how to not change the tests and fix this annoying issue?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34178
340
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Robert,
Welcome to CodeRanch!

Does your test class extend TestCase by any chance? If so, it is running the test as a JUnit 3.8 test which would ignore the annotation completely.
 
Robert Panivino
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote:Robert,
Welcome to CodeRanch!

Does your test class extend TestCase by any chance? If so, it is running the test as a JUnit 3.8 test which would ignore the annotation completely.


Thank you, it's nice to be here.

I forgot to update my status. I had a few errors - and my Test class doesn't extend anything related to junit tests, only the methods are adnotated.
Firstly,
<jvmarg value="-Djboss.server.home.dir=${jboss.server.home.dir}" />
^ that does nothing when fork is set to false. Secondly, it seems that for some reason I had two ant libraries, one in eclipse and one in jboss. If I ran the corrected ant file in the command line, it would work properly, so I had to solve the double library issue.
And finally, in windows each command is limited to ~8k characters, thus a complex classpath will screw you, so I had to switch to linux.

Now I've got to do the jenkins integration, hopefully it won't be as annoying.

Thank you and have a nice day.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34178
340
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for posting the solution.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic