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.
You are probably picking up JUnit3 on your classpath somewhere, which effectively disables JUnit4.
Run mvn dependency:tree
to find out where it's coming in from and add exclude if from the dependency.