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
I have. More than once and been very frustrated. These are tools I like. Not getting good messages upsets me.
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.
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.
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.
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.
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.
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.
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.
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.
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.