Home » Tag Archives: JUnit (page 5)

Tag Archives: JUnit

More Units with MoreUnit

junit-logo

Just over a year ago I wrote a post about working with JUnit in Eclipse. One of the commenters recommended MoreUnit in order to increase testing efficiency even more. Giving it a try I was delighted and the plugin’s keyboard shortcuts were immediately memorized by my autonomic nervous system… Additionally after using MoreUnit for a while I recognized a slight ...

Read More »

Introduction To JUnit Theories

junit-logo

Have you ever read a mathematical theory? It typically reads something like this: For all a, b > 0  the following is true: a+b > a and a+b > b Just typically the statements are more difficult to understand. There is something interesting about this kind of statement: It holds for EVERY element (or combination of elements) of a rather ...

Read More »

Parameterized JUnit tests with JUnitParams

junit-logo

Parameterized unit tests are used to to test the same code under different conditions. Thanks to parameterized unit tests we can set up a test method that retrieves data from some data source. This data source can be a collection of test data objects, external file or maybe even a database. The general idea is to make it easy to ...

Read More »

Run, JUnit! Run!!!

junit-logo

JUnit together with JavaScript and SVN are some of the technologies that programmers often start using without even reading a single blog post let alone a book.  Maybe this is a good thing since they look simple enough and understandable so we can use them right away without any manuals, but this also means that they are also underused. In ...

Read More »

JBoss Drools unit testing with junit-drools

jboss-drools-logo

Recently I’ve been working with a project heavily using JBoss Drools. I am not Drools expert – I am not also very convinced to this framework, or maybe only to particular use case in this project – and I found it quite difficult to write simple, maintainable unit tests for Drools based business rules. That’s how junit-drools was born – ...

Read More »

A JUnit Rule to Conditionally Ignore Tests

junit-logo

I always believed that using @Ignore to deactivate tests is a bad idea. Except, maybe as one way to put tests that fail intermittently into quarantine to attend to them later (as Martin Fowler describes it here). This bears the danger that the test suite decays as more and more tests keep getting ignored and forgotten. Therefore you should have ...

Read More »

3 ways of handling exceptions in JUnit. Which one to choose?

junit-logo

In JUnit there are 3 popular ways of handling exceptions in your test code: try-catch idiom With JUnit rule With annotation Which one should we use and when? try-catch idiom This idiom is one of the most popular one, because it was used already in JUnit 3. @Test public void throwsExceptionWhenNegativeNumbersAreGiven() { try { calculator.add("-1,-2,3"); fail("Should throw an exception if ...

Read More »

Write effective Load Tests using JUnit and Repeat annotation

junit-logo

EasyTest recently introduced a new set of annotations that would help its users write effective test cases. The two main annotations that found their way into EasyTest are : Repeat Duration Today we will discuss about the Repeat annotation. A new method level annotation Repeat has been added to the EasyTest Framework. This annotation can be used to repeat the ...

Read More »

Run your Unit Tests in Parallel

junit-logo

It was about time when the developer of Unit Tests had the ability to run the tests in Parallel using annotations. In today’s blog post, we will look at how you can make your traditional Junit Tests to run in parallel using annotations provided by Easytest. EasyTest  is a Testing Framework build on top of JUnit to provide you ease ...

Read More »

Unit Testing Tip: Create Descriptive Tests

junit-logo

Your unit tests should be as descriptive as possible. The feedback they give you should be so clear you don’t even need to fire up the debugger and step one by one through the code to inspect your local variables. Why? Because that takes time and we’re lazy, right? In order to do so you need to create descriptive tests. ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close