I would like to understand what is the best practice to execute Selenium tests in a multi-page web application.
Pages:
- Home page
- Product page
- Checkout page
So my question comes down to:
- Should I have a JUnit class per page (this is my current approach) OR
- Should I have just one JUnit class (similar to Test Suite - never ever created one before) that tests all of the application's pages in one go. Of course, I plan on having multiple methods (annotated with @Test) within it for testing each page functionality.
My current approach which is based on option #1, just before the execution of the test I launch the browser using setUp() method annotated with @BeforeClass and then close the browser with tearDown() method annotated with @AfterClass respectively. My confusion with this approach is that if it's a best practice and the correct way to go about testing all these 3 pages since I am launching and closing the browser 3 times here.
Note: Using Maven for current project. I did some googling around and in most of the examples/articles that I see online people recommend using mvn test command to execute all the tests.
Please guide.
Aucun commentaire:
Enregistrer un commentaire