Running a single test in maven -> No tests were executed!

John Manak picture John Manak · Jan 10, 2011 · Viewed 27.8k times · Source

When I run a single test in Maven with this command:

mvn test -Dtest=InitiateTest

I'm getting the following result:

No tests were executed!

It worked a couple of minutes ago, but now it stopped working for some reason. I tried running mvn clean a couple of times before running the test, it doesn't help.

The test looks like this:

import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class InitiateTest {

public static FirefoxDriver driver;

@Before
public void setUp() throws Exception {
   driver = new FirefoxDriver();
}

@Test
public void initiateTest() throws Exception {
      driver.get("http://localhost:8080/login.jsp");
      ...
}

@After
public void tearDown() throws Exception {
driver.close();

} }

UPDATE:

It's caused by adding this dependency to POM:

<dependency>
   <groupId>org.seleniumhq.selenium</groupId>
   <artifactId>selenium</artifactId>
   <version>2.0b1</version>
   <scope>test</scope>
</dependency>

When I remove it, everything works fine. Everything works fine even when I add these two dependencies instead of the previous one:

<dependency>
   <groupId>org.seleniumhq.selenium</groupId>
   <artifactId>selenium-support</artifactId>
   <version>2.0b1</version>
   <scope>test</scope>
</dependency>
<dependency>
   <groupId>org.seleniumhq.selenium</groupId>
   <artifactId>selenium-firefox-driver</artifactId>
   <version>2.0b1</version>
   <scope>test</scope>
</dependency>

This is weird.

Answer

joel truher picture joel truher · Apr 26, 2012

Perhaps you are seeing this bug, which is said to affect surefire 2.12 but not 2.11?