MrDSLow
(Mr Ds Low)
23.Июнь.2017 13:07:27
#1
UPD:
Аллюр запущен, в процессе настройки прикрепления Attachment.
EDIT:
Курс темы поменялся. На д.м. настройка POM и вывод результатов.
OLD:
Собственно, не знаю достаточно ли двух дней мучений чтобы обращаться за помощью, но пока что у меня маловато идей по поводу самого Allure, не говоря уже про переделки проекта под то, что мне нужно.
Встречаются множественные ошибки такого рода по проекту:
[ERROR] /D:/Projects/Selection.MapElements/allure-java-adaptor-api/src/test/java/ru/yandex/qatools/allure/events/StepEventTest.java:[3,17] package org.junit does not exist
[ERROR] /D:/Projects/Selection.MapElements/allure-java-adaptor-api/src/test/java/ru/yandex/qatools/allure/events/StepEventTest.java:[4,17] package org.junit does not exist
JUnit я не пользуюсь, но классы прописаны им. Я не уверен, что мне вообще нужны эти модули (allure-testng-adaptor, allure-java-annotations, allure-model).
Но я так и не понял как правильно вставить Allure2 в проект, если там используется TestNG. Поэтому пользовался той информацией, которая понятнее и известна.
Тут уж я не уверен, что может понадобится в качестве забора информации.
Parent POM:
<?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>selenium</groupId>
<artifactId>P-MTests</artifactId>
<version>1.0-SNAPSHOT</version>
<repositories>
<repository>
<id>jcenter</id>
<name>bintray</name>
<url>http://jcenter.bintray.com</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-java-annotations</artifactId>
<version>RELEASE</version>
</dependency>
</dependencies>
<!--<dependencies>-->
<!--<dependency>-->
<!--<groupId>selenium</groupId>-->
<!--<artifactId>allure-java-annotations</artifactId>-->
<!--<version>1.5.4</version>-->
<!--</dependency>-->
<!--</dependencies>-->
<!--<dependencies>-->
<!--<dependency>-->
<!--<groupId>selenium</groupId>-->
<!--<artifactId>allure-java-annotations</artifactId>-->
<!--<version>1.5.4</version>-->
<!--</dependency>-->
<!--</dependencies>-->
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<allure.version>2.1.1</allure.version>
<aspectj.version>1.8.10</aspectj.version>
</properties>
<packaging>pom</packaging>
<modules>
<module>allure-testng-adaptor</module>
<module>allure-java-annotations</module>
<module>allure-java-adaptor-api</module>
<module>allure-model</module>
<!--<module>allure-commons</module>-->
<!--<module>allure-java-aspects</module>-->
<!--<module>allure-report-plugin-api</module>-->
<!--<module>allure-report-data</module>-->
<!--<module>allure-report-face</module>-->
<!--<module>allure-bundle</module>-->
<!--<module>allure-commandline</module>-->
<!--<module>allure-report-preview</module>-->
</modules>
<issueManagement>
<system>GitHub Issues</system>
<url>https://github.com/Qloriti/Automation/issues</url>
</issueManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<inherited>true</inherited>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
</argLine>
<properties>
<property>
<name>listener</name>
<value>ru.yandex.qatools.allure.testng.AllureRunListener</value>
</property>
</properties>
<suiteXmlFiles>
<suiteXmlFile>../testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.11</version>
<scope>compile</scope>
</dependency>
<!--<dependency>-->
<!--<groupId>ru.yandex.qatools.allure</groupId>-->
<!--<artifactId>allure-bundle</artifactId>-->
<!--<version>${project.version}</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>ru.yandex.qatools.allure</groupId>-->
<!--<artifactId>allure-model</artifactId>-->
<!--<version>${project.version}</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>ru.yandex.qatools.allure</groupId>-->
<!--<artifactId>allure-commons</artifactId>-->
<!--<version>${project.version}</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>ru.yandex.qatools.allure</groupId>-->
<!--<artifactId>allure-java-annotations</artifactId>-->
<!--<version>${project.version}</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>ru.yandex.qatools.allure</groupId>-->
<!--<artifactId>allure-java-adaptor-api</artifactId>-->
<!--<version>${project.version}</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>ru.yandex.qatools.allure</groupId>-->
<!--<artifactId>allure-java-aspects</artifactId>-->
<!--<version>${project.version}</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>ru.yandex.qatools.allure</groupId>-->
<!--<artifactId>allure-testng-adaptor</artifactId>-->
<!--<version>${project.version}</version>-->
<!--</dependency>-->
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-testng</artifactId>
<version>2.0-BETA8</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-report-plugin-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-report-data</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-commandline</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-report-face</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
</dependencies>
</dependencyManagement>
<reporting>
<excludeDefaults>true</excludeDefaults>
<plugins>
<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<version>2.8</version>
</plugin>
</plugins>
</reporting>
</project>
Если нужны конкретные вопросы, то:
1) Как-то переформатировать Junit в TestNG для меня?
2) Я делаю чушь и кто-то можешь написать как должно быть правильно.
MrDSLow
(Mr Ds Low)
23.Июнь.2017 13:15:09
#3
Да, и в т.ч. изучал пример проекта на TestNG. Как и другой Allure1 и Allure2.
BabyRoot
(Vasily)
23.Июнь.2017 13:18:19
#4
Приведите ваш пом-файл в соответствие с той информацией что я дал по ссылке.
MrDSLow
(Mr Ds Low)
23.Июнь.2017 13:38:58
#5
Ну, mvn билдится. Только это не дает каких-то результатов.
Впринципе можно сказать, что я пришел к тому, с чего начинал.
Taras
(Taras)
25.Июнь.2017 15:28:50
#6
<!-- reporting allure 3rd party adapter for testng -->
<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>
MrDSLow
(Mr Ds Low)
26.Июнь.2017 08:56:55
#7
Пока pom выглядит так. Не могу с точностью сказать в чем разница с allure-testng и allure-testng-adaptor (вероятно последний взаимодействует с модулем).
Pom редактировал с документацией по настройке Allure Framework .
Сразу чтобы прояснить. Билдил разные варианты с комментированием лишнего в POM в т.ч.
<?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>selenium</groupId>
<artifactId>P-MTests</artifactId>
<version>1.0-SNAPSHOT</version>
<repositories>
<repository>
<id>jcenter</id>
<name>bintray</name>
<url>http://jcenter.bintray.com</url>
</repository>
</repositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<allure.version>2.1.1</allure.version>
<aspectj.version>1.8.10</aspectj.version>
<compiler.plugin.version>3.6.0</compiler.plugin.version>
<allure.results.directory>
${project.build.directory}/allure-results
</allure.results.directory>
</properties>
<packaging>pom</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler.plugin.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<inherited>true</inherited>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<argLine>
-javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar
</argLine>
<properties>
<property>
<name>listener</name>
<value>ru.yandex.qatools.allure.testng.AllureTestListener</value>
</property>
<property>
<name>usedefaultlisteners</name>
<value>false</value>
</property>
</properties>
<systemProperties>
<property>
<name>allure.results.directory</name>
<value>${allure.results.directory}</value>
</property>
<property>
<name>allure.link.issue.pattern</name>
<value>${issues.tracker}</value>
</property>
<property>
<name>allure.link.tms.pattern</name>
<value>${tms}</value>
</property>
</systemProperties>
<suiteXmlFiles>
<suiteXmlFile>../testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-testng</artifactId>
<version>2.0-BETA10</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.11</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-testng-adaptor</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-testng</artifactId>
<version>2.0-BETA10</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-attachments</artifactId>
<version>2.0-BETA10</version>
</dependency>
</dependencies>
</dependencyManagement>
<reporting>
<excludeDefaults>true</excludeDefaults>
<plugins>
<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<version>2.8</version>
<configuration>
<reportDirectory>allure-report</reportDirectory>
</configuration>
</plugin>
</plugins>
</reporting>
</project>
По итогу: Билд в mvn билдится. Через TestNG тоже.
Но $ allure serve target/allure-results не приносит успеха, из-за, что очевидно, clean test’а, удаляющего target. Но и в target нет результатов по allure.
Еще рекомендации?
EDIT:
Запустил “на попробовать” “чистый” Pom с allure1.0. Почти то же самое. Рез-тов по allure нет.
CrispusDH
(Oleksii Ihnatiuk)
26.Июнь.2017 08:59:48
#8
Сорри за оффтоп, рекомендую поставить градл
MrDSLow
(Mr Ds Low)
26.Июнь.2017 14:09:17
#11
Апдейт инфы если кто-то следит за моими успехами (нет).
По ходу дела обновил Maven.
Пробовал 2 разных POM’а:
<properties>
<aspectj.version>1.8.10</aspectj.version>
<allure.version>{latest-allure-version}</allure.version>
</properties>
<dependencies>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-testng-adaptor</artifactId>
<version>1.5.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<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>
<!--only for 1.3.* TestNG adapters. Since 1.4.0.RC4, the listener adds via ServiceLoader-->
<properties>
<property>
<name>listener</name>
<value>ru.yandex.qatools.allure.testng.AllureTestListener</value>
</property>
</properties>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<!--<repositories>-->
<!--<repository>-->
<!--<id>jcenter</id>-->
<!--<name>bintray</name>-->
<!--<url>http://jcenter.bintray.com</url>-->
<!--</repository>-->
<!--</repositories>-->
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<allure.version>2.1.1</allure.version>
<aspectj.version>1.8.10</aspectj.version>
<compiler.plugin.version>3.6.1</compiler.plugin.version>
<allure.results.directory>
${project.build.directory}/allure-results
</allure.results.directory>
</properties>
<!--<packaging>pom</packaging>-->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<inherited>true</inherited>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<argLine>
-javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar
</argLine>
<properties>
<property>
<name>listener</name>
<value>ru.yandex.qatools.allure.testng.AllureTestListener</value>
</property>
<property>
<name>usedefaultlisteners</name>
<value>false</value>
</property>
</properties>
<systemProperties>
<property>
<name>allure.results.directory</name>
<value>${allure.results.directory}</value>
</property>
<property>
<name>allure.link.issue.pattern</name>
<value>${issues.tracker}</value>
</property>
<property>
<name>allure.link.tms.pattern</name>
<value>${tms}</value>
</property>
</systemProperties>
<suiteXmlFiles>
<suiteXmlFile>../testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.4.0</version>
</dependency>
<!--<dependency>-->
<!--<groupId>org.seleniumhq.selenium</groupId>-->
<!--<artifactId>selenium-firefox-driver</artifactId>-->
<!--<version>3.4.0</version>-->
<!--</dependency>-->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>2.30</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.11</version>
<!--<scope>compile</scope>-->
</dependency>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-testng-adaptor</artifactId>
<version>1.5.4</version>
</dependency>
<!--<dependency>-->
<!--<groupId>io.qameta.allure</groupId>-->
<!--<artifactId>allure-testng</artifactId>-->
<!--<version>2.0-BETA10</version>-->
<!--<!–<scope>compile</scope>–>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>io.qameta.allure</groupId>-->
<!--<artifactId>allure-attachments</artifactId>-->
<!--<version>2.0-BETA10</version>-->
<!--</dependency>-->
</dependencies>
</dependencyManagement>
<reporting>
<excludeDefaults>true</excludeDefaults>
<plugins>
<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<version>2.8</version>
<configuration>
<reportDirectory>allure-report</reportDirectory>
</configuration>
</plugin>
</plugins>
</reporting>
Один тот же характер ошибки(-ок):
[ERROR] /D:/Projects/Selection.MapElements/src/test/java/listeners/ListenerTest.java:[6,18] package org.testng does not exist
[ERROR] /D:/Projects/Selection.MapElements/src/test/java/listeners/ListenerTest.java:[10,32] package org.apache.logging.log4j does not exist
[ERROR] /D:/Projects/Selection.MapElements/src/test/java/listeners/ListenerTest.java:[11,32] package org.apache.logging.log4j does not exist
[ERROR] /D:/Projects/Selection.MapElements/src/test/java/listeners/ListenerTest.java:[17,38] cannot find symbol
symbol: class ITestListener
[ERROR] /D:/Projects/Selection.MapElements/src/test/java/listeners/ListenerTest.java:[18,5] cannot find symbol
symbol: class WebDriver
location: class listeners.ListenerTest
По тому, что я понял, довольно распространенная. В процессе решения.
EDIT:
кароче слетели библиотеки и зависимости.
Часть восстановил, с другой частью пока тупик. Вообще с библиотеками у меня есть проблема. Не знаю как правильно их нужно организовывать, постоянно каша получается.
Быть может мой случай не подходит к вашей проблеме, но у меня файервол блочил батник allure, а maven surefire plugin - запускал изолировано. Поэтому все папки allure были пустые, хотя я создал pom.xml согласно документации. Поэтому советую отключить антивирус и файервол хотя быта на время билда (прогона тестов) и генерации отчета.
MrDSLow
(Mr Ds Low)
24.Июль.2017 15:00:14
#13
Не хотелось создавать новую тему, но.
В общем недавно предоставился случай вернуться к этой задаче. Allure выводит результаты, присоединил к Jenkins. С Мавен вроде бы тоже работает (все таки Jenkins завязан на mvn’е).
С Attachment застрял наглухо. Достаточно много материал изучил, и либо я не увидел, либо еще что-то, но не нашел четкой формализации проекта. А именно в какой части проекта что должно быть.
Перво-наперво Pom (если у кого-то есть время в нем копаться).:
<?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>SMTP</groupId>
<artifactId>Smoke_testing</artifactId>
<version>1.0-SNAPSHOT</version>
<repositories>
<repository>
<id>jcenter</id>
<name>bintray</name>
<url>http://jcenter.bintray.com</url>
</repository>
</repositories>
<properties>
<java.version>1.8</java.version>
<allure.version>2.2.1</allure.version>
<aspectj.version>1.8.10</aspectj.version>
<compiler.plugin.version>3.6.1</compiler.plugin.version>
<allure.results.directory>
${project.build.directory}/target/allure-results
</allure.results.directory>
</properties>
<!--<packaging>pom</packaging>-->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler.plugin.version}</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<inherited>true</inherited>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
<testFailureIgnore>true</testFailureIgnore>
<argLine>
-javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar
</argLine>
<properties>
<!--<property>-->
<!--<name>listener</name>-->
<!--<value>ru.yandex.qatools.allure.testng.AllureTestListener</value>-->
<!--</property>-->
<property>
<name>usedefaultlisteners</name>
<value>false</value>
</property>
</properties>
<systemProperties>
<property>
<name>allure.results.directory</name>
<value>${allure.results.directory}</value>
</property>
</systemProperties>
</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>
<reportDirectory>${basedir}\target\allure-report</reportDirectory>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-support</artifactId>
<version>3.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.8.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.25</version>
<scope>compile</scope>
</dependency>
<!--<dependency>-->
<!--<groupId>org.apache.logging.log4j</groupId>-->
<!--<artifactId>log4j-core</artifactId>-->
<!--<version>2.8.2</version>-->
<!--</dependency>-->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.4.0</version>
</dependency>
<!--<dependency>-->
<!--<groupId>org.seleniumhq.selenium</groupId>-->
<!--<artifactId>selenium-firefox-driver</artifactId>-->
<!--<version>3.4.0</version>-->
<!--</dependency>-->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.11</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>22.0</version>
</dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>1.7.0</version>
</dependency>
<dependency>
<groupId>net.sourceforge.jexcelapi</groupId>
<artifactId>jxl</artifactId>
<version>2.6.12</version>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-testng</artifactId>
<version>2.0-BETA15</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-attachments</artifactId>
<version>2.0-BETA15</version>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-assertj</artifactId>
<version>2.0-BETA15</version>
<!--<type>pom</type>-->
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-api</artifactId>
<version>2.43.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
<reporting>
<excludeDefaults>true</excludeDefaults>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.9</version>
</plugin>
<plugin>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-maven-plugin</artifactId>
<version>2.6</version>
<configuration>
<reportDirectory>${basedir}/target/allure-report</reportDirectory>
</configuration>
</plugin>
</plugins>
</reporting>
</project>
На данный момент я пробовал разные варианты и комбинации. Вероятно (100% так и есть) я чего-то не понимаю.
В Listener.class есть @Attachment :
@Attachment(value = "{0}", type = "image/png")
public byte[] saveScreenshot(String name) {
return ((TakesScreenshot) driver).getScreenshotAs(OutputType.BYTES);
}
В том же Listener.class есть вызов этого метода.
public void onTestFailure(ITestResult arg0) {
// This is calling the printTestResults method
saveScreenshot("Failure");
printTestResults(arg0);
}
А также привязка “Main.class” класса запуска кейсов (здесь подключен модуль на авторизацию).
@Listeners (listeners.Listener.class)
Надеюсь тема бампнется вверх и кто-то скажет что я делаю не так в этом банальном вопросе.
И надеюсь (желательно) если это будет что-то большее, чем “У тебя неправильно написан метод”, потому что, опять же, здесь я дилетант.
Дополнительно:
Я не могу проверить сам, поскольку у меня даже эта банальнища не работает, но в чем отличие от “абстрактного” создания скриншотов, по типу того, что я написал выше и вывода через File? Возможность задать маску вывода имени файла? И возможно ли прикрепить этот файл в отчет?
BabyRoot
(Vasily)
24.Июль.2017 15:06:18
#14
Ваш листенер implements IResultListener2 (org.testng.internal.IResultListener2) ?
MrDSLow
(Mr Ds Low)
24.Июль.2017 15:08:51
#15
У меня есть сомнения в правильности понимания вопроса, но
public class Listener implements ITestListener, ISuiteListener, IInvokedMethodListener
другого Listener’а нет.
BabyRoot
(Vasily)
24.Июль.2017 15:12:05
#16
Добавьте тот что я указал к тем что у вас есть.
Еще как вариант - удалить то что у вас там указано и оставить только то что я написал. Не понимаю, зачем у вас там так много всего указано.
MrDSLow
(Mr Ds Low)
24.Июль.2017 15:45:06
#17
Спасибо. Ни за что не дошел бы до того, что решение лежит в таком месте.
Запустилось без ошибок. Но скриншот не выходит (на testfailure и testsuccess).
Вероятно методы написаны/применены неверно. Завтра этим займусь.
Еще такой односложный вопрос:
Результаты складываются в {basedir}/allure-results, хотя везде в POM указана директория в target (при сборке через IDE). Путь возможно указать только в самом методе скриншота?
eroshenkoam
(Artem Eroshenko)
24.Июль.2017 17:08:00
#18
@MrDSLow , это происходит из-за того, что IDEA не подхватывает настройки
Мы начали работу над плагином для IDEA.
Он будет помогать в следующем:
Конфигурация проекта (какие зависимости нужны в проекте).
Управление аннотациями (подствека синтаксиса степов, аттачей и прочего)
Полный принт сценария выполнения тестов (включая степы и прочее) в идее.
Думаю первая версия появится через пару недель.
Сейчас можно выставить системную проперти для каждого теста:
-Dallure.results.directory=target/allure-resutls в настройках idea.
eroshenkoam
(Artem Eroshenko)
24.Июль.2017 17:13:05
#19
@MrDSLow , с виду все с аттачами нормально.
Что именно не выходит со скриншотом? Он не добавляется в Allure? Или какие-то другие проблемы?
MrDSLow
(Mr Ds Low)
24.Июль.2017 17:29:07
#20
Да. На скриншоте выше я скинул содержимое папки.
Как я и сказал, завтра продолжу попытки.
Если что, могу скинуть в github проект.