File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Testing and the fly likes ant Junit vs UI Junit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "ant Junit vs UI Junit" Watch "ant Junit vs UI Junit" New topic

ant Junit vs UI Junit

vijay peyyala

Joined: Sep 18, 2003
Posts: 7
When I run a junit test class from GUI through IDE it shows "assertion failed" error when it is supposed to, but it shows "build successful" when I run "ant Junit" for the same code. Please reply to my query.
Jon Strayer
Ranch Hand

Joined: Dec 04, 2002
Posts: 133
Post your junit task.

vijay peyyala

Joined: Sep 18, 2003
Posts: 7
I am somewhat new to JUnit.
What I understand:
1. from the command "ant JUnit" is, it runs all the test cases in the project and shows the result.
2. from running a single junit test class through UI is, it just runs that class.
Am I right? if yes, then with the same code, when I run a single test class it shows me "assertion failed" when its supposed to, but it shows "build successful" through the command, "ant junit" for the whole project.
Hope I didnt present my query in a very confusing manner.
Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
"ant junit" tells us that your Ant build script has a target named "junit". However, it doesn't tell us what your "junit" target does... Also, we don't know what your test is about, which might be useful to know regarding solving the mystery.
1) post your <target name="junit" ...>...</target>
2) post your testXXX() method (the one that's failing)

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
I agree. Here's the link:
subject: ant Junit vs UI Junit
jQuery in Action, 3rd edition