1
我用eclipse創建了用Java編寫的selenium/webdriver testng測試。 當我在eclipse中時,我已經選擇了測試用例.class,我可以運行它並打開一個瀏覽器並運行測試。 當我「mvn集成測試」它,一個空的瀏覽器打開並沒有發生。錯誤內容如下Maven測試(webdriver/testng)在不存在的文件夾中查找資源。我怎麼能告訴它在哪裏尋找它?
--- maven-resources-plugin:2.6:resources (default-resources) @ functionalTests ---
Using 'UTF-8' encoding to copy filtered resources.
skip non existing resourceDirectory c:\test2\functionalTests\src\main\resources
--- maven-compiler-plugin:2.5.1:compile (default-compile) @ functionalTests ---
Nothing to compile - all classes are up to date
--- maven-resources-plugin:2.6:testResources (default-testResources) @ functionalTests ---
Using 'UTF-8' encoding to copy filtered resources.
skip non existing resourceDirectory c:\test2\functionalTests\src\test\resources
我真的沒有這樣的文件夾。我使用我在互聯網上找到的一些原型生成了maven項目,並且用我的代替了他們的類。
這裏是我的文件夾結構:
src
-main
--java
---com
----pragmaticqa
-----tests
test
-java
--com
---pragmaticqa
----tests
and inside tests is where my test .class is located.
這是我的pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.pragmaticqa.tests</groupId>
<artifactId>functionalTests</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>functionalTests</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>2.32.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sf.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>2.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>selenium-maven-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<id>xvfb</id>
<phase>pre-integration-test</phase>
<goals>
<goal>xvfb</goal>
</goals>
</execution>
<execution>
<id>selenium</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start-server</goal>
</goals>
<configuration>
<background>true</background>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
所以我的問題是 - 我怎麼告訴行家在何處尋找要運行的測試?
應該是兩個星號之間的起點? test/java/com/pragmaticqa/tests/class.class? –
它應該是test.java.com.pragmaticqa.tests.class.java – Vinay
謝謝,請試試看,並告訴你發生了什麼事。 –