Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sample project for learning JUnit and proper software engineering [closed]

Tags:

java

junit

I'm having a hard time making the connection between testing and code. I could ask numerous questions here about things like directory structure and naming of test classes and JUnit 3 vs 4 and so on, but I'd rather find a sample project that does it right and learn by reading it.

I'd like something not too complex so that I can understand it easily, and JUnit 4 would be best (no reason to stick with 3 since I'm starting fresh, right?). I'm on Windows 7, I use Eclipse and I'm planning/hoping to learn and use Hudson. I like Ant, haven't had a good experience with Maven but that's cool too.

Is there a sample project out there that fits this criteria?

edit: Neither of these answers mentioned Hudson; I really like the Craftsman articles (and maybe it goes into continuous integration) but does anyone else have any other suggestions?

like image 638
Ricket Avatar asked Mar 04 '10 04:03

Ricket


2 Answers

I found the Craftsman articles by Robert Martin (Uncle Bob) an excellent resource for learning effective unit testing. It focuses on Test Driven Development and walks you through the experience of a new coder learning how to test code. The first article can be found here and is called The Craftsman #1: Opening Disaster.

like image 113
Martin Avatar answered Nov 09 '22 07:11

Martin


If you're looking for an easy example of project structure and convention, I would recommend giving Maven another go. To use it with Eclipse, install the M2Eclipse plugin, and create a Maven project using one of the Maven archetypes. The archetypes build simple template projects, including source and test structure, and will run with Maven and Eclipse right away.

like image 3
Daniel Avatar answered Nov 09 '22 06:11

Daniel