Data AccessCore JavaApp FrameworksViewTestingBuildingDeploymentDev ToolsSecurityOpinions

Monday, June 22, 2009

Setting up JUnit in your Eclipse Project

The following is the first steps to adding JUnit test cases to your Eclipse project. It's the first step in working your processes towards Test Driven Development, which is the bread and butter of Agile and XP Programming methodologies and techniques.

Step 1: Download JUnit


The first step is to download the most recent version of JUnit (look for the 'Releases' link off the homepage). At the time of this article, the latest version was 4.6.

Step 2: Add JUnit to your Eclipse project's build path.


Right click on your project and select 'Properties'.
Click 'Java Build Path'.
Click the 'Libraries' tab.
Click 'Add JARs' (if you've added the JAR into your workspace)
or
Click 'Add External JARs' (if you are linking the JAR from outside your workspace)
In the GUI, select the JUnit jar (junit-4.6.jar).

Step 3: Organize your source folders


One recommended practice is to organize your source folders into the following structure:

[project]
-- src    
-- main   (module code)
-- test   (test code only)


Create the above directory structure under your project in Eclipse.
Right click on your project and select 'Properties'.
Click 'Java Build Path'.
Click the 'Source' tab.
Add the 'main' and 'test' folders as source folders in your project and deselect 'src' as a source folder.

Ready to go


You now have effectively integrated JUnit into your project, provided a clean way to separate your code base with your testing code.

Any questions, feel free to comment and I'll get back to you as soon as I can.

79 comments:

  1. Replies
    1. Hibernate Online Training Hibernate Online Training Hibernate Training in Chennai Hibernate Training in Chennai Java Online Training Java Online Training

      Hibernate Training Institutes in ChennaiHibernate Training Institutes in Chennai Java Online Training Java Online Training Java Online Training Java Online Training

      Delete
  2. I went through article, and it’s totally awesome. Java is most popular programming language and its considered as base to various new technologies like Hadoop, Salesforce, etc.
    Java Training in Chennai

    ReplyDelete
  3. Thanks for sharing your informative article on Hive ODBC Driver. Your article is very descriptive and assists me to learn whole concept in detail. Hadoop Training in Chennai | Big Data Training in Chennai

    ReplyDelete
  4. Java is the best programming language that are serving as a entry point for fresher like me. The content you have provided here tells me that clearly. This will be useful for my training program. Thanks for sharing this useful information here. You are running a great blog though.

    JAVA Training in Chennai | JAVA Training Institutes in Chennai | Selenium training in chennai

    ReplyDelete
  5. Excellent post!!! In this competitive market, customer relationship management plays a significant role in determining a business success. That too, cloud based CRM product offer more flexibility to business owners to main strong relationship with the consumers. Salesforce Training Institutes in Chennai | Salesforce Training in Chennai

    ReplyDelete
  6. Responsive desing can yield a very good revenue to a business. It has been discovered since the usage of multiple devices increase. The content furnished above too tells the same. Thanks for sharing this information in here. Please keep bloging content like this.

    Web designing course in chennai | Web designing institute in chennai | PHP Training in Chennai

    ReplyDelete
  7. Cloud has beome the common word that is being used by most of the professional these day. The reason for relying on this technology is security. Your content too lecture the same. Thanks for sharing this worth able information in here. Keep blogging article like this.

    Hadoop Training Chennai
    | Hadoop training institutes in chennai | Manual testing training in Chennai

    ReplyDelete
  8. Great Post in Java Technology..

    ReplyDelete
  9. Best Java Training Institute In ChennaiThis information is impressive; I am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic..

    ReplyDelete
  10. This blog is impressive and informative.It clearly explains about the concept and its techniques.Thanks for sharing this information.Please update this type of information
    Salesforce Training in Chennai

    ReplyDelete
  11. HTML5 is the recently arrived most trending technology that has bright future. If you are interested in studying HTML5 training visit this website.
    html5 training in chennai | html5 training chennai | html5 course in chennai

    ReplyDelete
  12. Java is programing language which is used in almost all the applications and games which are on the web. Java is being used extensively and it will be used extensively in near future. So getting trained in Java will surely be helpful.
    Java training in Chennai | Java training institute in Chennai | Java course in Chennai

    ReplyDelete
  13. iFlyChat is an ongoing talk module most appropriate for group and long range informal communication sites. It helps in expanding client engagement of your WordPress site by empowering clients to visit with each other secretly (balanced private discussion), bunch talk or in talk rooms
    Wp Chat

    ReplyDelete
  14. This was a great and interesting article to read. I have really enjoyed all of this very cool information affordable seo packages

    ReplyDelete
  15. Wonderful post. Thanks for sharing such a informative post.

    Wordpress development in chennai

    ReplyDelete
  16. To keep ourselves up to date with the current trend is not an easy task in IT. But we can, through quality and worth able content like this. Thanks for sharing this web page. Please write more articles like this in future.
    PHP training in Chennai | PHP course in Chennai

    ReplyDelete
  17. The strategy you have posted on this technology helped me to get into the next level and had lot of information in it. The Struts, Spring, Hibernate are the advanced level of programming language which are most widely used.
    hibernate training in chennai | hibernate training

    ReplyDelete

  18. Hello Admin,
    Awesome Post! I like writing style, how you describing the topics throughout the post. I hope many web reader will keep reading your post at the end, Thanks for sharing your view.
    Regards,
    PHP Institutes in Chennai|PHP Training in Chennai|PHP Course in Chennai

    ReplyDelete
  19. Ethical hacking describes hacking performed by a company or individual to help them to identify potential threats on a computer or network.
    Ethical hacking Course in Chennai | Ethical hacking Training in Chennai

    ReplyDelete
  20. Good post. Thanks for sharing such a informative post.

    web design courses in chennai

    ReplyDelete
  21. Nice blog. Thanks for sharing such a useful post.

    php training in chennai

    ReplyDelete
  22. The usage of third party storage system for the data storage can be avoided in cloud computing and we can store, access the data through internet.
    cloud computing training in chennai | cloud computing courses in chennai

    ReplyDelete
  23. I have read your blog its very attractive and impressive. I like it your blog.

    Java Training in Chennai Java Training in Chennai | Core Java Training in Chennai

    Online Java Training Java Online Training | Java J2EE Online Training | JavaEE Training Institute in Chennai

    ReplyDelete
  24. I have read your blog its very attractive and impressive. I like it your blog.

    Java Training in Chennai Java Training in Chennai | Core Java Training in Chennai

    Online Java Training Java Online Training | Java J2EE Online Training | JavaEE Training Institute in Chennai

    ReplyDelete
  25. Updating with the latest technology and implementing it is the only way to survive in our niche. Thanks for making me this article. You have done a great job by sharing this content in here. Keep writing article like this.
    SAS Training in Chennai | SAS Course in Chennai

    ReplyDelete
  26. Very useful content thanks for sharing such a informative content which provided me the required information on the various technology.
    AngularJS Training in Chennai | AngularJS course in Chennai

    ReplyDelete
  27. Hibernate Training Institutes in ChennaiHibernate Training Institutes in Chennai Hibernate Online Training Hibernate Online Training Hibernate Training in Chennai Hibernate Training in Chennai Java Online Training Java Online Training

    ReplyDelete
  28. Great post and informative blog.it was awesome to read, thanks for sharing this great content to my vision.
    informix training in chennai

    ReplyDelete
  29. Thanks for sharing this unique and informative content which provided me the required information.
    mvc training in chennai

    ReplyDelete
  30. Nice blog. Thanks for sharing such a useful post.
    Selenium Training In Chennai

    ReplyDelete
  31. looking for ORACLE RAC in Training in Chennai? then join us at Greens Technology. Oracle Rac Training in Chennai

    ReplyDelete
  32. Very useful content thanks for sharing such a informative content...
    webshere training in chennai

    ReplyDelete
  33. Pleasant Post. It is truly intriguing to peruse from the earliest starting point and I might want to share your site to my circles, continue sharing more like this.
    Regards,
    Hadoop Training in Chennai | Hadoop course in Chennai | Bigdata Training | Bigdata course in Chennai

    ReplyDelete
  34. Well Said, you have furnished the right information that will be useful to anyone at all time. Thanks for sharing your Ideas.
    Web Designing Course in Chennai | web designing training in chennai

    ReplyDelete
  35. Very interesting content which helps me to get the in depth knowledge about the technology. To know more details about the course visit this website.
    Digital marketing course in Chennai | Digital marketing training in Chennai

    ReplyDelete
  36. Learning AngularJs course will becoming you as a web developer. Web designer and developer have great demand in today’s IT sectors.
    Regards,
    Angularjs Training | Angularjs Training in Chennai | Angularjs course in Chennai

    ReplyDelete
  37. A debt of gratitude is in order for requiring some serious energy share this post. It is truly useful. I propose to visit this site to my group members. Please continue posting this way.
    Regards,
    SAS Training in Chennai | SAS Courses in Chennai | SAS Training center in Chennai

    ReplyDelete
  38. This substance makes another trust and motivation within me. A debt of gratitude is in order for sharing article this way. The way you have expressed everything above is entirely amazing. Continue blogging this way.
    Regards,
    Spring Training in Chennai | Spring course in Chennai | Spring Framework Training in Chennai

    ReplyDelete
  39. Great and useful post.Thanks for taking time to share this informative post to my vision.
    Regards,
    Manual Testing Training in Chennai | Manual Testing course in Chennai

    ReplyDelete
  40. Updating with the latest technology and implementing it is the only way to survive in our niche. Thanks for making me this article.
    SAS Training in Chennai | SAS Training Institute in Chennai

    ReplyDelete
  41. A debt of gratitude is in order for the enlightening article. This is one of the best assets I have found in a long while. Pleasantly composed and incredible data. I truly can't thank you enough to share.
    Regards,
    Java Training in Chennai | Java course in Chennai | Best Java Training in Chennai

    ReplyDelete
  42. Thanks for sharing this junit test cases.It is really helpful to me.
    Regards,
    Oracle Training in Chennai | oracle dba training in chennai

    ReplyDelete
  43. Salesforce is a CRM tool which runs on cloud and very easy to use. Cloud computing is very convenient as there is no need for dedicated infrastructure for cloud computing.
    Thanks,
    Salesforce Training in Chennai | Salesforce Training Institutes in Chennai | Salesforce course in Chennai

    ReplyDelete
  44. Wonderful article with lots of useful information very interesting to read and hearty thanks to the article writer.
    Regards
    Selenium Training in Chennai | Java Training in Chennai

    ReplyDelete
  45. Thanks for your great information. Keep Updating.
    ERP in Chennai | ERP Providers in Chennai | ERP Software Company in Chennai. Brave Technologies Private Limited is an one of the best Low Cost ERP Software Solution for all Industries.

    ReplyDelete
  46. Hi, Really your post was very informative. Today's internet era learn Hadoop Online Training will helps you to reach your goal.Selenium Training

    ReplyDelete
  47. Nice sharing. R is a language and environment for statistical computing and graphics. Want to make a career in R Programming. Learn R Programming Training course @ GangBoard. We are the best provider of online training on evergreen technologies.

    ReplyDelete
  48. You have done really great job. Your blog is very unique and informative. Thanks. Devops Online Training | Data Science Online Training

    ReplyDelete
  49. The best thing is that your blog really informative thanks for your great information!
    erp in chennai

    ReplyDelete
  50. Excellent post! I heve read your blog it's very interesting and informative. Keep sharing.
    erp providers in chennai | erp software chennai

    ReplyDelete
  51. Nice blog. Thank you for sharing. The information you shared is very effective for learners I have got some important suggestions from it. erp software in chennai.

    ReplyDelete
  52. Finding the time and actual effort to create a superb article like this is great thing. I’ll learn many new stuff right here! Good luck for the next post buddy..
    PHP training in chennai

    ReplyDelete
  53. Finding the time and actual effort to create a superb article like this is great thing. I’ll learn many new stuff right here! Good luck for the next post buddy..
    Sharepoint Training in Chennai

    ReplyDelete
  54. Useful blog.i liked your step by step explanation.you follow the unique way.Thanks for sharing.so Learn high level language in best institute.more details..... Android Training in Chennai
    Dot Net Training in Chennai
    Hadoop Training in Chennai
    Selenium Training in Chennai

    ReplyDelete
  55. This comment has been removed by the author.

    ReplyDelete
  56. I just see the post i am so happy to the communication science post of information's.So I have really enjoyed and reading your blogs for these posts.Any way I’ll be replay for your great thinks and I hope you post again soon...
    Java Training in Chennai

    ReplyDelete
  57. Driven Development, which is the bread and butter of Agile and XP Programming methodologies and techniques.web design tutorials

    ReplyDelete
  58. I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in Data Science with SAS Training, kindly contact us http://www.maxmunus.com/contact
    MaxMunus Offer World Class Virtual Instructor led training on TECHNOLOGY. We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
    For Demo Contact us.
    Sangita Mohanty
    MaxMunus
    E-mail: sangita@maxmunus.com
    Skype id: training_maxmunus
    Ph:(0) 9738075708 / 080 - 41103383
    http://www.maxmunus.com/

    ReplyDelete
  59. Awesome blog. I enjoyed reading your articles. This is truly a great read for me.
    Suchmaschinenoptimierung in Lüdenscheid

    ReplyDelete
  60. Thanks for the useful post. Keep posting more like this.
    Webdesign Lüdenscheid

    ReplyDelete
  61. The website is looking bit flashy and it catches the visitors eyes. A design is pretty simple .
    office 2010 professional plus key deutsch

    ReplyDelete
  62. Interesting post! This is really helpful for me. I like it! Thanks for sharing!

    Webdesign Lüdenscheid

    ReplyDelete