• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to use JUnit with Eclipse ?

 
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I'm new guy in JUtit testing,
Now, i'm study in JUnit with Eclipse ....

How to use JUnit with Eclipse ?

I'm studying tutorial at http://www.onjava.com/pub/a/onjava/2004/02/04/juie.html

but this tutorial is very short tutorial , so Do you have more JUnit + Eclipse Tutorial ??
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by somkiat puisungnoen:
How to use JUnit with Eclipse ?



What are your doubts?

Generally, there is not much special about using JUnit inside Eclipse. You write your JUnit tests as usual, optionally using Eclipses wizards to do so, and run them using Eclipses inbuild testrunner.
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've found this tutorial about TDD (Test Driven Development) using Junit with Eclipse :

http://www.ammai.com/downloads/TDDEclipse_viewlet_swf.html

I think it might help
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Laurent Barbier:
I've found this tutorial about TDD (Test Driven Development) using Junit with Eclipse :

http://www.ammai.com/downloads/TDDEclipse_viewlet_swf.html

I think it might help



That good tutorial ....


Thank a lot ...

I'm can use JUnit to test my first application , so it's work.
 
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What about this tutorial? It's from 3plus4software and is longer than the tutorial from OnJava... Traffic light Simulatrion Model is there as an example... Hope this helps...
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ilja Preuss:


What are your doubts?

Generally, there is not much special about using JUnit inside Eclipse. You write your JUnit tests as usual, optionally using Eclipses wizards to do so, and run them using Eclipses inbuild testrunner.




I don't know how to use junit wizard in Eclipse . And thank you for solution to use JUnit in Eclipse.



And I have some question:

When i should use JUnit to testing my application ??



Because i never use JUnit for testing application.
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by somkiat puisungnoen:
And I have some question:

When i should use JUnit to testing my application ??


Because i never use JUnit for testing application.



If I am not wrong, I guess you mean "Why use JUnit", instead of "When to use JUnit" in your question...

If your question means to the word "why", these reasons would be enough to know why we need to use JUnit for testing applications... As I told in the previous thread, I was told by one of your management level employees at your previous company "Mustang" that I should use JUnit and ANT in application development all the time... That guy's name is Roy <Sthing>. I don't remember his lastname...

Before that, I had been neglecting the importance of JUnit and ANT... But I'm on them since then.... Still on the learning track like you...
[ August 10, 2004: Message edited by: Ko Ko Naing ]
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much ....
 
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why not Ant?
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Tony Yan:
Why not Ant?


If your "project" is an experiment you're doing alone all within your IDE, it might not be necessary to use Ant since you can do all your common tasks within your state-of-the-art IDE without having to consider build portability etc.

In general, Ant is pretty much a given these days. It's probably about 4 years since I last encountered a Java project using something other than Ant to build their stuff.
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Tony Yan:
Why not Ant?



"Why not Ant" what?
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Somkiat,
The junit wizard assumes you have a class to test (the class doesn't need to have any methods in it, it just needs to exist.) The test case wizard lets you select what folder you want to put the test class in and if you want a custom superclass. You can choose to have it create setUp()/tearDown() methods and the type of test runner. (The test runner choice isn't as useful as you will probably want to use the Eclipse runner.) If your class has any methods, you can have the wizard create test method stubs for you.

There is also a wizard that creates a test suite (to run some subset of your test classes.)
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jeanne Boyarsky:
The junit wizard assumes you have a class to test (the class doesn't need to have any methods in it, it just needs to exist.)



It doesn't even need to exist - it's optional! So you can easily use it in a test-first style.


There is also a wizard that creates a test suite (to run some subset of your test classes.)



And don't forget the "recreate test suite" command from the context menu on a test suite. Very usefull!
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jeanne Boyarsky:
Somkiat,
The junit wizard assumes you have a class to test (the class doesn't need to have any methods in it, it just needs to exist.) The test case wizard lets you select what folder you want to put the test class in and if you want a custom superclass. You can choose to have it create setUp()/tearDown() methods and the type of test runner. (The test runner choice isn't as useful as you will probably want to use the Eclipse runner.) If your class has any methods, you can have the wizard create test method stubs for you.

There is also a wizard that creates a test suite (to run some subset of your test classes.)




Thank you very much for more detail.

I'm done follow you , it's work...
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

It doesn't even need to exist - it's optional! So you can easily use it in a test-first style.


You're right. I meant that the class needs to exist if you want it to generate test stubs. But I certainly didn't type that. Sorry!

And don't forget the "recreate test suite" command from the context menu on a test suite. Very usefull!


That one I didn't know about. I use a reflection based test suite, so I'm not that familiar with what Eclipse gives you for test suites.
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Tony Yan:
Why not Ant?



I not sure I understand this question.

I think, you mean (ANT) to build application (Compile/Run/Deploy) but JUnit is some library/class/interface for testing application , so you can use ant to run JUnit .
 
reply
    Bookmark Topic Watch Topic
  • New Topic