Hot answers tagged

4

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 have to be careful not to get too technical in the feature files ;) That being said, I can think of a couple ways to solve this problem. 1.Write either the ...


4

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 triggering of notifications to Administrator setting email status based on event trigger of analytics notification All of these should have unit tests to ...


4

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 pattern. In the example you've given the actions are implied: the user navigates to the website. Depending on what's needed to prove the user's access, that could ...


3

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 its the whey the scenario is defined (too many details, not following the BDD principles -> one of them is to define steps that are very easy to understand and ...


3

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>,<name> and <price> has been inserted successfully Examples: | Code | Name | Price | | 001 | Product 1 | 1,00 | | 002 | Product 2 | 1,50 | | 003 |...


3

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 specifying in this scenario. You can think of it as the pre-conditions to the test. https://martinfowler.com/bliki/GivenWhenThen.html Depending on the ...


3

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 most automation engineers as some point. It's not so much an example of dependencies that cross tests and more a specific issue - creating a user account. I ...


2

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. None of the BDD tools will help you do that and most of them make it hard to exploratory test. If the acceptance is a sprint level its going to be harder to have ...


2

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 event. You should also run a cleanup routine at the end of the test run to roll back any changes you have made. If you have a static known starting point - If you ...


2

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 updating you will be able to change from using cucumber.api.java.en to io.cucumber.java.en If you are updating from 191.x you may need to reinstall the Cucumber ...


2

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 | | 001 | Product 1 | 1,00 | | 002 | Product 2 | 1,50 | | 003 | Product 3 | 2,00 | Then the items should appear on the list At the Given step you ...


2

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 creation, provided you have a preexisting account on the system that you know the credentials for. It's common to have tests that are dependent upon other ...


2

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 source (say, a file). And then the construction like: Given I am at the page with a long list When Check all the items on a page Then List items correspond to ...


2

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 Joey is be able to validate the page content You can technical skip step phases, you can also leave the implementation of a step empty. Sometimes I create ...


2

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 services in our software testing services company. Verify that new user/non-logged user should be prompted for the registration. Verify that new user should be able ...


1

The closes 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} Free Android 19.79 Free IOS 19.79 Free Both 24.99 All other logic would be inside Account ${account} and ${plan} Should Have ...


1

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.goto() } When('the user enters "panda" into the search bar', () => { homepage.enter("panda") } Then('links related to "panda&...


1

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 in BDD certainly replicates that test, but the behavior is what BDD is about. What behavior are you testing? How many reasons does your test have to fail? If ...


1

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 storage. So, if you want to ensure that's not what is happening, then use driver.quit() and open a new driver instance. This will be a new instance with all ...


1

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 would just change the wording in your Then step to: Then email notifications should be on Also notice that "email" is all lower case, since it is not a proper ...


1

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 eventually supplied with a glue which would execute those specs against an implementation or a model of such. Although most of the time that would still ...


1

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 of them wherever required. According to the feature your testing you have to choose which behavior to be used in GIVEN acting as a precondition.


1

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 in a file, to the used ID (so that you will have users like "User_1", "User_2" and so on) Create/append a timestamp to the user ID to be used Go to the ...


1

You can simply add a commented line if it's better for understanding the scenario. Otherwise you can alway add an empty step, even a generic one like "Business Context:...." to reuse that empty step for multiple purposes.


1

You should mock / stub those dependencies. WebMock can do that. It stubs at a low HTTP client lib level. Add require 'webmock/cucumber' in the support/env.rb file Examples: Simulate basic http stub_request(:get, "www.test.com").to_return(:body => "Test") stub_request(:post, "www.test.com").with(:body => "test", :header => "Content-Type: ...


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