0

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

对于从 Eclipse 运行测试,我正在对 pom.xml +“运行方式”+“Maven 测试”进行右键单击。这是在“./target/allure-results”文件夹中执行所有 testng 测试并生成 allure xml 文件。

我的疑问是如何查看 eclipse 的魅力报告。

下面是我的 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>

任何帮助表示赞赏。谢谢!

4

1 回答 1

1

您必须运行 Maven 目标“站点”才能生成报告。只需右键单击您的项目-> 运行方式-> Maven 构建...然后键入“站点”作为目标并运行。或者,您可以键入目标“清洁测试站点”,它会执行所有测试,然后在一次 maven 运行中生成报告。默认情况下,报告应位于目标/站点下。

于 2016-09-02T09:03:15.460 回答