Before I can try to motivate why you should use a tool, let me define what it is and what it does.
What is cucumber?
Cucumber is a tool for collaboration and testing. It is used to create examples of behaviour that are executable. Creating examples in a collaborative way emphasize close cooperation between business analysts, testers and developers. The examples they come up with can be used as acceptance tests for the system being developed. It can be used as a testing tool where the tests are defined in a business friendly language while still being executable.
Our goal is to create a common understanding of the problem and therefore simplify the communication between all parties involved. We would also like to get something that is possible to use for automating the verification of the resulting program. That is, use as a base for test automation of the system.
In my assignment as a Configuration Manager, CM, I need to script a lot of things. I also need to automate the execution. Most of the stuff I build is built using Maven. Some is built using Ant. Both Maven and Ant are easy to run from TeamCity. But none of them are very flexible when it comes to scripting. Maven isn’t designed for it and Ant is missing some features and get very verbose. The most important feature I am missing in Ant is repetition.
I saw a panel debate a while ago where three guys were discussing their favorite tools. The tools represented were Scala, Ruby and Groovy. One thing that I remembered from that session was that the Scala guy mentioned that he often used Ruby when scripting. My problem with using Ruby is that I don’t have control over my execution environment. I can’t install tools in it. I am not interested, either, because that wouldn’t scale very well since the installation done on our build servers are done manually. I can, however, expect that Maven and Ant will work.
Given that I can expect Maven to work, I decided to try to execute a Ruby script from Maven. It turned out to work very well. I was able to reduce the size of an Ant script with 50% on my first attempt. In my opinion, the readability increased a lot. I was able to write the script more or less as prose.
If you are interested, this is how I did.
A lot of people and companies are talking about and thinking of test automation. It seems to be like a holy grail within software development for a lot of people.
I am, however, sometimes wondering if they have thought this through properly. A few questions are important to know the answer to before you start a project that aims to place a product, or a project if you want, under automated testing. It seems to me as if a lot of people haven’t thought enough of the question why or the question what. Focus is often on the question how and almost never on where or when. How is obviously important, but if why and what hasn’t been properly understood then the how is uninteresting. Where is also important to decide upon. Some things should be tested through the final user interface, some things should be tested on the inside of a system. Some things should be tested with unit tests and some things at other levels. Finally, it is important to decide when the tests should be implemented. Tests can be implemented first, last or during the implementation of the system. This may not seem to a big deal, but it turns out that it is.
But let us start with the why.
Writing unit tests that test almost the same thing may introduce duplication. A solution could be to create parameters that should be varied in a list and iterate over it. Yet another solution is to create a parametrised test. Let us look at an example where these three options are explored.
It is common to talk about resources. Unfortunately what we mean is often people who we want to help us with something. A project need resources to be able to solve the task.
Ian Kelly called the System Under Test, SUT, the System Under Specification, SUS, at his session “Testing++ – Working with Spock and Geb” on Java Developer Day in Krakow.
What is a hero?
A hero in an organisation is someone who is considered to be indispensible. The organisation will not survive without this person. The hero is the only person with a specific knowledge. A hero sacrifices himself for the organisation.
I watched a presentation by Zsolt Fabok a while ago and saw a technique I hadn’t thought of before. How do you verify that a parameter is used in a simple way? Feed the method with something that usually doesn’t work and verify that something happens.
What is the problem with one hero that always solves any problem? One answer is that those who get problems solved never learn how to deal with the problem and solve them. What is the problem with this? One answer is that you build an organization where the bus count is one. One person always solves any issues and the organization doesn’t know how to do it. When this person steps out in front of a bus and doesn’t show up at work, then there is a real problem.
Do you need to change the path to a binary a Windows sevice is executing? Maybe you want to change the location of where a service is installed?