-1

We are starting to implement BDD and we have a scenario that I don't know how to implement.

We implemented BDD using Specflow with selenium.

In the web page there's a Dropdown that when you switch the content, the web page also changes. I would like to iterate through that dropdown and check that the changes are applied correctly using Gherkin but I would like to do it the most effective way possible.

Also is it possible to do it without reloading the driver every time?

1
  • Please show us the code you already tried and the HTML structure you are working with. Otherwise we cannot help you. Mar 14, 2020 at 0:08

1 Answer 1

0

I would recommend to use a DataTable. First some steps to enter page, then in step with table, where one column - value, which needed to select, other values - what to validate on page. Second way, I would use Scenario Outline, but this is not so effective, as you want.

5
  • Basically in my Given section, I provided a Data table where the first column is the dropdown value and all the other columns are the other page element value? Mar 13, 2020 at 19:24
  • Yes. Something like: Given I navigated to home page. When I entered page with drop-down. Then I choose value from drop-down and see next data on page (last step - Then - with data table).
    – Ukrainis
    Mar 14, 2020 at 11:12
  • Bad side of this approach is if test will fail on first drop-down value, then next values will not be validated. So, I would strongly recommend to use Scenario Outline in this situation.
    – Ukrainis
    Mar 14, 2020 at 11:14
  • Is there a way to not reload the web driver? The way that I'm set up right now is that I have to provide wich driver I want to test in the Given since there's multiple browsers. However, in this case, I would like to, once i'm on the page, not go through the process of loading the driver again. I know you can do a background but from my understanding it's just to prevent the user from rewriting the same step but will still be process every scenario. Mar 16, 2020 at 13:26
  • You can use static constructor in your Driver class. In this case, all tests will be in one browser window. Here is how to do it: tutlane.com/tutorial/csharp/…
    – Ukrainis
    Mar 16, 2020 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.