2016-03-06 65 views
0

我一直在尋找,但還沒有找到答案。在終端或intellij中運行測試後,是否會自動打開報告index.html?我對這個東西很新。謝謝你的幫助。maven selenium寧靜bdd開放index.html測試後自動報告

設置

- http://www.thucydides.info/#/ -junit -selenium

謝謝你的任何未來的幫助。

這裏是我的pom.xml的副本

<properties> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    <junit.version>4.12</junit.version> 
    <serenity.version>1.0.47</serenity.version> 
    <serenity.maven.version>1.1.29-rc.1</serenity.maven.version> 
</properties> 
<dependencies> 
    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>${junit.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.seleniumhq.selenium</groupId> 
     <artifactId>selenium-java</artifactId> 
     <version>2.52.0</version> 
    </dependency> 
    <dependency> 
     <groupId>net.serenity-bdd</groupId> 
     <artifactId>core</artifactId> 
     <version>${serenity.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>net.serenity-bdd</groupId> 
     <artifactId>serenity-junit</artifactId> 
     <version>${serenity.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.slf4j</groupId> 
     <artifactId>slf4j-jdk14</artifactId> 
     <version>1.7.18</version> 
    </dependency> 
</dependencies> 

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-failsafe-plugin</artifactId> 
      <version>2.18.1</version> 
      <executions> 
       <execution> 
        <goals> 
         <goal>integration-test</goal> 
         <goal>verify</goal> 
        </goals> 
       </execution> 
      </executions> 
      <configuration> 
       <includes> 
        <include>**/*Test.java</include> 
        <include>**/When*.java</include> 
       </includes> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-surefire-plugin</artifactId> 
      <version>2.18.1</version> 
      <configuration> 
       <skip>true</skip> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>3.3</version> 

     </plugin> 
     <plugin> 
      <groupId>net.serenity-bdd.maven.plugins</groupId> 
      <artifactId>serenity-maven-plugin</artifactId> 
      <version>${serenity.maven.version}</version> 
      <dependencies> 
       <dependency> 
        <groupId>com.google.inject</groupId> 
        <artifactId>guice</artifactId> 
        <version>3.0</version> 
        <scope>compile</scope> 
       </dependency> 
      </dependencies> 
      <executions> 
       <execution> 
        <id>serenity-reports</id> 
        <phase>post-integration-test</phase> 
        <goals> 
         <goal>aggregate</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 
     <plugin> 
      <artifactId>maven-clean-plugin</artifactId> 
      <version>2.5</version> 
      <executions> 
       <execution> 
        <id>auto-clean</id> 
        <phase>initialize</phase> 
        <goals> 
         <goal>clean</goal> 
        </goals> 
        <configuration> 
         <filesets> 
          <fileset> 
           <directory>/target/site/serenity</directory> 
          </fileset> 
         </filesets> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 
    </plugins> 
</build> 

<reporting> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-project-info-reports-plugin</artifactId> 
      <version>2.8</version> 
      <reportSets> 
       <reportSet> 
        <reports> 
         <report>index</report> 
         <report>summary</report> 
        </reports> 
       </reportSet> 
      </reportSets> 
     </plugin> 
    </plugins> 
</reporting> 

回答

0

有關將如何:

@AfterClass 

直接向您的亞軍類,並添加方法有:

getDriver().get("YourReportPath")