Перечитал вдоль и в поперек тред:
и смежные ему
Но увы, рабочего решения так и не нашел.
код:
TestListener.java:
import static ***.config.MainTest.driver;
@Log4j
public class TestListener implements ITestListener {
@Override
public void onTestFailure(ITestResult result) {
saveAllureScreenshot();
}
@Attachment(value = "Screenshooot", type = "image/png")
public static byte[] saveAllureScreenshot(String s) {
log.info("Screenshot!");
return ((TakesScreenshot) driver).getScreenshotAs(OutputType.BYTES);
}
...
}
}
есть тестовый класс:
@Test
public void test() { Assert.assertTrue(false);}
pom.xml:
<properties>
<allure.version>1.4.23</allure.version>
<aspectj.version>1.8.5</aspectj.version>
</properties>
<reporting>
<excludeDefaults>true</excludeDefaults>
<plugins>
<plugin>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-maven-plugin</artifactId>
<version>2.5</version>
</plugin>
</plugins>
</reporting>
<build>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
<plugins>
<!--replace environment.props to allure result folder-->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-allure-environment</id>
<phase>pre-site</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/allure-results</outputDirectory>
<resources>
<resource>
<directory>src/test/resources</directory>
<includes>
<include>environment.properties</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<!--generate maven.properties-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>write-project-properties</goal>
</goals>
<configuration>
<outputFile>${basedir}/src/test/resources/maven.properties</outputFile>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<!--clean up directroris/logs-->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<filesets>
<fileset>
<directory>${basedir}</directory>
<includes>
<include>bonial-service-ui-tests.log</include>
<!--<include>/target/surefire-reports/html/screenshots/*.html</include>-->
<!--<include>/target/surefire-reports/html/screenshots/*.png</include>-->
</includes>
<!--<excludes>-->
<!--<exclude>**/important.log</exclude>-->
<!--<exclude>**/another-important.log</exclude>-->
<!--</excludes>-->
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>
<!-- https://github.com/webdriverextensions/webdriverextensions-maven-plugin -->
<plugin>
<groupId>com.github.webdriverextensions</groupId>
<artifactId>webdriverextensions-maven-plugin</artifactId>
<version>1.1.0</version>
<executions>
<execution>
<goals>
<goal>install-drivers</goal>
</goals>
</execution>
</executions>
<configuration>
<installationDirectory>${project.basedir}/src/test/resources/drivers/</installationDirectory>
</configuration>
</plugin>
<!-- https://maven.apache.org/surefire/maven-surefire-plugin/examples/testng.html -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<argLine>-Dfile.encoding=UTF-8</argLine>
<!---Xms256m -Xmx512m -ea -->
<suiteXmlFiles>
<suiteXmlFile>${project.basedir}/src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
<systemPropertyVariables>
<!--<phantomjs.binary.path>${phantomjs.binary}</phantomjs.binary.path>-->
<!--<webdriver.chrome.driver>${path.chrome.mac}</webdriver.chrome.driver>-->
<!--<webdriver.ie.driver>${path.ie}</webdriver.ie.driver>-->
<!--<webdriver.firefox.bin>${path.ff}</webdriver.firefox.bin>-->
<!--<browser>${runner.browser}</browser>-->
</systemPropertyVariables>
<properties>
<property>
<name>usedefaultlisteners</name>
<value>false</value>
</property>
<property>
<name>listener</name>
<value>PATH_TO_CLASS(my.company.com).TestListener</value>
</property>
</properties>
<systemProperties>
<!-- Log4j settings -->
<property>
<name>log4j.configuration</name>
<value>log4j.properties</value>
</property>
<property>
<name>org.apache.commons.logging.Log</name>
<value>org.apache.commons.logging.impl.SimpleLog</value>
</property>
<property>
<name>org.apache.commons.logging.simplelog.log.org.apache.http</name>
<value>warn</value>
</property>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
<!-- FireFox profile -->
<profiles>
<profile>
<id>firefox</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<!--******* default params *************-->
<properties>
<env.url>http://TEST_URL.html</env.url>
<env.browser>firefox</env.browser>
</properties>
<!--******* default params *************-->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Xms256m -Xmx512m -ea -Dfile.encoding=UTF-8</argLine>
<suiteXmlFiles>
<suiteXmlFile>${project.basedir}/src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
<properties>
<property>
<name>usedefaultlisteners</name>
<value>true</value>
</property>
<!--needed for Jenkins variables -->
<param>${env.url}</param>
<param>${env.browser}</param>
</properties>
<systemProperties>
<!-- Log4j settings -->
<property>
<name>log4j.configuration</name>
<value>log4j.properties</value>
</property>
<property>
<name>org.apache.commons.logging.Log</name>
<value>org.apache.commons.logging.impl.SimpleLog</value>
</property>
<property>
<name>org.apache.commons.logging.simplelog.log.org.apache.http</name>
<value>warn</value>
</property>
<!-- ReportNG settings -->
<!-- http://reportng.uncommons.org/ -->
<!--<property>-->
<!--<name>org.uncommons.reportng.escape-output</name>-->
<!--<value>false</value>-->
<!--</property>-->
<!-- Selenide report files location -->
<!--<property>-->
<!--<name>selenide.reports</name>-->
<!--<value>-->
<!--<value>${project.build.directory}/surefire-reports/html/screenshots</value>-->
<!--</value>-->
<!--</property>-->
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
ранится это все через mvn clean install test site -Pfirefox.
Помогите плз разобраться…