Làm thế nào mà Maven bỏ qua tất cả các bài kiểm tra của tôi theo mặc định? Tôi có một pom.xml
với một vài tiểu sử và tôi không thể chạy các bài kiểm tra của mình thông qua cả hai. Một trong hồ sơ của tôi trông giống nhưMaven tự động bỏ qua các bài kiểm tra
<profile>
<id>jsf-test</id>
<dependencies>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-arquillian-container-remote</artifactId>
<version>${jboss.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jsf.tests</groupId>
<artifactId>jsf-app</artifactId>
<version>${jsf-app.version}</version>
<type>war</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-jsf-app</id>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.jsf.tests</groupId>
<artifactId>jsf-app</artifactId>
<version>${jsf-app.version}</version>
<type>war</type>
<destFileName>jsfapp.war</destFileName>
<outputDirectory>target</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire.version}</version>
<configuration>
<skipTests>false</skipTests> <!-- desperate trial -->
<properties>
<property>
<name>listener</name>
<value>${testng.listeners}</value>
</property>
</properties>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Nếu tôi chạy mvn verify -Pjsf-test
sau đó dự án được biên dịch, jsf-app
vật được sao chép một cách chính xác vào mục tiêu và kiểm tra được bỏ qua. mvn verify -Dtest=TestCalculator
có cùng kết quả. Tôi đang sử dụng Arquillian
và TestNG
để thực hiện các thử nghiệm thực tế nhưng tôi không chắc liệu nó có quan trọng đối với câu hỏi này hay không.
EDIT
Chạy trong debug sẽ cung cấp (phần liên quan)
[DEBUG] (s) reportFormat = brief
[DEBUG] (s) reportsDirectory = /home/pmensik/Work/workspace/epp-test/cdi-arquillian- test/target/surefire-reports
[DEBUG] (f) reuseForks = true
[DEBUG] (s) runOrder = filesystem
[DEBUG] (s) skip = true
[DEBUG] (s) skipTests = false
[DEBUG] (s) systemPropertyVariables = {jsfPortlet=true}
[DEBUG] (s) testClassesDirectory = /home/pmensik/Work/workspace/epp-test/cdi-arquillian-test/target/test-classes
[DEBUG] (s) testFailureIgnore = false
[DEBUG] (s) testNGArtifactName = org.testng:testng
[DEBUG] (s) testSourceDirectory = /home/pmensik/Work/workspace/epp-test /cdi-arquillian-test/src/test/java
[DEBUG] (s) trimStackTrace = true
[DEBUG] (s) useFile = true
[DEBUG] (s) useManifestOnlyJar = true
[DEBUG] (s) useSystemClassLoader = true
[DEBUG] (s) useUnlimitedThreads = false
[DEBUG] (s) workingDirectory = /home/pmensik/Work/workspace/epp-test/cdi-arquillian-test
[DEBUG] (s) project = MavenProject: org.jboss.gatein.test:cdi-portlet-test:6.1-ER01 @ /home/pmensik/Work/workspace/epp-test/cdi-arquillian-test/pom.xml
[DEBUG] (s) session = [email protected]
[DEBUG] -- end configuration --
[INFO] Tests are skipped.
thử nghiệm đơn giản của tôi trông như thế này
public class Test {
@Drone
protected WebDriver driver;
@Deployment(testable = false)
public static WebArchive createTestArchive() {
return ShrinkWrap.createFromZipFile(WebArchive.class, new File("target/CDIPortlet.war"));
}
@Test
public void testCase{
//...
}
}
Bạn có chắc chắn bạn không chạy với '-DskipTests' bằng cách nào đó không? 'Mvn clean verify' hoặc' mvn clean install' làm gì? – vikingsteve
Thử chạy với '-X' để gỡ lỗi đầu ra, sau đó xem cấu hình của plugin chắc chắn. Tôi cũng sẽ nghi ngờ một vấn đề thừa kế plugin. Plugin chắc chắn có được định cấu hình trong POM mẹ không? – user944849
và các bài kiểm tra của bạn được xác định ở đâu? –