Bonjour,

J'aimerais lancer des tests d'intégration Selenium Web Driver avec Maven.
Pour cela, j'utilise le plugin Failsafe.

Mais les tests d'intégration ne se lancent jamais, quel que soit la phase (integration-test, verify, install). Alors que les tests unitaires se lancent correctement.

Voici l'arborescence du projet :
-- projet
---- projet-dao
---- projet-service
---- projet-web

projet - pom.xml
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<build>
	<pluginManagement>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<version>2.12.4</version>
				<configuration>
					<includes>
						<include>**/unit/*.java</include>
					</includes>
				</configuration>
			</plugin>
		</plugin>
	</pluginManagement>
</build>
projet-web - pom.xml
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<build>
	<plugins>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-failsafe-plugin</artifactId>
			<version>2.12.4</version>
			<configuration>
				<includes>
					<include>**/integration/*.java</include>
				</includes>
			</configuration>
			<executions>
				<execution>
					<id>integration-test</id>
					<goals>
						<goal>integration-test</goal>
					</goals>
				</execution>
				<execution>
					<id>verify</id>
					<goals>
						<goal>verify</goal>
					</goals>
				</execution>
			</executions>
		</plugin>
	</plugins>
</build>
Les tests se situent bien dans le dossier src/test/java.

J'ai testé sans la partie <configuration> avec la configuration de base du plugin, en indiquant explicitement la classe Java, etc. Rien n'y fait.

Code TestIT.java
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package projet.test.integration;
 
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.WebDriverWait;
 
public class TestIT {
	public static void main(String[] args) {
		WebDriver driver = new FirefoxDriver();
		driver.get("http://www.google.com");
		WebElement element = driver.findElement(By.name("q"));
		element.sendKeys("Cheese!");
		element.submit();
		System.out.println("Page title is: " + driver.getTitle());
		(new WebDriverWait(driver, 10)).until(new ExpectedCondition<Boolean>() {
            public Boolean apply(WebDriver d) {
                return d.getTitle().toLowerCase().startsWith("cheese!");
            }
        });
		System.out.println("Page title is: " + driver.getTitle());
		driver.quit();
	}
}
Pourtant, le test fonctionne bien si je le lance depuis Eclipse directement avec Run.

Résultat
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
Page title is: Google
Page title is: cheese! - Recherche Google
Comme si le plugin ne voyait pas mes tests.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
[INFO] [failsafe:integration-test {execution: integration-test}]
[INFO] Failsafe report directory: C:\workspace\cvtheque-3.0\cvtheque-web\target\failsafe-reports
 
-------------------------------------------------------
TESTS
-------------------------------------------------------
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
 
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
Une idée ?

Merci.