Tag Archives: Junit

JUnit Best Practices

via JUnit Best Practices | Examples Java Code Geeks.

There are a lot of ways on how a developer can do JUnit test cases, but overall it really depends on the strategy of how a specific functional code can be tested to it’s limits. It’s the developers responsibility to introduce thorough test cases to make sure that the code is stable and ultimately does what it has to do.

In this blog post, I’ll share some of the best practices I have learned and discuss my experience on them.


via Parameterized integration tests with Spring JUnit Rules ~ Codeleak.pl.

Spring 4.2 comes with brand new JUnit rules: SpringClassRuleand SpringMethodRule. The main advantage of using JUnit rules is to let developers get rid of SpringJUnit4ClassRunner and utilize different JUnit runners in Spring integration tests. I think the biggest opportunity with Spring JUnit Rules is the ease of creating parameterized integration tests.

How to Cucumber : Test Reporting Plugin with Maven and Java

It is often useful to show the results of our tests to others people who are not developers, like managers or executive. This tutorial shows how to integrate a Cucumber reporting a Java plugin in Maven project. The result is a simple web page, which does not require a special tool to be read.


Getting Started: Selenium (ChromeDriver) based UI automated test using Java, JUNIT and Maven – Example

This post provides a basic and simple example for an automated acceptance test using Java, JUNIT and Selenium based ChromeDriver. Selenium WebDriver is an open source tool for developing automated tests for web applications using Java. This example uses ChromeDriver – an implementation of Selenium WebDriver. developed by Selenium in collaboration with Chromium team. SimpleAcceptanceTest.java […]


Adding Database Logging to JUnit3

via Invariant Properties » Adding Database Logging to JUnit3.

We have written many thousands of JUnit3 tests over the last decade and are now trying to consolidate the results in a database instead of scattered log files. It turns out to be remarkably easy to extend the TestCase class to do this. Note: this approach does not directly apply to JUnit4 or other test frameworks but it’s usually possible to do something analogous.

Working Efficiently with JUnit in Eclipse

via Working Efficiently with JUnit in Eclipse.

Recently I was dragged into a discussion1 with some test infected2 fellows about how we use JUnit within the Eclipse IDE. Surprisingly the conversation brought up some ‘tips and tricks’ not everybody was aware of. This gave me the idea to write this post doing a sum up of our talk. Who knows – maybe there is something new for somebody out there too…

Writing Data Driven Tests for your Java Application

via Writing Data Driven Tests for your Java Application | JavaWorld.

JUnit is an extremely powerful testing framework that not only provides its users with a facility to write quick and easy tests but also provides an opportunity for users to extend it and make it work the way they want it to. Many frameworks have been built on top of JUnit that provides various ease of use functionalities to their target audience.

EasyTest is one such framework whose primary focus is to bring Data Driven Testing functionality to the JUnit world.

JUnit already has some mechanism in place that provides its users some sort of data driven test feeling. But its not sufficient and also it is not clean. for example, a user can use @Parameterized Runner to write Data Driven Tests but using Parameterized Runner results in a lot of unnecessary code to be written.

EasyTest tries to solve the problems by bridging the gap between what JUnit already has and what is most convenient to the users.

In today’s post, I will give a brief overview of what EasyTest is and how it has evolved from being a hobby to a full fledged project that is being used in a lot of companies and by a lot of people.