How to perform Selenium navigation before tests run without using JUnit setUp?



  • How to perform Selenium navigation before tests run without using JUnit 4.11+'s setUp or at the start of the test method? We've got both navigation and bookmark based Selenium tests. The test code for the page under test is in a separate method that is called by test methods ending in either Bookmark or Nav. Navigation to the page under test is called from the setUp method, but exceptions that occur when navigating don't get treated as test failures because they are running in setUp. An easy solution that we don't like would be adding a call to the navigation method as the first line of each Nav test. Is there an alterantive way to handle our navigation?



  • Use a JUnit Rule. Here are two articles I wrote about how I've used Rules: Using Rules to Influence JUnit Test Execution What JUnit Rules Are Good For



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2