如何在eclipse中生成诱惑力测试报告

how to generate allure test report in eclipse

我使用 "selenide"、"testng"、"maven"、"eclipse" 创建了一些自动化脚本。 我试图添加诱惑测试结果。我按照 allure-testng-maven 说明更新了 pom.xml.

对于来自 Eclipse 的 运行 测试,我正在右键单击 pom.xml + "run as" +“Maven 测试”。这正在执行所有 testng 测试并在“./target/allure-results”文件夹中生成 allure xml 文件。

我的疑惑是如何从eclipse中看到allure报告。

下面是我的 pom.xml 文件。

 <!-- language: lang-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>xxxxxxxxxxxxxxxxxxx</groupId>
<artifactId>xxxxxxxxxxxxxxx</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>servicenow</name>
<url>http://maven.apache.org</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<allure.version>1.5.0.RC2</allure.version>
<aspectj.version>1.8.9</aspectj.version>
</properties>

<dependencies>
<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>3.8.1</version>
  <scope>test</scope>
</dependency>


<dependency>
 <groupId>org.seleniumhq.selenium</groupId>
 <artifactId>selenium-java</artifactId>
 <version>2.53.1</version>
 <scope>test</scope>            
</dependency>
<dependency>
 <groupId>org.seleniumhq.selenium</groupId>
 <artifactId>selenium-server</artifactId>
 <version>2.53.1</version>
 <scope>test</scope>            
</dependency>
<dependency>
 <groupId>org.seleniumhq.selenium</groupId>
 <artifactId>selenium-remote-driver</artifactId>
 <version>2.53.1</version>
 <scope>test</scope>            
</dependency>
<dependency>
 <groupId>org.seleniumhq.selenium</groupId>
 <artifactId>selenium-firefox-driver</artifactId>
 <version>2.53.1</version>
 <scope>test</scope>    
</dependency>  
<dependency>
 <groupId>org.seleniumhq.selenium</groupId>
 <artifactId>selenium-chrome-driver</artifactId>
 <version>2.53.1</version>
 <scope>test</scope>    
</dependency>

<dependency>                
 <groupId>org.testng</groupId>                              
 <artifactId>testng</artifactId>                                
 <version>6.9.10</version>                              
 <scope>test</scope>                                        
</dependency>

<dependency>
 <groupId>com.codeborne</groupId>
 <artifactId>selenide</artifactId>
 <version>3.9.1</version>
 <scope>test</scope>
</dependency>

<dependency>
 <groupId>ru.yandex.qatools.allure</groupId>
 <artifactId>allure-testng-adaptor</artifactId>
 <version>${allure.version}</version>
 <exclusions>
    <exclusion>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
    </exclusion>
 </exclusions>
 </dependency>

 <dependency>
    <groupId>com.codeborne</groupId>
    <artifactId>phantomjsdriver</artifactId>
    <version>1.2.1</version>
</dependency>

 <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest-all</artifactId>
        <version>1.3</version>
  </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.19.1</version>
            <configuration>
                <testFailureIgnore>true</testFailureIgnore>
                <argLine>
                    -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
                </argLine>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.aspectj</groupId>
                    <artifactId>aspectjweaver</artifactId>
                    <version>${aspectj.version}</version>
                </dependency>
            </dependencies>
        </plugin>

        <!--Needed only to show reports locally. Run jetty:run and
        open localhost:8080 to show the report-->
        <plugin>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>9.4.0.M1</version>
            <configuration>
                    <webAppSourceDirectory>${project.build.directory}/site/allure-maven-plugin</webAppSourceDirectory>
                <stopKey>stop</stopKey>
                <stopPort>1234</stopPort>
            </configuration>
        </plugin>
    </plugins>
</build>

<reporting>
    <excludeDefaults>true</excludeDefaults>
    <plugins>
        <plugin>
            <groupId>ru.yandex.qatools.allure</groupId>
            <artifactId>allure-maven-plugin</artifactId>
            <version>2.5</version>
        </plugin>
    </plugins>
</reporting>

</project>

感谢任何帮助。 谢谢!

您必须 运行 maven 目标 'site' 才能生成报告。只需右键单击您的项目 -> 运行 as -> Maven build... 然后键入 'site' 作为目标和 运行。或者,您可以键入目标 'clean test site',它会执行所有测试,然后在一个 maven 运行 中生成报告。默认情况下,报告应位于 target/site 下。