0

Всем привет!
Не первый день бьюсь с проблемой, надеялся решить силами уже заданных вопросов, но не получилось.. Состоит она в следующем: попытка подключить allure репорт в проект не увенчалась успехом. Я попробовал различные варианты написания pom.xml, но всё тщетно.

Всё делалось по образцу, но почти всегда ошибка была в том, что при попытке создать отчёт появлялось предупреждение, что его создать не получится, так как директория allure-results не найдена или Input directory should be not absolute for aggregate goal.

Вот мой pom.xml:

<?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">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.ponamorev.testproject</groupId>
    <artifactId>testproject</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <allure.version>2.0-BETA20</allure.version>
        <aspectj.version>1.8.10</aspectj.version>
        <junit.version>4.11</junit.version>
        <project.build.source>1.8</project.build.source>
    </properties>

    <dependencies>
        <dependency>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-junit4</artifactId>
            <version>${allure.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>junit</groupId>
                    <artifactId>junit</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.9.1</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
        </dependency>
        <dependency>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-java-commons</artifactId>
            <version>${allure.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.8.0-beta1</version>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.3.0</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.7.0</version>
                <configuration>
                    <target>${project.build.source}</target>
                    <source>${project.build.source}</source>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.20</version>
                <configuration>
                    <testFailureIgnore>false</testFailureIgnore>
                    <argLine>
                        -javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar
                    </argLine>
                    <systemProperties>
                        <property>
                            <name>allure.results.directory</name>
                            <value>${basedir}/target/allure-results</value>
                        </property>
                    </systemProperties>
                    <properties>
                        <property>
                            <name>listener</name>
                            <value>io.qameta.allure.junit4.AllureJunit4</value>
                        </property>
                    </properties>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.aspectj</groupId>
                        <artifactId>aspectjweaver</artifactId>
                        <version>${aspectj.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>io.qameta.allure</groupId>
                <artifactId>allure-maven</artifactId>
                <version>2.8</version>
                <configuration>
                    <propertiesFilePath>${basedir}/src/test/resources/allure.properties</propertiesFilePath>
                    <reportVersion>2.4.0</reportVersion>
                    <reportDirectory>${basedir}/target/allure-report</reportDirectory>
                    <resultsDirectory>${basedir}/target/allure-results</resultsDirectory>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <reporting>
        <excludeDefaults>true</excludeDefaults>
        <plugins>
            <plugin>
                <groupId>io.qameta.allure</groupId>
                <artifactId>allure-maven</artifactId>
                <version>2.8</version>
                <configuration>
                <propertiesFilePath>src/test/resources/allure.properties</propertiesFilePath>
                    <reportVersion>2.4.0</reportVersion>
                    <reportDirectory>${basedir}/target/allure-report</reportDirectory>
                    <resultsDirectory>${basedir}/target/allure-results</resultsDirectory>
                </configuration>
            </plugin>
        </plugins>
    </reporting>

</project>

Выполнение тестов происходит командой mvn clean test
Попытки создать отчёт через различные команды: mvn site, mvn allure:serve, mvn allure:report
Скажите, где накосячил, глаза уже замылились, наверное, не могу понять никак.

2 ответа 2

1

Мне помогло полное удаление секции configuration у плагина allure-maven.
Остался только путь в конфигурации surefire: ${project.build.directory}/allure-results

Проверьте, что в target/allure-results плагин surefire действительно кладет репорты после прогона тестов.

P.S. Запускаю из IDEA по clean test и allure:serve

0

у вас reportDirectory и reportDirectory однаковые. Нужно, чтобы один указывал на директорию конкретную, а второй содержал название папки

<plugin>         
   <groupId>ru.yandex.qatools.allure</groupId>
   <artifactId>allure-maven-plugin</artifactId>
   <configuration>
       <resultsDirectory>allure-results</resultsDirectory>
       <reportDirectory>${basedir}/target/</reportDirectory>
   </configuration>
</plugin>

а в репортинг можно оставить только

<reporting>
    <outputDirectory>${basedir}/target/allure-results</outputDirectory>
</reporting>
6
  • Благодарю за ответ) Да, теперь папка allure-results создается, но отчёт пустой. Пытался сделать отчет через mvn allure:serve, mvn allure:report и allure generate. Все варианты безуспешны. Не знаете, как это исправить? Может, где-то что-то не указано? 13 фев 2018 в 12:27
  • возможно, из-за того, что нет allure-report-builder в зависимостях 13 фев 2018 в 12:36
  • В allure 2 не нашёл такой зависимости.. 13 фев 2018 в 12:40
  • я не уверен. ссылка 13 фев 2018 в 12:43
  • Я поменял allure 2 на allure 1. Поставил allure-junit-adaptor версии 1.5.4, allure-report-builder версии 2.0. В секции <reporting> указал allure-maven-plugin версии 2.0. Для билдера и мавен плагина нет 1.5.4, там с 1.4.0 сразу на 2.0 идёт повышение версии. По-прежнему не создается папка allure-results :( 14 фев 2018 в 8:30

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.