Thomas Sundberg

June 22, 2016

Cucumber Anti-Patterns

Filed under: BDD, Cucumber — Tags: — Thomas Sundberg @ 06:20

This post is available at

April 18, 2016

Hamcrest, JUnit, Mockito, IntelliJ IDEA, Gradle, and java.lang.NoSuchMethodError: org.hamcrest.Matcher.describeMismatch

Filed under: Gradle, JUnit, Mockito, TDD — Tags: , — Thomas Sundberg @ 21:52

This post has been migrated to

Ever included Mockito in your project and lost the nice feedback from Hamcrest? And only when running your unit tests from IntelliJ IDEA? Instead of a message describing what you should fix, you see java.lang.NoSuchMethodError: org.hamcrest.Matcher.describeMismatch

I have. More than once and been very frustrated. These are tools I like. Not getting good messages upsets me.


April 2, 2016

Cucumber regular expression cheat sheet

Filed under: Cucumber, Programming — Tags: — Thomas Sundberg @ 15:30

This post has been migrated to

If you are like me, then you will feel a lump in your stomach when you realize that you need a regular expression. I think that the saying “If you have a problem that requires a regular expression, then you have two problems” is very appropriate most of the time.

It turns out that you need a some regular expressions when you are working with Cucumber. In this case, they are usually not very complicated.


March 26, 2016

Where should you use Behaviour Driven Development, BDD?

Filed under: BDD, Cucumber — Tags: , , — Thomas Sundberg @ 20:07

This post has been migrated to

When I was at the European Testing Conference 2016 in Bucharest, a colleague asked me about my thoughts on they should use Behaviour Driven Development, BDD. I didn’t get a good chance to elaborate on my view so I decided that I should write this instead.


March 25, 2016

Dependencies between tests

Filed under: Programming — Thomas Sundberg @ 20:07

This post has been migrated to

A test must be independent. That is, a test should never depend on the result of another test.

If you run two tests in a specific order, you should expect the same result as if you run them in the reverse order.


February 16, 2016

Comments are deodorant for your code

Filed under: Clean Code, Programming — Tags: , , — Thomas Sundberg @ 20:53

This post has been migrated to

Writing comments in a program is often considered a good habit. I hear people talking about code as “good and well commented”. This always makes me skeptic. What do people mean with “well commented”? It turns out, they often mean that every method has a lot of comments.


January 14, 2016

Separation of concern when using Selenium

Filed under: Java, Selenium, Test Automation — Tags: , — Thomas Sundberg @ 20:07

This post has been migrated to

A lot of people want to automate testing of their web applications. This is definitely a good thing. But it happens that they focus more on the tooling than the testing.


December 26, 2015

Gradle and Cucumber-JVM

Filed under: Cucumber, Gradle, Programming — Thomas Sundberg @ 11:06

This post has been migrated to

Gradle is a great build tool. Cucumber-JVM is a great tool for executing Gherkin. They don’t really work well together. At least not out of the box. Gradle defaults to hide the output on stdout and stderr. This is very unfortunate since this means that the code snippets Cucumber-JVM suggests when there is a missing step are hidden.

Let me show you an example on how to setup a Gradle project so it can execute Cucumber-JVM and give you the snippets you want as starting points for your steps.


December 23, 2015

Continuous deployment – a case study

This post has been migrated to

Continuous deployment is considered, among some enlightened, to be the holy grail in many organisations where software is developed.

What is continuous deployment then? My interpretation is that every change is deployed into production. That is, every change that passes the quality gates the team has created.

A relaxed version is continuous delivery. Continuous delivery means that every change that passes the quality gates ends up as a release candidate. A release candidate that is possible to deploy into to production. The deployment will, however, be done later. If ever.

I will describe how I implemented continuous deployment for one product and continuous delivery for three others for a client.


November 20, 2015

Expected exceptions

Filed under: Java, Programming, TDD — Tags: , , , , — Thomas Sundberg @ 11:27

This post has been migrated to

Sometimes you want to verify that an exception is thrown in your code.

Let me show you three different ways to verify that the expected exception has been thrown.


Older Posts »

The Silver is the New Black Theme. Blog at


Get every new post delivered to your Inbox.

Join 83 other followers