I'm currently writing some end-to-end tests using Cucumber and Selenium for an application that has a session based login/authentication.
Keeping the Cucumber approach, I am trying to keep each tested feature completely independent of one another. The problem is, because the application uses session based authentication, every time the WebDriver
is closed (after each feature tested), the next feature tested will create a new WebDriver
object, which will subsequently need to pass the login screen to execute the test.
What's the best approach here? I still want to test the login feature, but feel like I have a lot of duplication by running the login feature tests before any other feature test.
For example, say I have a Product List feature that I want to test if a list is displayed or not, based on what type of account the user is logged in with. My Given
step for one of the the Product list feature scenarios might be 'Given I am logged in as a admin user
', while the Given
step for a different scenario might be 'Given I am logged in as a non-admin user
'.
How might I direct these two Given
steps to the appropriate login scenarios that have already been written?
Aucun commentaire:
Enregistrer un commentaire