Hot answers tagged

4 votes
Accepted

Can a scenario have multiple example tables?

I believe there is no support for multi-dimensional examples tables in Gherkin scenarios as you have described. Also keep in mind what BDD is largely for: being readable to the business. We developers ...
Jacob Hackel's user avatar
4 votes
Accepted

Automation: how to isolate test cases when they really depend on another one?

Tests should be independent and create whatever they need to work. That said, there can be difficult cases. The situation you present is very common. It's a special case that presents itself to ...
Michael Durrant's user avatar
4 votes
Accepted

Should scenarios be short or complete?

Break it up. Just as importantly, however, see what unit and integration tests you can make. I see: confirmation form validations composition of email to a new user triggering email for a new user ...
Michael Durrant's user avatar
4 votes

Is it good practice to skip the When clause in Gherkin/Cucumber/SpecFlow?

It depends The point of the Given/When/Then pattern is that it describes test preconditions (Given), actions (When), and expected results (Then) - very similar to the unit test arrange/act/assert ...
Kate Paulk's user avatar
  • 31.5k
4 votes

Gherkin: When is appropriate to use the 'background'?

In the end, it runs to personal preference on how to right things. As you said, a background step is needed when multiple scenarios in the feature file has same GIVEN clause and we can move such a ...
João Farias's user avatar
  • 10.5k
3 votes

Should scenarios be short or complete?

To answer to the main question: Both. Short, complete and test only thing. Avoid doing checks in different parts in the same test(check email + check back-end + check front-end) The first issue I see ...
lauda's user avatar
  • 977
3 votes

Using same table for When and Then in gherkin scenario

You can use Scenario Outlines. Scenario Outline: Insert and Verify data blah blah Given I insert <code>, <name> and <Price> into database Then I can verify that <code>,<...
Sandeep Chandra Sekhar's user avatar
3 votes

BDD Given - How do you set the starting page?

Given is your setup, it brings the system under test in a state you can start doing the action you want to test. The given part describes the state of the world before you begin the behavior you're ...
Niels van Reijmersdal's user avatar
2 votes

Use Gherkin syntax for Acceptance Criteria without accompanying BDD tool

Cucumber won't magically make tests from your Gherkin features. With all those tools you still have to write the step definitions and the code that actually makes the tests happen and maintain it. ...
Amias's user avatar
  • 1,202
2 votes

Automation: how to isolate test cases when they really depend on another one?

There are two main approaches you could use. Both make use of having a setup routine that runs once at the beginning of your test run - usually it will be a ClassStart or ApplicationStart type of ...
Kate Paulk's user avatar
  • 31.5k
2 votes

IntelliJ feature file undefined step reference with import io.cucumber.java.en.Given

I had the exact same issue with our team's project. If you update to the latest version of IntelliJ (Currently 192.6x) it does support the latest version of the Cucumber for Java plugin now. After ...
Chris Johnson's user avatar
2 votes

Using same table for When and Then in gherkin scenario

You could do something like this (using almost the above answer example) Scenario: Insert and Verify data blah blah Given I insert the following items into some form | Code | Name | Price | |...
roman's user avatar
  • 86
2 votes

Automation: how to isolate test cases when they really depend on another one?

In your example test 2 is only dependent upon test 1 if you are creating a new account on every test run. This is slow and possibly redundant. You can validate account login separately from account ...
sphennings's user avatar
2 votes

Is it good practice to skip the When clause in Gherkin/Cucumber/SpecFlow?

No, the when is the action you are testing. Why not write it as: Scenario: User has to open a website Given Joey (a typical user) that has access to the website When Joey visits the page Then ...
Niels van Reijmersdal's user avatar
2 votes

How to repeatedly run tests which add the same user to the system

Ideally, your tests should always run against the same configuration so they are 100% reproducible. This also includes the database. There are two typical options to solve your issue: As mentioned, ...
FDM's user avatar
  • 5,904
2 votes

Should scenarios be short or complete?

It is a good approach to split the complex scenarios in a set of short testcases. You can use the below-mentioned use-cases for your problem, that we will usually create for functional testing ...
Vishal's user avatar
  • 1,254
2 votes
Accepted

How do I write a gherkin specification to check a large list of values?

Well, I belive such the verification will contradict the goal of Gherkin to improve readability of your scenarios. However if I would approach such the task, I would keep the item list in a separate ...
Alexey R.'s user avatar
  • 11.6k
1 vote

How to repeatedly run tests which add the same user to the system

You could add a hook that would run prior to each test execution. And that hook would delete the user from the database for that particular scenario. @After public void beforeScenario(Scenario ...
Mate Mrše's user avatar
  • 4,119
1 vote

Why is my Feature File failing to find the Step Definition?

Your java is defined as a folder and not package try defining it as package and calling java.uk.co... if you see the folder color scheme , it shows that green means the folder is test source ; https://...
PDHide's user avatar
  • 11k
1 vote

Specflow Cucumber BDD - Only log in once on test run not on every scenario

I would go with different features. CAN you go with DB1.feature doing everything and then DB7.feature? Can you create employee and customer in one run on the same DB?
Michal Dobrzycki's user avatar
1 vote
Accepted

Specflow Cucumber BDD - Only log in once on test run not on every scenario

I don't recommend reusing sessions but you could do the login as part of your [OneTimeSetUp]/[AssemblyInitialize] in your test class and likewise [TearDown]/[AssemblyCleanup] the session (what you use ...
kirbycope's user avatar
  • 4,090
1 vote

Can Robot Framework framework iterate over example data?

The closest you can get to your Katalon example is using Templates with embedded arguments: Verify Prices of All Plans [Template] Account ${account} and ${plan} Should Have Price ${price} ...
pavelsaman's user avatar
  • 4,538
1 vote

In Gherkin files, should I repeat the steps in the previous scenario if my following scenario depends on it?

The two ways to avoid duplication are using: Background Using page object and creating wrapper function with all prerequisite Given('a web browser is at the Google home page', () => { homepage....
PDHide's user avatar
  • 11k
1 vote
Accepted

API Testing with Specflow BDD Selenium?

It all depends on the logic you intend on testing, and when the test fails, how large an area of the application you'll need to investigate. A full end-to-end test verifies data on screen. Doing this ...
Greg Burghardt's user avatar
1 vote

API Testing with Specflow BDD Selenium?

In this case , The only need for testing the backend database is when you doubt whether the browser is actually getting the data from the database or is it simple caching it in cache or browser local ...
PDHide's user avatar
  • 11k
1 vote
Accepted

Cucumber - How to run background only once

No, you can't run Background only once; It's meant to run before every scenario. You'll need to use something other then Background if you only want to run those steps a single time. For the purposes ...
Dylan Lacey's user avatar
1 vote

Behavioural Gherkin Steps requiring complex Step Definitions when Automating

Gherkin should also be devoid of technical details. The fact the notification setting is saved to the database does not belong in a scenario. The fact notifications are turned "on" does belong. I ...
Greg Burghardt's user avatar
1 vote
Accepted

Use Gherkin syntax for Acceptance Criteria without accompanying BDD tool

Benefits of gherkin non-automated: Has rigid structure (given/when/then, steps and tables) Can be more familiar to QA and DEV Easy to put to source control and review changes as textual diffs Can be ...
Mykola Gurov's user avatar
1 vote

Automation: how to isolate test cases when they really depend on another one?

Componentization is key in BDD. Let's say test 1 is a behavior of account creation and test 2 is a behavior of login. Create two separate components one for creation and other login and make of use ...
Bharadwaj Pendyala's user avatar
1 vote

Where to state test data in Cucumber

In my opinion you can use 4 approaches: Create/append a unique ID for every user you create (with something like String uniqueID = UUID.randomUUID().toString();) Create/append an index, to be stored ...
acejazz's user avatar
  • 198

Only top scored, non community-wiki answers of a minimum length are eligible