0
我將使用傾城報告來監控Selenium測試結果。我使用TestNG和Maven failsafe插件來運行測試。我發現了非常清晰的示例,如何修改pom.xml,以便在使用Maven surefire插件的情況下包含Allure,但對於Maven failsafe插件沒有任何作用。我假設配置應該非常相似,但它不適合我。下面是我在我的pom.xml:傾城報告+ TestNG + Maven故障安全插件集成
<?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>vital.com</groupId>
<artifactId>vital_framework</artifactId>
<version>0.0.1</version>
<name>Vital framework</name>
<description>My first own framework</description>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>com.mailosaur</groupId>
<artifactId>mailosaur-java</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-testng-adaptor</artifactId>
<version>${allure.version}</version>
</dependency>
<!-- <dependency> <groupId>com.codeborne</groupId> <artifactId>phantomjsdriver</artifactId>
<version>1.2.1</version> </dependency> -->
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- Dependency versions -->
<selenium.version>LATEST</selenium.version>
<!-- Configurable variables -->
<threads>2</threads>
<browser>firefox</browser>
<overwrite.binaries>false</overwrite.binaries>
<!-- Acceptable values: dev, test, uat, prod -->
<environment>test</environment>
<aspectj.version>1.7.4</aspectj.version>
<allure.version>{latest-allure-version}</allure.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
<argLine>
-javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar
</argLine>
<parallel>methods</parallel>
<parallel>true</parallel>
<threadCount>${threads}</threadCount>
<systemPropertyVariables>
<browser>${browser}</browser>
<environment>${environment}</environment>
<screenshotDirectory>${project.build.directory}/screenshots</screenshotDirectory>
<!--Set properties passed in by the driver binary downloader -->
<phantomjs.binary.path>${phantomjs.binary.path}</phantomjs.binary.path>
<webdriver.chrome.driver>${webdriver.chrome.driver}</webdriver.chrome.driver>
<webdriver.ie.driver>${webdriver.ie.driver}</webdriver.ie.driver>
<webdriver.opera.driver>${webdriver.opera.driver}</webdriver.opera.driver>
<webdriver.gecko.driver>${webdriver.gecko.driver}</webdriver.gecko.driver>
</systemPropertyVariables>
<includes>
<!-- <include>**/*WD.java</include> -->
<include>**/*WD.java</include>
</includes>
<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>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.lazerycode.selenium</groupId>
<artifactId>driver-binary-downloader-maven-plugin</artifactId>
<version>1.0.11</version>
<configuration>
<rootStandaloneServerDirectory>${project.basedir}/src/test/resources/selenium_standalone_binaries</rootStandaloneServerDirectory>
<downloadedZipFileDirectory>${project.basedir}/src/test/resources/selenium_standalone_zips</downloadedZipFileDirectory>
<customRepositoryMap>${project.basedir}/src/test/resources/RepositoryMap.xml</customRepositoryMap>
<overwriteFilesThatExist>${overwrite.binaries}</overwriteFilesThatExist>
</configuration>
<executions>
<execution>
<goals>
<goal>selenium</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
這是錯誤我看到:
[ERROR] Failed to execute goal on project vital_framework: Could not resolve dependencies for project vital.com:vital_framework:jar:0.0.1: Failure to find ru.yandex.qatools.allure:allure-testng-adaptor:jar:{latest-allure-version} in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
任何建議表示讚賞。我認爲在pom.xml中配置Maven故障安全插件有些問題。我跟着這個設置https://github.com/allure-framework/allure1/wiki/TestNG