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 ...
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 ...
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
...
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 ...
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 ...
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 ...
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>,<...
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 ...
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. ...
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 ...
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 ...
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 |
|...
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 ...
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 ...
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, ...
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 ...
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 ...
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 ...
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://...
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?
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 ...
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}
...
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....
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
gherkin × 26cucumber × 17
bdd × 14
automated-testing × 6
specflow × 6
selenium-webdriver × 5
java × 2
python × 2
intellij × 2
step-definitions × 2
javascript × 1
api-testing × 1
robotframework × 1
selenium-webdriver-c# × 1
cypress × 1
katalon × 1
nodejs × 1
acceptance-testing × 1
pytest × 1
webdriver.io × 1
external-dependencies × 1
playwright × 1
allure × 1