One nice feature in JUnit 4 is that of Parameterized Tests, which let you do data-driven testing in JUnit with a minimum of fuss. It's easy enough, and very useful, to set up basic data-driven tests by defining your test data directly in your Java class. But what if you want to get your test data from somewhere else? In this article, we look at how to obtain test data from an Excel spreadsheet.
I don't unit test my classes. I don't even unit-test my methods. You'll be hard-put to find the word "test" in my source code. And I never, ever create a new JUnit Test Case Eclipse.

I prefer to test how my application behaves. And I find it makes a huge difference.
A recent question on Twitter about my JUnit Kung Fu talk got me thinking - is it possible to combine the expressivity of Hamcrest asserts with the power of parameterized testing? The answer is, of course, yes. Hamcrest expressions are not limited to assertThat statements - they can be used in isolation as well.
People often confuse performance and scalability testing, but they are actually quite different activities. Performance testing involves ensuring that your application responds to requests within an acceptable timeframe. Of course, defining what "acceptable" is is a fine art, and perceived performance (what the user actually sees) is often more important than real performance.
Recently I had the pleasure of giving a talk at the Canberra Java Users Group on the topic 'Real Developers Don't Need Unit Tests':
"Unit testing, and Test-Driven Development in particular, is a vital but neglected art. Proper TDD don't just test code: your tests are executable requirements that tell the story of your application, clarify your design, document your code and help track your progress. They help you find bugs fast, and fix them with confidence. If Real programmers don't need unit tests, they sure make life easier for the rest of us!"
I've posed the slides for this presentation in this article.
There are 11 items tagged with JUnit. You can view all our tags in the Tag Cloud