2014-07-11 4 views
0

저는 메이븐에 익숙하지 않고 작동하는데 문제가 있습니다.확실한 테스트 보고서가 작동하지 않습니다.

웹에서 몇 가지 junit 테스트를 수행하기 위해 IntellijIDEA를 사용합니다 (셀레늄 웨비나 사용). 테스트가 올바르게 실행되었지만 확실하게 보고서를 생성 할 수 없습니다.

목표 또는 수명주기가 누락되었을 수 있지만 어떻게 작동하는지, 어디에 배치해야 하는지를 이해할 수 없습니다. 그것은 셀레늄 테스트를위한 템플릿을 사용하여

<?xml version="1.0" encoding="UTF-8"?> 

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

<groupId>com.lazerycode.selenium</groupId> 
<artifactId>maven-template</artifactId> 
<version>1.0-SNAPSHOT</version> 
<modelVersion>4.0.0</modelVersion> 

<name>Selenium Maven Template</name> 
<description>A Maven Template For Selenium</description> 
<url>http://www.lazerycode.com</url> 

<licenses> 
    <license> 
     <name>Apache 2</name> 
     <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> 
     <distribution>repo</distribution> 
     <comments>A business-friendly OSS license</comments> 
    </license> 
</licenses> 

<properties> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    <standalone.binary.root.folder>${project.basedir}/selenium_standalone_binaries</standalone.binary.root.folder> 
    <browser>firefox</browser> 
    <threads>1</threads> 
</properties> 

<dependencies> 
    <dependency> 
     <groupId>org.seleniumhq.selenium</groupId> 
     <artifactId>selenium-server</artifactId> 
     <version>2.41.0</version> 
     <scope>test</scope> 
     <exclusions> 
      <exclusion> 
       <groupId>com.opera</groupId> 
       <artifactId>operadriver</artifactId> 
      </exclusion> 
     </exclusions> 
    </dependency> 
    <dependency> 
     <groupId>com.opera</groupId> 
     <artifactId>operadriver</artifactId> 
     <version>1.5</version> 
     <scope>test</scope> 
     <exclusions> 
      <exclusion> 
       <groupId>org.seleniumhq.selenium</groupId> 
       <artifactId>selenium-remote-driver</artifactId> 
      </exclusion> 
     </exclusions> 
    </dependency> 
    <dependency> 
     <groupId>com.github.detro.ghostdriver</groupId> 
     <artifactId>phantomjsdriver</artifactId> 
     <version>1.1.0</version> 
     <scope>test</scope> 
     <exclusions> 
      <exclusion> 
       <groupId>org.seleniumhq.selenium</groupId> 
       <artifactId>selenium-remote-driver</artifactId> 
      </exclusion> 
     </exclusions> 
    </dependency> 
    <dependency> 
     <groupId>org.testng</groupId> 
     <artifactId>testng</artifactId> 
     <version>6.8</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>4.11</version> 
     <scope>test</scope> 
    </dependency> 
</dependencies> 

<build> 
    <resources> 
     <resource> 
      <directory>src/main/resources</directory> 
      <filtering>true</filtering> 
     </resource> 
    </resources> 
    <pluginManagement> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <configuration> 
        <source>1.6</source> 
        <target>1.6</target> 
       </configuration> 
       <version>2.3.2</version> 
      </plugin> 
     </plugins> 
    </pluginManagement> 
</build> 

<profiles> 
    <profile> 
     <id>selenium-tests</id> 
     <build> 
      <plugins> 
       <plugin> 
        <groupId>com.lazerycode.selenium</groupId> 
        <artifactId>driver-binary-downloader-maven-plugin</artifactId> 
        <version>1.0.3</version> 
        <configuration> 
         <rootStandaloneServerDirectory>${standalone.binary.root.folder}</rootStandaloneServerDirectory> 
         <downloadedZipFileDirectory>${project.basedir}/selenium_standalone_zips</downloadedZipFileDirectory> 
         <customRepositoryMap>${project.basedir}/RepositoryMap.xml</customRepositoryMap> 
        </configuration> 
        <executions> 
         <execution> 
          <goals> 
           <goal>selenium</goal> 
          </goals> 
         </execution> 
        </executions> 
       </plugin> 
       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-surefire-plugin</artifactId> 
        <version>2.7.2</version> 
        <dependencies> 
         <!-- Force using the latest JUnit 47 provider --> 
         <dependency> 
          <groupId>org.apache.maven.surefire</groupId> 
          <artifactId>surefire-junit47</artifactId> 
          <version>2.8</version> 
         </dependency> 
        </dependencies> 
        <configuration> 
         <includes> 
          <include>**/*/*/*/*.java</include> 
          <include>**/*/*/*.java</include> 
          <include>**/*/*.java</include> 
          <include>**/*.java</include> 
          <include>*.java</include> 

         </includes> 
         <parallel>methods</parallel> 
         <threadCount>${threads}</threadCount> 
        </configuration> 

       </plugin> 
      </plugins> 
     </build> 
    </profile> 
</profiles> 
<reporting> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-surefire-report-plugin</artifactId> 
      <version>2.17</version> 
     </plugin> 
    </plugins> 
</reporting> 

생성되었습니다 이 내 POM이다. 누군가 실종 된 것을 알고 있습니까?

답변

0

먼저 셀렌 사용을 기준으로 통합 테스트를 수행하므로 대신 maven-failsafe-plugin을 사용해야합니다. maven-surefire-plugin의 2.7.2 버전을 사용하고 있지만보고를 위해서는 maven-surefire-report-plugin 2.17을 사용하고 있습니다 ... 따라서 maven-surefire-plugin 및 maven-surefire-report-plugin에 동일한 버전을 사용해야합니다.

+0

감사합니다. 그래서 내가 무엇을해야하니? 내 확실한 것을 POM에 failsafe로 대체하고 다시 시도하십시오. 또는 일부 구성이 여전히 누락 되었습니까? – Jack

+0

failsafe 플러그인의 공식 페이지를 보았습니다. (또는 적어도 그렇게 생각합니다) 설치 한 다음 프로젝트 루트에서 mvn verify를 실행 해 보았습니다. 그것은 0/0 테스트가 exectued 밝혀 지 그것이 나에게 Junit을 사용하는 동안 NG 테스트를 실행하려고하는 것 같습니다. 물론 어쨌든 보고서가 없습니다. – Jack

+0

통합 테스트 스키마 대신 단위 테스트 스키마를 기반으로 테스트의 이름을 지정했습니다. 통합 테스트는'* IT.java'와 같은 이름이어야하고 유닛 테스트는'* Test.java'와 같은 이름이어야합니다. – khmarbaise

관련 문제