Scenario Data Setup

I’ve only been working with CucumberStudio and BDD for a couple of months. I’m looking for feedback on whether I’m doing data setup correctly in my scenarios. We are exporting to Cucumber/TypeScript.

We have a feature that when the user is adding someone to a team, then only the teams that the user doesn’t already belong to should display for selection. I’ve attached a screenshot of the scenario.

Basically, step 2 lists the teams that already exist (but they don’t really; they would have to be created as part of the test) and step 3 states that the user already belongs to one of those teams. Step 5 lists the teams that should display for selection. Am I writing this scenario the correct way? Your feedback and/or assistance would be greatly appreciated.

–Shari Banks

Hello Shari,

What I would recommend is to focus on the behavior of your feature when you write a scenario, not the frontend interaction. If you want to know more about BDD, I would also recommend to check out Cucumber school and our blog.

This is what I would do to write the scenario but be aware that it is based on my understanding.

Given a user is authenticated as Super Admin
When I add a user to another hub (do not care in the scenario if it is a drop-down or radio buttons, or something else, just focus on the action)
Then only hubs that to do not include the user are available (no datatable here. Programatically, you can just check that you do not display the hubs including the user)

The fact that “organization contains these hubs” and “there is a user who belongs to this hub” are not required since they do not bring anything to the behavior which should be true in any case.

I hope it helps. You are on a good track! Happy testing!!!

Thank you. Your rewrite makes 100% sense.