诱人的结果不会在Maven构建中产生 [英] Allure results don't generate on Maven build

查看:80
本文介绍了诱人的结果不会在Maven构建中产生的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Maven进行硒测试,最后希望生成一份魅力"报告.不幸的是,我收到一条错误消息.

I'm running a Selenium test with Maven and would like to have an Allure report generated in the end. Unfortunately, I get an error message.

Maven命令行:

clean -Dtest=TestLogs test allure:report

错误消息:

[INFO] --- allure-maven:2.9:report (default-cli) @ demo ---
[INFO] Allure installation directory C:\Users\Zoe\Documents\demo\selenium_tests\demo_selenium/.allure
[INFO] Try to finding out allure 2.3.1
[INFO] Generate Allure report (report) with version 2.3.1
[INFO] Generate Allure report to C:\Users\Zoe\Documents\demo\selenium_tests\demo_selenium\target\site/allure-maven-plugin 
[ERROR] Directory C:\Users\Zoe\Documents\demo\selenium_tests\demo_selenium\target\target\allure-results not found.
[WARNING] Allure report was skipped because there is no results directories found.

我的POM.xml:

<project
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
        xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<modelVersion>4.0.0</modelVersion>

<groupId>org.wesh.nc</groupId>
<artifactId>demo</artifactId>
<!--<packaging>pom</packaging>-->
<packaging>jar</packaging>
<version>1.0</version>

<properties>
    <allure.version>1.5.2</allure.version>
    <allure.maven.version>2.0</allure.maven.version>
</properties>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>2.20.1</version>
            <configuration>
                <skip>${skip.selenium.tests}</skip>
                <parallel>none</parallel>
                <threadCount>1</threadCount>
                <reuseForks>false</reuseForks>
                <disableXmlReport>false</disableXmlReport>
            </configuration>
            <executions>
                <execution>
                    <id>runSeleniumTests</id>
                    <phase>integration-test</phase>
                    <goals>
                        <goal>integration-test</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-maven</artifactId>
            <version>2.9</version>
            <configuration>
                <resultsDirectory>target\allure-results</resultsDirectory>
                <inputDirectories>target\allure-results</inputDirectories>
                <outputDirectory>target\allure-report</outputDirectory>
                <reportVersion>2.3.1</reportVersion>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>ru.yandex.qatools.allure</groupId>
            <artifactId>allure-maven-plugin</artifactId>
            <version>${allure.maven.version}</version>
            <configuration>
                <resultsPattern>target\allure-results</resultsPattern>
                <outputDirectory>target\target-report</outputDirectory>
            </configuration>

            <executions>
                <execution>
                    <goals>
                        <goal>report</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

<dependencies>
    <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-all</artifactId>
        <version>2.4.7</version>
    </dependency>
    <dependency>
        <groupId>org.gebish</groupId>
        <artifactId>geb-core</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>org.gebish</groupId>
        <artifactId>geb-spock</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>org.spockframework</groupId>
        <artifactId>spock-core</artifactId>
        <version>1.0-groovy-2.4</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-remote-driver</artifactId>
        <version>3.8.0</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-firefox-driver</artifactId>
        <version>3.8.0</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.8.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.5.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
        <version>2.0</version>
    </dependency>
    <dependency>
        <groupId>pl.pragmatists</groupId>
        <artifactId>JUnitParams</artifactId>
        <version>1.1.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.pdfbox</groupId>
        <artifactId>pdfbox</artifactId>
        <version>2.0.6</version>
    </dependency>
    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.6</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>ru.yandex.qatools.allure</groupId>
        <artifactId>allure-maven-plugin</artifactId>
        <version>${allure.maven.version}</version>
    </dependency>
    <dependency>
        <groupId>ru.yandex.qatools.allure</groupId>
        <artifactId>allure-junit-adaptor</artifactId>
        <version>${allure.version}</version>
    </dependency>
    <dependency>
        <groupId>ru.yandex.qatools.allure</groupId>
        <artifactId>allure-commons</artifactId>
        <version>${allure.version}</version>
    </dependency>
    <dependency>
        <groupId>ru.yandex.qatools.allure</groupId>
        <artifactId>allure-report-data</artifactId>
        <version>${allure.version}</version>
    </dependency>
    <dependency>
        <groupId>ru.yandex.qatools.allure</groupId>
        <artifactId>allure-java-adaptor-api</artifactId>
        <version>${allure.version}</version>
    </dependency>
    <dependency>
        <groupId>ru.yandex.qatools.allure</groupId>
        <artifactId>allure-model</artifactId>
        <version>${allure.version}</version>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.6</version>
    </dependency>
</dependencies>

<reporting>
    <excludeDefaults>true</excludeDefaults>
    <plugins>
        <plugin>
            <groupId>ru.yandex.qatools.allure</groupId>
            <artifactId>allure-maven-plugin</artifactId>
            <version>${allure.maven.version}</version>
            <configuration>
                <outputDirectory>target/allure-report</outputDirectory>
            </configuration>
        </plugin>
    </plugins>
</reporting>

我知道这个POM太乱了,为了使Allure正常工作,我一直在尝试一些事情...

I'm aware this POM is messy, I've been trying several things in order to make Allure work...

如果有人知道我能做什么来生成allure-results目录,请先谢谢.

If someone knows what I can do to generate the allure-results directory, thanks in advance.

推荐答案

您错过了Allure监听器& AspectJ配置.请按照文档页面上的说明进行操作: https://github.com/allure-framework/allure1/wiki/JUnit

You missed Allure listener & AspectJ configurations. Please follow the instructions from documentation page: https://github.com/allure-framework/allure1/wiki/JUnit

此外,您可以考虑升级到最新的Allure版本.可以在此处找到新版本的文档 https://docs.qameta.io/allure/#_junit_4

Also you can consider upgrading to latest Allure version. Docs for a new version can be found here https://docs.qameta.io/allure/#_junit_4

这篇关于诱人的结果不会在Maven构建中产生的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆