is this a good gherkin syntax - cucumber

This is my first time writing a gherkin scenario, and I'm wondering if my writing is appropriate for gherkin or not? The example is for getting to the dashboard. Here is my example:
Feature: [The dashboard of the platform]
Scenario: [getting into the dashboard]
Given user logged in
When user clicks on the dashboard
Then user get into the dashboard
When user clicks on my courses
Then user sees the courses he got enrolled
When user clicks on my marks
Then user sees his marks
When user clicks on my educational bags
Then user sees his videos and assignments
When user clicks on my certificates
Then user sees his certificates
When user clicks on student record
Then he user sees his record
When user clicks on sign out
Then user logs out

The art of writing good Gherkin is to focus on WHAT you are doing and avoid anything to do with HOW you are doing something. So with your scenario you need to think about WHAT you are doing.
Each scenario should deal with only one thing. So you should have only one WHEN per scenario.
Scenario: View my dashboard
Scenario: View my courses
Scenario: View my marks
Scenario: View my bags
...
Each scenario should be short and simple e.g.
Scenario: After I login I see my dashboard
Given I am registered
When I login
Then I should see my dashboard
Notice how there is nothing in the scenario about clicking, filling in login details, or being registered.
Cucumber is designed for doing BDD. Behaviour Driven Development. So you start from the When which describes the new behaviour you are going to develop. Then you think about the Then, which describes the results you should see after you have done the new behaviour. Finally you think about the Given which is all about what you need to have done previously so you can do the When.
So for you next scenario viewing courses you would start with
Scenario: View my courses
When I view my courses
then you would move onto
Scenario: View my courses
When I view my courses
Then I should see my courses
and finally for the Given you need to be viewing your dashboard so.
Scenario: View my courses
Given I am viewing my dashboard
When I view my courses
Then I should see my courses
Each new piece of behaviour builds on existing pieces of behaviour.
Viewing courses builds on viewing the dashboard
Viewing the dashboard builds on login
Login builds on registration
Hopefully this provides a good start.

Related

How to force custom sublist view (Saved Search) on specific roles

I have modified the view under communication > Messages for a supplier, so that nobody apart from Finance should be able to see certain transactions. I also managed to make the new one default. However, the users still see the other views in the view dropdown list and the ‘View History’ button shows communication history of everything.
Please advice on how to stop the users from using the other views and remove ‘View History’ button? I tried workflow but it did not work.enter image description here

What is the best way to add a user feed to his own timeline?

I would like to build an Instagram-like social app, where on the user timeline, you also have his own activities displayed. My first thought was to follow his own user feed but from what I read in this blog post: https://getstream.io/blog/best-practices-for-instagram-style-feeds/
We recommend blocking a user's timeline feed from following their own user feed
Can someone explain why it would be a bad practice ? How could I implement my use case if that is the case ?
Thanks !
Looking at this myself. I think the logic they describe is incorrect. The full statement in context make a little more sense in terms of what I think they mean.
We recommend blocking a user's timeline feed from following their own
user feed, and also blocking users from seeing/following another
user's timeline feed.
The first part of the sentence I believe is backwards. What I think it should says is that the "user" feed should be blocked from following the "timeline" feed. The user feed should just contain actions that the user performed, so it shouldn't contain data from the timeline feed. But if you want the user's activities to appear in the timeline feed than it seems to me that you should definetly make the user's timeline feed follow thier user feed, and prevent the user's timeline feed from unfollowing their own user feed.
The second part that says you should block users from following another user's timeline feed. I believe this is correct because the timeline feed is a series of peronalised items for an individual user. It doesn't make sense to follow another user's timeline feed.
This is how I have implemented my logic and it seems to be working so far, but if I come across any issues with it I'll come back here and update this answer.

Organizing cucumber test Scenarios and Features

when a new client is added I want to verify if the newly added client's details are correct.
For example,
Create a new client, after creation search his name and check if the details are correct or not.
Should I include them both in the same feature, or should I create a different feature for both adding and searching clients
Feature: Creating a new Client
The user is
Able to add a new Client
Scenario: Valid client entry.The client has a username,address
Given User is on the client page
When When he clicks on the add new client
Then He should see a pop up
Then He will enter the client name,address,title,phone no and email
And Click on the save button
Feature: Search for our newly added user
The user will be able to search a client
Scenario: Search for our newly added client
Given User is on the client page
When He click on the client search
And Types the user name
Then He should be able to match the first result
When He clicks on the first matched result
Then It will take him to a page with users details
It would be better to keep them separate. The strategy that worked best for me in many projects are, you should map each feature to the requirement (i.e. the high level user story or the requirement that is given to you from which you derive BDD scenarios and steps). Keeping each high level requirements in a separate feature files increases readability and maintainability.
In this case, looks like "Creating a new client" and "Search for our newly added client" are two different requirements/user stories, it is better to manage them separately, as the scenarios in each of these cases would vary. For an example, "Creating a new client" might have following scenarios:
Scenario 1: Create a valid client entry.The client has a username,address
Scenario 2: Creating a valid client entry failed due to missing information
Scenario 3: Creating a valid client entry failed due to client already exists
And for "Search for our newly added client" you would have other scenarios like:
Scenario 1: Search for a newly added user using username and search result should show the user details
Scenario 2: Search for a user using username who is not in the database and empty search result should be shown
Scenario 3: Search for a newly added user using address details and search result should show the user details
Scenario 4: Search for a user using username using address details who is not in the database and empty search result should be shown
As you can see, each feature is now nicely segregated and have their own related scenarios. As the project grows these scenarios are likely to grow and it would be easier to manage by keeping each high level requirements in a separate feature file.
Also another practice that really worked well for me is to prefix the Jira ticket(or whichever tool you use to manage your user stories) to the feature file as it would be easy to search and manage. For an example, your feature should be like "TI1001 - Creating a new Client" and "TI1002 - Search for our newly added user"
There are lots of ways to do this
features
clients
add_new_client
search_for_clients
I'd favour this one if clients are a really significant part of the
project
features
client_add
client_search
but this one would work.
The important thing is to try and be consistent.
As for your scenarios try and make them simpler e.g.
Feature: Add new clients
Background:
Given I am allowed to add clients
Scenario: Add a client
Given there are no clients
When I add a client
Then there should be a client
You want your happy path scenarios to be this simple, so you can expand on them with sad paths. e.g.
Scenario: Add a new client without an address
Given there are no clients
When I add a client with no address
Then I should see that a client cannot be added without an address
As far as searching goes things can get quite complex so again start simple
Feature: Search for clients
Scenario: Search for client Fred
Given there is a client Fred
When I search clients for Fred
Then I should see client Fred
Scenario: Search for client Fred when Fred does not exist
Given there is a client Sue
And there is not a client Fred
When I search for Fred
Then I should see a not found result
Scenario: Search for clients by postcode
Scenario: ...
With searching you need to be careful not to spend all your time testing your search engine (it should already be well tested.
These sort of features and scenarios are declarative, rather than imperative. They state WHAT they are doing and WHY, but avoid describing HOW anything is done. Cuking is much more effective with a declarative approach.

Is it possible to check whether a button has been clicked or not in actions on google?

At the end of the conversation I am creating a basic card which asks for a review. If the user does give a review I don't want to ask them again the next time. So what would be the best way to do so ? At the moment I am wondering whether I can track whether they have clicked on the button which leads to the review link provided in the BasicCard or not.
The link button does not report anything back to your fulfillment, so there is no direct way to know if the link has been clicked.
One possible workaround is a little convoluted, but would let you track if the link has been followed. It assumes, however, that you are storing a unique userid in the user storage (and that this is allowed in your jurisdiction). In this case what you can do is
When you generate the card, the link would go to another URL that you control - not the review URL directly.
The link would also include a parameter that includes the userid you've generated for them.
At the code running at this link, you get the userid parameter, mark in the database that they've been sent to the review page, then redirect them to the review page.
In future conversations, you can get the userid from their user storage and check your own records to see if they've been sent to the review page. From here, you can decide if you want to show the card, include the link, etc.

What action should I use for a complex review?

I am thinking about adding actions to a transactional email that asks a customer to fill in a review and currently links to a web-app where a complex questionnaire with several questions and text fields is available.
The amount of data that is collected is far more than would be achievable with the in app review action. However the registration guidelines state that the most high-fidelity action available should be used, but it doesn't really allow for granular enough data input for my use-case.
Should I use a Go-to action? Or is there a way to use the in-app review action to collect part of the data and then redirect to a partially filled questionnaire to offer the option to answer the other questions?
I think you should use the Go-To action. These are for more complex interactions, when you need to provide a direct link to the page where the action can be performed. They are rendered in an email as a button in the subject line that redirects the user to the page specified in the action definition.
https://developers.google.com/gmail/markup/reference/go-to-action

Resources