serenity-bdd / serenity-core

Serenity BDD is a test automation library designed to make writing automated acceptance tests easier, and more fun.
http://serenity-bdd.info
Other
719 stars 516 forks source link

How to initialize a webdriver when a failure occurs #2228

Closed Minato20119 closed 2 years ago

Minato20119 commented 4 years ago

My problem is as follows: https://stackoverflow.com/questions/63859825/how-can-i-continue-to-run-other-steps-when-there-is-a-failure-using-serenity I am not sure how to re-create a new webdriver. With selenium I just need: Webdriver newDriver = new ChromeDriver();` Does Serenity allow the initialization of a new webdriver? Thank you very much!

globalworming commented 4 years ago

from https://stackoverflow.com/a/63861214/1359903

Reading data from tables usually is a use case for parameterized tests. With cucumber you need to put the data table into the feature file https://webkul.com/blog/parametrization-in-cucumber/

Scenario Outline: Test user Login with different credentials
    Given Open Firefox and navigate to Login page
    When valid "<username>" and "<password>" is entered
    Then User should be logged in successfully

Examples:
    | username   | password |
    | rahul@gmail.com | Test@123 |
    | xyz@gmail.com| Testtest |

see https://stackoverflow.com/questions/53193890/cucumber-how-to-read-examples-from-external-excel-file-for-scenarios-outline how to get the data from excel into the feature file.

It seems to me you are not very experienced with the frameworks you use, do you really need them? Maybe I can recommend starting with a simple JUnit Parameterized test? Example: https://www.lambdatest.com/blog/junit-parameterized-test-selenium/