Home » Tag Archives: JUnit (page 3)

Tag Archives: JUnit

JUnit in a Nutshell: Test Runners

junit-logo

The fourth chapter of my multi-part tutorial about JUnit testing essentials explains the purpose of the tool’s exchangable test runners architecture and introduces some of the available implementations. The ongoing example enlarges upon the subject by going through the different possibilities of writting parameterized tests. Since I have already published an introduction to JUnit Rules, I decided to skip the ...

Read More »

jUnit: Rules

junit-logo

Rules add special handling around tests, test cases or test suites. They can do additional validations common for all tests in the class, concurrently run multiple test instances, set up resources before each test or test case and tear them down afterwards. The rule gets complete control over what will done with the test method, test case or test suite ...

Read More »

JUnit in a Nutshell: Test Isolation

junit-logo

Working as a consultant I still meet quite often programmers, who have at most a vague understanding of JUnit and its proper usage. This gave me the idea to write a multi-part tutorial to explain the essentials from my point of view. Despite the existence of some good books and articles about testing with the tool, maybe the hands-on approach ...

Read More »

Parameterized Test Runner in JUnit

junit-logo

We all have written unit tests where in a single test tests for different possible input-output combinations. Lets look how its done by taking a simple fibonacci series example. The below code computes the fibonacci series for number of elements mentioned:             import java.math.BigInteger; import java.util.ArrayList; import java.util.List; public class Fibonacci{ public List<Integer> getFiboSeries(int numberOfElements) ...

Read More »

This is Stuff: jUnit: Dynamic Tests Generation

junit-logo

Dynamic tests generation is useful when you need to run the same set of tests on many different input values or configurations. It can be achieved either using parametrized tests or using theories. Theories are valuable when you have a bunch of data to be used as parameters and want to run tests on all their combinations. You get less ...

Read More »

JUnit in a Nutshell: Hello World

junit-logo

JUnit seems to be the most popular testing tool for developers within the Java world. So it is no wonder that there have been written some good books about this topic. But by earning a living as consultant I still meet quite often programmers, who at most have a vague understanding of the tool and its proper usage. Hence I ...

Read More »

Understanding JUnit’s Runner architecture

junit-logo

Some weeks ago I started creating a small JUnit Runner (Oleaster) that allows you to use the Jasmine way of writing unit tests in JUnit. I learned that creating custom JUnit Runners is actually quite simple. In this post I want to show you how JUnit Runners work internally and how you can use custom Runners to modify the test ...

Read More »

JUnit in a Nutshell: Test Structure

junit-logo

Despite the existence of books and articles about JUnit testing, I still meet quite often programmers, who at most have a vague understanding of the tool and its proper usage. Hence I had the idea to write a multi-part tutorial, that explains the essentials from my point of view. Maybe the hands-on approach taken in this mini-series might be appropriate ...

Read More »

Clean JUnit Throwable-Tests with Java 8 Lambdas

junit-logo

Recently I was involved in a short online discussion on twitter and google+ which concerned the question why the arrival of Java 8 Lambda expressions makes the catch-exception library1 obsolete. This was triggered by a brief announcement that the library won’t be longer maintained as lambdas will make it redundant. The answer I came up with at that time has ...

Read More »

A JUnit Rule to Run a Test in Its Own Thread

junit-logo

Occasionally it would be helpful to be able to run a JUnit test in a separate thread. In particular when writing integration tests that interact with encapsulated ThreadLocals or the like this could come in handy. A separate thread would implicitly ensure that the thread related reference of the threadlocal is uninitialized for each test run. This post introduces a ...

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