I recently released Selenium JUnit 4 Runner. It is an extension for JUnit 4 providing a test runner to execute Selenium test cases. Both the Selenium 1.0 (Server) and 2.0 (Web Driver) APIs are supported.

Here is a very simple example:

@RunWith(SeleniumJUnit4ClassRunner.class)
    @WebDriverConfiguration
    public GoogleHomePageTest {

    @SeleniumWebDriver
    private WebDriver webDriver;

    @Test
    public void testGoogleSearch() {
        webDriver.navigate().to("http://www.google.com");
        assertEquals("Google", webDriver.getTitle());
    }
}

The Selenium JUnit 4 Class Runner launches the Selenium web driver or connects to the Selenium server before executing any methods annotated with @BeforeClass. It then autowires any members of the test class or method rules that have been annotated with @SeleniumBrowser or @SeleniumWebDriver.

Maven Coordinates

Selenium JUnit 4 Runner is available from Maven Central at the following coordinates:

<dependency>
    <groupId>com.btmatthews.selenium.junit</groupId>
    <artifactId>selenium-junit4-runner</artifactId>
    <version>1.0.0</version>
    <type>test</type>
</dependency>

Leave a reply

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

required