Trending
New AI method can support real-time management of infectious diseases is trending now Katsina Government Opens New Diphtheria Isolation, Treatment Centre is trending now Role of ethics education in accounting fraud prevention is trending now Even ancient bacteria possessed intercellular communication structures like humans today,… is trending now NASA inaugurates first telescope named after female scientist is trending now Salah's successor arrives at Anfield: Liverpool sign Barcola in a historic deal is trending now Aston Villa vs Arsenal: Shearer predicts Monday’s EPL fixture is trending now Man City agree £65m deal for Everton's Ndiaye is trending now Barcelona's comeback against Rayo Vallecano reminds Real Madrid of a painful past is trending now Ikogosi Resort partners AFRIMMA to promote Nigeria’s tourism is trending now Mindustry Conference Partners Warner Music Africa/Africori For Fifth Edition, Opens Regis… is trending now BBNaija S11: Aikou, Flora Risk Losing Gambit Status is trending now New AI method can support real-time management of infectious diseases is trending now Katsina Government Opens New Diphtheria Isolation, Treatment Centre is trending now Role of ethics education in accounting fraud prevention is trending now Even ancient bacteria possessed intercellular communication structures like humans today,… is trending now NASA inaugurates first telescope named after female scientist is trending now Salah's successor arrives at Anfield: Liverpool sign Barcola in a historic deal is trending now Aston Villa vs Arsenal: Shearer predicts Monday’s EPL fixture is trending now Man City agree £65m deal for Everton's Ndiaye is trending now Barcelona's comeback against Rayo Vallecano reminds Real Madrid of a painful past is trending now Ikogosi Resort partners AFRIMMA to promote Nigeria’s tourism is trending now Mindustry Conference Partners Warner Music Africa/Africori For Fifth Edition, Opens Regis… is trending now BBNaija S11: Aikou, Flora Risk Losing Gambit Status is trending now
Automation Testing

How do you do field validation in Gherkin?

How do you do field validation in Gherkin?

How do you do field validation in a Cucumber scenario? I got this question recently, and wanted to share a few techniques I've personally found helpful. Here's one option: This is a classic data-driven approach. It is pretty readable....

How do you do field validation in a Cucumber scenario?

I got this question recently, and wanted to share a few techniques I've personally found helpful.

Here's one option:

This is a classic data-driven approach. It is pretty readable.

But the test will reload the page for each variation, which might not be optimal.

What else could we do?

Here we use soft asserts to perform multiple checks on the same page. Not a conventional use of Gherkin, but it is perfectly readable, and would run quickly as well.

But what if we need to check all the fields on a page? Well, how about this?

This is a bit more sophisticated - it dynamically fills each field with an empty value, and checks the corresponding error message using soft assertions. It is readable and efficient, at the cost of more complexity under the hood in the glue code.

All these options could work.

But here's the thing: field validation is often too granular to be of much interest for a business user - it's often considered to be something that should "just work".

Business folk are (or should be!) more interested in what happens AFTER the values are entered, not in the nitty-gritty details of field validation.

So write scenarios like this if it helps build confidence in your software - or simply write UI-level unit tests to do the same job. But make sure you have the conversations with the business folk about what happens next, and put THAT in your scenarios as well.

The post How do you do field validation in Gherkin? appeared first on John Ferguson Smart.

View original source →

Related

More from John Ferguson Smart