Most of the testers across the globe are using Behaviour Driven Development concepts to write their Acceptance Tests. However, while adopting the tools to achieve BDD, we are forgetting to know where and when to use them logically.
One such learning is, why I don’t use Cucumber for Acceptance Tests.
Before we go there, according to official Cucumber website, it says that –
Cucumber is NOT an API automation tool…
What do we do?
API Testing is one of the most important testing strategies in the testing cycle. When we say API Testing, we basically test the API against positive and negative scenarios . We typically cover the communication protocol (Response Codes) and multiple data testing at the integration test level.
In general, we test APIs like with the endpoint URL, we send some data as request, get some response data back and validate the response code and the data we expect, isn’t it?
I have seen people writing the Gherkins to achieve the above approach by providing the requests and responses via Scenarios, which makes me think about a question – Am I writing Business Acceptance Tests?
Let’s consider the below example –

Honestly, no where I can see this as a Business Acceptance Test. The above example can prove that we can write API Tests in plain English text, but doesn’t have any business value in it.
Behaviour Driven Development‘s core ideology and usages are achieved only when the requirements (scenarios) are defined from the end-user point of view and of course, the end users will not be worrying or knowing about the integration of the application. That’s the reason why the usage of tools like Cucumber from integration level , don’t really apply to the needs. In simple terms, it doesn’t speak Business Language.
Are you saying you can’t use BDD at all for API Testing?
The answer is a Big NO! You can use it!!!
There are BDD tools that can be adopted to get the best API Testing like –
- Rest Assured
- Karate DSL
- REST Client
- HTTParty
So, next time when you write your API Testing in Gherkins, please think whether it speaks user’s perception.
Happy Testing!!!
Feature Image Credit:
https://cloudqa.io/api-testing-and-automation-101-the-essential-guide/
Leave a Reply