无法编译TestNG测试套件(Maven+Surefire)
Can't compile TestNG test suite (Maven+Surefire)
我正在尝试从命令行“mvn clean test”运行 测试套件
但我收到如下错误:
[ERROR] 无法执行目标 org.apache.maven.plugins:maven-surefire-plugin:2.20:test (default-test) on project automation: 有测试失败。
[错误]
[ERROR] 个别测试结果请参考C:\Users\Vartotojas\Desktop\Automatiniai testia\automation\target\surefire-reports。
[错误] 请参考转储文件(如果存在)[date]-jvmRun[N].dump、[date].dumpstream 和 [date]-jvmRun[N].dumpstream。
[ERROR] 分叉进程出错
[错误] 套件文件 C:\Users\Vartotojas\Desktop\Automatiniai testia\automation\AllTestsRelease.xml 不是有效文件
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: 分叉进程出错
这是我的完整 POM.xml 文件:
<groupId>automation</groupId>
<artifactId>automation</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<sourceDirectory>src/main</sourceDirectory>
<testSourceDirectory>src/test</testSourceDirectory>
<resources>
<resource>
<directory>src/resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>
src/testResources
</directory>
<filtering>true</filtering>
</testResource>
</testResources>
<pluginManagement>
<plugins>
<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<version>2.9</version>
<configuration>
<reportVersion>2.6.0</reportVersion>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<!--<testFailureIgnore>true</testFailureIgnore>-->
<useSystemClassLoader>false</useSystemClassLoader>
<threadCount>1</threadCount>
<suiteXmlFiles>
<suiteXmlFile>AllTestsRelease.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
<properties>
<xmlName>tst</xmlName>
<maven-surefire-plugin.version>2.20</maven-surefire-plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<aspectj.version>1.9.2</aspectj.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<log4j.version>1.2.17</log4j.version>
<sel4j.version>1.7.25</sel4j.version>
<glassfish.version>2.26-b03</glassfish.version>
<allure-testng.version>2.6.0</allure-testng.version>
<ashot.version>1.5.4</ashot.version>
<extentReport.version>2.41.2</extentReport.version>
<jsonSimple.version>1.1.1</jsonSimple.version>
<testng.version>6.9.10</testng.version>
<io.appium>4.1.2</io.appium>
<selenium.version>3.14.0</selenium.version>
<webdriver.download>3.6.1</webdriver.download>
<extentreports.version>4.0.9</extentreports.version>
<org.json>20180813</org.json>
</properties>
<dependencies>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>${org.json}</version>
</dependency>
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>${extentreports.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${sel4j.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>${glassfish.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.connectors</groupId>
<artifactId>jersey-apache-connector</artifactId>
<version>${glassfish.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>${glassfish.version}</version>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-testng</artifactId>
<version>${allure-testng.version}</version>
</dependency>
<dependency>
<groupId>ru.yandex.qatools.ashot</groupId>
<artifactId>ashot</artifactId>
<version>${ashot.version}</version>
</dependency>
<dependency>
<groupId>com.relevantcodes</groupId>
<artifactId>extentreports</artifactId>
<version>${extentReport.version}</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>${jsonSimple.version}</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>${testng.version}</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-support</artifactId>
<version>${selenium.version}</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>${selenium.version}</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
<version>${selenium.version}</version>
</dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>${webdriver.download}</version>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.15</version>
</dependency>
</dependencies>
如果我删除 suiteXMLfiles 标签,构建成功
<suiteXmlFile>AllTestsRelease.xml</suiteXmlFile>
我在这里做错了什么?我需要 suitesXMLFiles 标签到 运行 测试套件
这里是 AllTestsRelease.xml 文件的代码:
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Release Suite">
<test name="ALL TESTS" parallel="methods" thread-count="5">
<groups>
<define name="release">
<include name="Release"/>
</define>
<run>
<include name="Regression"/>
<include name="Release"/>
</run>
</groups>
<classes>
<class name="Search"/>
</classes>
</test>
</suite>
尝试提供 AllTestsRelease.xml 文件的完整路径,例如
<suiteXmlFile>src/test/java/testSuites/AllTestsRelease.xml</suiteXmlFile>
我正在尝试从命令行“mvn clean test”运行 测试套件
但我收到如下错误:
[ERROR] 无法执行目标 org.apache.maven.plugins:maven-surefire-plugin:2.20:test (default-test) on project automation: 有测试失败。 [错误] [ERROR] 个别测试结果请参考C:\Users\Vartotojas\Desktop\Automatiniai testia\automation\target\surefire-reports。 [错误] 请参考转储文件(如果存在)[date]-jvmRun[N].dump、[date].dumpstream 和 [date]-jvmRun[N].dumpstream。 [ERROR] 分叉进程出错 [错误] 套件文件 C:\Users\Vartotojas\Desktop\Automatiniai testia\automation\AllTestsRelease.xml 不是有效文件 [ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: 分叉进程出错
这是我的完整 POM.xml 文件:
<groupId>automation</groupId>
<artifactId>automation</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<sourceDirectory>src/main</sourceDirectory>
<testSourceDirectory>src/test</testSourceDirectory>
<resources>
<resource>
<directory>src/resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>
src/testResources
</directory>
<filtering>true</filtering>
</testResource>
</testResources>
<pluginManagement>
<plugins>
<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<version>2.9</version>
<configuration>
<reportVersion>2.6.0</reportVersion>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<!--<testFailureIgnore>true</testFailureIgnore>-->
<useSystemClassLoader>false</useSystemClassLoader>
<threadCount>1</threadCount>
<suiteXmlFiles>
<suiteXmlFile>AllTestsRelease.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
<properties>
<xmlName>tst</xmlName>
<maven-surefire-plugin.version>2.20</maven-surefire-plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<aspectj.version>1.9.2</aspectj.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<log4j.version>1.2.17</log4j.version>
<sel4j.version>1.7.25</sel4j.version>
<glassfish.version>2.26-b03</glassfish.version>
<allure-testng.version>2.6.0</allure-testng.version>
<ashot.version>1.5.4</ashot.version>
<extentReport.version>2.41.2</extentReport.version>
<jsonSimple.version>1.1.1</jsonSimple.version>
<testng.version>6.9.10</testng.version>
<io.appium>4.1.2</io.appium>
<selenium.version>3.14.0</selenium.version>
<webdriver.download>3.6.1</webdriver.download>
<extentreports.version>4.0.9</extentreports.version>
<org.json>20180813</org.json>
</properties>
<dependencies>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>${org.json}</version>
</dependency>
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>${extentreports.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${sel4j.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>${glassfish.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.connectors</groupId>
<artifactId>jersey-apache-connector</artifactId>
<version>${glassfish.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>${glassfish.version}</version>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-testng</artifactId>
<version>${allure-testng.version}</version>
</dependency>
<dependency>
<groupId>ru.yandex.qatools.ashot</groupId>
<artifactId>ashot</artifactId>
<version>${ashot.version}</version>
</dependency>
<dependency>
<groupId>com.relevantcodes</groupId>
<artifactId>extentreports</artifactId>
<version>${extentReport.version}</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>${jsonSimple.version}</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>${testng.version}</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-support</artifactId>
<version>${selenium.version}</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>${selenium.version}</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
<version>${selenium.version}</version>
</dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>${webdriver.download}</version>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.15</version>
</dependency>
</dependencies>
如果我删除 suiteXMLfiles 标签,构建成功
<suiteXmlFile>AllTestsRelease.xml</suiteXmlFile>
我在这里做错了什么?我需要 suitesXMLFiles 标签到 运行 测试套件
这里是 AllTestsRelease.xml 文件的代码:
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Release Suite">
<test name="ALL TESTS" parallel="methods" thread-count="5">
<groups>
<define name="release">
<include name="Release"/>
</define>
<run>
<include name="Regression"/>
<include name="Release"/>
</run>
</groups>
<classes>
<class name="Search"/>
</classes>
</test>
</suite>
尝试提供 AllTestsRelease.xml 文件的完整路径,例如
<suiteXmlFile>src/test/java/testSuites/AllTestsRelease.xml</suiteXmlFile>