Thomas Sundberg

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 http://www.thinkcode.se/blog/2016/04/18/hamcrest-junit-mockito-intellij-idea-gradle-and-javalangnosuchmethoderror-orghamcrestmatcherdescribemismatch

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.

(more…)

April 2, 2016

Cucumber regular expression cheat sheet

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

This post has been migrated to http://www.thinkcode.se/blog/2016/04/02/cucumber-regular-expression-cheat-sheet

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.

(more…)

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 http://www.thinkcode.se/blog/2016/03/26/where-should-you-use-behaviour-driven-development-bdd

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.

(more…)

March 25, 2016

Dependencies between tests

Filed under: Programming — Thomas Sundberg @ 20:07

This post has been migrated to http://www.thinkcode.se/blog/2016/03/25/dependencies-between-tests

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.

(more…)

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 http://www.thinkcode.se/blog/2016/02/16/comments-are-deodorant-for-your-code

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.

(more…)

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 http://www.thinkcode.se/blog/2016/01/14/separation-of-concern-when-using-selenium

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.

(more…)

December 26, 2015

Gradle and Cucumber-JVM

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

This post has been migrated to http://www.thinkcode.se/blog/2015/12/26/gradle-and-cucumberjvm

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.

(more…)

December 23, 2015

Continuous deployment – a case study

This post has been migrated to http://www.thinkcode.se/blog/2015/12/23/continuous-deployment-a-case-study

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.

(more…)

November 20, 2015

Expected exceptions

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

This post has been migrated to http://www.thinkcode.se/blog/2015/11/20/expected-exceptions

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.

(more…)

November 6, 2015

Different asserts are good in different situations

Filed under: Java, Teaching — Tags: , , , — Thomas Sundberg @ 11:49

This post has been migrated to http://www.thinkcode.se/blog/2015/11/06/different-asserts-are-good-in-different-situations

When should you use which assert? It is a question developers new to unit tests may ask themselves.

It is easy as a seasoned developer to think that this is obvious. It isn’t when you are learning.

(more…)

Older Posts »

The Silver is the New Black Theme. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 83 other followers