Home » Tag Archives: Testing (page 19)

Tag Archives: Testing

Fault Injection with Byteman and JUnit

junit-logo

The time when our applications lived in isolation have passed long-long ago. Nowadays applications are a very complicated beasts talking to each other using myriads of APIs and protocols, storing data in traditional or NoSQL databases, sending messages and events over the wire … How often did you think about what will happen if, for example, a database goes down ...

Read More »

Hamcrest Matchers, Guava Predicate and Builder design pattern

hamcrest-logo

Often, while coding we have to deal with some POJO objects that have dozens of fields in them. Many times we initialize those classes through a constructor having dozens of arguments which is terrible in any possibly imaginable way. Apart from that the functions that use those constructors are hardly testable. Let’s take a closer look at using a Builder ...

Read More »

Running JUnit Tests Repeatedly Without Loops

junit-logo

Recently I came across a problem where I had to write tests for a method that calculates randomly distributed values within a certain range of possibilities 1. More precisely if you assume a signature that looks like                 interface RandomRangeValueCalculator { long calculateRangeValue( long center, long radius ); } a test might verify ...

Read More »

Penetration Testing Shouldn’t be a Waste of Time

software-development-2-logo

In a recent post on “Debunking Myths: Penetration Testing is a Waste of Time”, Rohit Sethi looks at some of the disadvantages of the passive and irresponsible way that application pen testing is generally done today: wait until the system is ready to go live, hire an outside firm or consultant, give them a short time to try to hack ...

Read More »

JUnit: Naming Individual Test Cases in a Parameterized Test

junit-logo

A couple of years ago I wrote about JUnit Parameterized Tests. One of the things I didn’t like about them was that JUnit named the invidividual test cases using numbers, so if they failed you had no idea which test parameters caused the failure. The following Eclipse screenshot will show you what I mean:             ...

Read More »

War Games, Pair Testing and Other Fun Ways to Find Bugs

software-development-2-logo

I’ve already examined how important good testing is to the health of a project, a product and an organization. There’s a lot more to good testing than running an automated test suite in Continuous Integration and forcing someone to walk through functional test scripts and check lists. A good tester will spend time exploring the app, making sure that they ...

Read More »

Testing Spring Data Neo4j Applications with NoSQLUnit

neo4j-logo

Spring Data Neo4j is the project within Spring Data project which provides an extension to the Spring programming model for writing applications that uses Neo4j as graph database. To write tests using NoSQLUnit for Spring Data Neo4j applications, you do need nothing special apart from considering that Spring Data Neo4j uses a special property called type in graph nodes and ...

Read More »

JUnit and EasyMock cooperation

easymock-logo

Developers always need to take care about code which they produced. They should be ensured that code works properly after a new feature was implemented or some bug was fixed. That’s can be achieved at least with the help of unit tests. Since this blog is dedicated to Java programming language, today I will write the article about JUnit 4.1 ...

Read More »

Testing Expected Exceptions with JUnit Rules

java-logo

This post shows how to test for expected exceptions using JUnit. Let’s start with the following class that we wish to test:                   public class Person { private final String name; private final int age; /** * Creates a person with the specified name and age. * * @param name the name ...

Read More »

Don’t rely on unit tests alone

junit-logo

When you are building a complex system, barely testing components in isolation is not enough. It’s crucial, but not enough. Imagine a car factory that manufactures and imports highest quality parts, but after assembling the vehicle never starts the engine. If your test case suite consists barely of unit tests, you can never be sure that the system as a ...

Read More »
Want to take your Java Skills to the next level?
Grab our programming books for FREE!
  • Save time by leveraging our field-tested solutions to common problems.
  • The books cover a wide range of topics, from JPA and JUnit, to JMeter and Android.
  • Each book comes as a standalone guide (with source code provided), so that you use it as reference.
Last Step ...

Where should we send the free eBooks?

Good Work!
To download the books, please verify your email address by following the instructions found on the email we just sent you.