Skip to content

How I Used Kraken and Gherkin to Automate 100+ Test Cases at Work

I learned Kraken and Gherkin in a week and used them to write more than 100 automated test cases for a real product at BlackHawk. Here is what I automated, the bug it caught, the beginner mistake I made and what I would tell anyone starting out.

Kavya Kumar6 min read2 views

Cover with the title "Kraken & Gherkin" and a "100+ Test Cases" badge, next to an illustration of a test checklist with green checkmarks.

The Short Answer

At BlackHawk, I wrote more than 100 automated test cases using Kraken and Gherkin. I had never used either before. I was asked to use them, studied for about a week through online courses on LinkedIn, and started by writing small practice tests before touching anything real. The tests covered user journeys and how the product is used, and they helped catch a real bug and move checking from manual work to automatic runs. My biggest early mistake was getting positive and negative test cases the wrong way round, and it taught me more than anything else did.

I am keeping the details of the company's application general on purpose, so this post focuses on the approach and the lessons.

How I Got Started

I did not choose Kraken myself. I was asked to automate testing with it, and I had one week to get comfortable. I used online courses on LinkedIn to learn the basics of Gherkin and how Kraken runs tests, then moved into the real application.

If you are in the same position, a week is enough to start, but not enough to be good. Plan on learning most of it while you work.

If you have not met Kraken yet, my Kraken tutorial explains what it is and how to set it up. You can also read the official Kraken documentation.

Why Gherkin Works Well for Testing

Gherkin is a plain-English way to describe behaviour using "Given, When, Then". A test reads like a short story about what a user does and what should happen. The official Gherkin reference covers the full syntax.

Because it reads like English, people who do not write code can still read the tests and check that they describe the right behaviour. That is a real advantage when testers, developers and product people all need to agree on what "working" means.

What I Automated

I used Gherkin to automate the way real people use the product:

  • User journeys: the steps a user takes from start to finish to achieve something.
  • Product usage: how the main features behave when they are used the way they are meant to be.
  • How-to flows: the guided steps a new user follows to learn the product.

Writing these as scenarios forced me to understand the product properly. To describe a journey in Gherkin, you must know exactly what happens at each step.

The Mistake That Taught Me the Most

Every product needs two kinds of tests:

  • Positive test cases check that things work when a user does the right thing, such as logging in with a valid password.
  • Negative test cases check that the product handles wrong or unexpected actions properly, such as logging in with a wrong password and seeing an error.

In my first days, I wrote them the wrong way round. My positive tests were checking what should fail, and my negative tests were checking what should succeed. The tests ran, and some even passed, but they were proving the wrong things.

Here is the idea in a generic example, not from the company's application:

gherkin
Feature: Login

  Scenario: Positive - user logs in with valid details
    Given I am on the login page
    When I enter a valid email and password
    Then I should see my dashboard

  Scenario: Negative - user logs in with a wrong password
    Given I am on the login page
    When I enter a valid email and a wrong password
    Then I should see an error message
    And I should stay on the login page

My mistake was like swapping the "Then" lines: expecting an error for the valid login and a dashboard for the wrong password. Once I noticed it, I went back and corrected the scenarios.

How to avoid it:

  • Name every scenario clearly, starting with "Positive" or "Negative".
  • Before writing a scenario, say out loud what a correct product should do. Then write that as the "Then" step.
  • Break something on purpose. If your test still passes when the product is wrong, the test is wrong.
  • Ask someone to read your scenarios without running them. Plain-English tests make this easy.

What Automation Actually Gave Us

The biggest win was catching a real bug. I will not describe that bug in detail, because it comes from the company's application. To show what this kind of catch looks like, here is a typical example of a login bug that a negative test finds, written as a generic illustration and not as the bug I found.

Say the rule is: "A wrong password must show an error and keep the user on the login page." The test below checks exactly that:

gherkin
Scenario: Negative - login is refused when the password is wrong
  Given I am on the login page
  When I enter a valid email and a wrong password
  Then I should see an error message
  And I should stay on the login page

Now imagine that after a change to the code, the test starts failing. The error message appears, but the app also takes the user to the dashboard. A person checking by hand might only look for the error message and miss that the user got in anyway. The automated test checks both things every time it runs, so the problem shows up straight away, before a user ever sees it.

That is the idea I tried to build into my own tests: describe what must always be true, and let the tests catch it when it stops being true. I also tried to set up the tests so that bugs like it would be found automatically in future runs, instead of relying on someone to spot them by hand. That saved time, because checking the same journeys manually after every change is slow and easy to get wrong.

I will not put a number on the time saved, because I did not measure it carefully. The more important change was that checking the product became something that could run again and again without extra effort.

What I Would Tell Anyone Starting

  1. Start from scratch and learn the basics properly. Understand the Gherkin syntax and what each keyword means before you write anything for real.
  2. Write dummy test cases first. Practise on something simple before touching a real product.
  3. Understand the product before you test it. You cannot write a good test for a journey you do not understand.
  4. Write positive and negative cases deliberately, and double-check which is which.
  5. Move to advanced scenarios last. Add complexity only when the simple tests are reliable.
  6. Keep scenarios short. One behaviour per scenario is easier to read and fix.

Frequently Asked Questions

How long does it take to learn Kraken and Gherkin?

You can learn the basics in about a week with a focused course, as I did. Getting comfortable with real projects takes longer and comes mostly from practice.

What is Gherkin used for?

Gherkin describes software behaviour in plain English using Given, When and Then. Tools such as Kraken read those descriptions and run them as automated tests.

What is the difference between positive and negative test cases?

Positive test cases check that the product works when users do the right thing. Negative test cases check that it handles wrong or unexpected input correctly.

Do you need to be a programmer to write Gherkin tests?

The scenarios themselves are plain English, so the basics are easy to learn. Writing custom steps and setting up the tools does need some programming knowledge.

Can automated tests replace manual testing?

Not completely. Automation is excellent for repeating the same checks quickly, while manual testing is better for exploring new features and noticing problems nobody planned for.

Final Word

I learned Kraken and Gherkin because I was asked to, and I made a clear mistake along the way. That is the honest version of how most people learn test automation. If you are about to start, begin small, check your tests against what the product should really do, and let the habit grow from there. You can see more of my work on my experience page.

Share this post

WhatsAppLinkedInXTelegram