1

Eclipse を使用して、Java で記述された selenium/webdriver testng テストを作成しました。私が日食にいて、現在テストケース.classを選択しているとき、それを実行でき、ブラウザが開き、テストが実行されます。「mvn integration-test」すると、空のブラウザーが開かれ、何も起こりません。エラーは次のようになります

 --- 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>

だから私の質問は - 実行するテストを探す場所をmavenに伝えるにはどうすればよいですか?

4

1 に答える 1

1

以下に示すような確実なプラグインを追加します。テストクラス名を指定する代わりに

<plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <version>2.5</version>
        <configuration>
               <includes>
                  <include>**/*IntegrationTest.java</include>
               </includes>
        </configuration>
</plugin>
于 2013-07-23T09:59:32.783 に答える