我需要附加诱惑力到我的cucumber(Java)测试项目。
事实上,如果我从JUnit Test-Starter启动所有测试,它们都能正确运行。
如果使用以下命令运行测试:
mvn clean test
在Maven日志的最后,我得到了:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.078 s
[INFO] Finished at: 2017-01-27T17:11:17+03:00
[INFO] Final Memory: 27M/322M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project web-test: Exception in provider: java.lang.NullPointerException -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
这就造成了这样的情况,即在mvn站点命令后无法形成倾城报告。
下面是错误的stacktrace:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project web-test: Exception in provider: java.lang.NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project web-test: Exception in provider
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoFailureException: Exception in provider
at org.apache.maven.plugin.surefire.SurefirePlugin.assertNoException(SurefirePlugin.java:328)
at org.apache.maven.plugin.surefire.SurefirePlugin.handleSummary(SurefirePlugin.java:318)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:892)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:755)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more
Caused by: org.apache.maven.surefire.booter.SurefireExecutionException: Exception in provider
at org.apache.maven.plugin.surefire.InPluginVMSurefireStarter.runSuitesInProcess(InPluginVMSurefireStarter.java:87)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1010)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:862)
... 23 more
Caused by: org.apache.maven.surefire.testset.TestSetFailedException: java.lang.NullPointerException
at org.apache.maven.surefire.common.junit4.JUnit4RunListener.rethrowAnyTestMechanismFailures(JUnit4RunListener.java:209)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:169)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:202)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:155)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:81)
at org.apache.maven.plugin.surefire.InPluginVMSurefireStarter.runSuitesInProcess(InPluginVMSurefireStarter.java:82)
... 25 more
Caused by: java.lang.NullPointerException
at org.junit.runner.Description.createSuiteDescription(Description.java:123)
at ru.yandex.qatools.allure.junit.AllureRunListener.getSuiteUid(AllureRunListener.java:110)
at ru.yandex.qatools.allure.junit.AllureRunListener.testStarted(AllureRunListener.java:50)
at org.junit.runner.notification.RunNotifier$3.notifyListener(RunNotifier.java:115)
at org.junit.runner.notification.RunNotifier$SafeNotifier.run(RunNotifier.java:61)
at org.junit.runner.notification.RunNotifier.fireTestStarted(RunNotifier.java:112)
at org.apache.maven.surefire.common.junit4.Notifier.fireTestStarted(Notifier.java:100)
at org.junit.internal.runners.model.EachTestNotifier.fireTestStarted(EachTestNotifier.java:43)
at cucumber.runtime.junit.JUnitReporter.startExecutionUnit(JUnitReporter.java:54)
at cucumber.runtime.junit.ExecutionUnitRunner.run(ExecutionUnitRunner.java:100)
at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:63)
at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:18)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:70)
at cucumber.api.junit.Cucumber.runChild(Cucumber.java:95)
at cucumber.api.junit.Cucumber.runChild(Cucumber.java:38)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at cucumber.api.junit.Cucumber.run(Cucumber.java:100)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:367)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:274)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:161)
... 33 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
下面是pom.xml文件的内容:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
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>m2m-selenium</groupId>
<artifactId>web-test</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<aspectj.version>1.7.4</aspectj.version>
<allure.version>1.4.23</allure.version>
<serverAddress>http://site</serverAddress>
<username>admin</username>
<password>admin</password>
<browser>chrome</browser>
<timeout>500</timeout>
<!--Selenium driver: remote or local-->
<seleniumDriver>local</seleniumDriver>
</properties>
<dependencies>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
</dependency>
<dependency>
<groupId>pl.pragmatists</groupId>
<artifactId>JUnitParams</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.7</version>
</dependency>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-junit-adaptor</artifactId>
<version>${allure.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>gherkin</artifactId>
<version>2.12.2</version>
</dependency>
<!--NEW-->
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-cucumber-jvm-adaptor</artifactId>
<version>1.6.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<testFailureIgnore>false</testFailureIgnore>
<argLine>
-javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar
-Dcucumber.options="--plugin ru.yandex.qatools.allure.cucumberjvm.AllureReporter"
</argLine>
<properties>
<property>
<encoding>${project.build.sourceEncoding}</encoding>
<name>listener</name>
<value>ru.yandex.qatools.allure.junit.AllureRunListener</value>
</property>
</properties>
<forkMode>never</forkMode>
<!-- <reuseForks>false</reuseForks>-->
<testFailureIgnore>true</testFailureIgnore>
<systemPropertyVariables>
<serverAddress>${serverAddress}</serverAddress>
<username>${username}</username>
<password>${password}</password>
<buildDirectory>${project.build.directory}</buildDirectory>
<browser>${browser}</browser>
<timeout>${timeout}</timeout>
<seleniumDriver>${seleniumDriver}</seleniumDriver>
</systemPropertyVariables>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
<!--Needed only to show reports locally. Run jetty:run and
open localhost:8080 to show the report-->
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.2.10.v20150310</version>
<configuration>
<webAppSourceDirectory>${project.build.directory}/site/allure-maven-plugin</webAppSourceDirectory>
<stopKey>stop</stopKey>
<stopPort>1234</stopPort>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<excludeDefaults>true</excludeDefaults>
<plugins>
<plugin>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-maven-plugin</artifactId>
<version>2.5</version>
<configuration>
<resultsDirectory>allure-results</resultsDirectory>
</configuration>
</plugin>
</plugins>
</reporting>
</project>
你能帮我拿一下这个吗?
在某些情况下,解决方案是重命名项目中文件名中包含“test”的所有文件,这些文件不是正确的.Java文件。
因为你搞砸了DEP和配置。首先,移除allure-junit-adaptor依赖项。最后从surefire配置中删除properties部分。
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
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>m2m-selenium</groupId>
<artifactId>b2b-web-test</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<aspectj.version>1.7.4</aspectj.version>
<allure.version>1.4.23</allure.version>
<serverAddress>http://m2m-b2b/b2b/</serverAddress>
<username>admin</username>
<password>admin</password>
<browser>chrome</browser>
<timeout>500</timeout>
<!--Selenium driver: remote or local-->
<seleniumDriver>local</seleniumDriver>
</properties>
<dependencies>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
</dependency>
<dependency>
<groupId>pl.pragmatists</groupId>
<artifactId>JUnitParams</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.7</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>gherkin</artifactId>
<version>2.12.2</version>
</dependency>
<!--NEW-->
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-cucumber-jvm-adaptor</artifactId>
<version>1.6.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<testFailureIgnore>false</testFailureIgnore>
<argLine>
-javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar
-Dcucumber.options="--plugin ru.yandex.qatools.allure.cucumberjvm.AllureReporter"
</argLine>
<properties>
<property>
<encoding>${project.build.sourceEncoding}</encoding>
</property>
</properties>
<forkMode>never</forkMode>
<!-- <reuseForks>false</reuseForks>-->
<testFailureIgnore>true</testFailureIgnore>
<systemPropertyVariables>
<serverAddress>${serverAddress}</serverAddress>
<username>${username}</username>
<password>${password}</password>
<buildDirectory>${project.build.directory}</buildDirectory>
<browser>${browser}</browser>
<timeout>${timeout}</timeout>
<seleniumDriver>${seleniumDriver}</seleniumDriver>
</systemPropertyVariables>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
<!--Needed only to show reports locally. Run jetty:run and
open localhost:8080 to show the report-->
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.2.10.v20150310</version>
<configuration>
<webAppSourceDirectory>${project.build.directory}/site/allure-maven-plugin</webAppSourceDirectory>
<stopKey>stop</stopKey>
<stopPort>1234</stopPort>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<excludeDefaults>true</excludeDefaults>
<plugins>
<plugin>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-maven-plugin</artifactId>
<version>2.5</version>
<configuration>
<resultsDirectory>allure-results</resultsDirectory>
</configuration>
</plugin>
</plugins>
</reporting>
</project>
我使用的是Eclipse版本:2018-09(4.9.0),我已经在Eclipse中安装了Spring Tool Suit(STS)用于构建Spring Boot应用程序。 问题->当我创建新的Spring Starter项目并尝试在不添加任何代码的情况下用maven构建我的项目时。生成失败,出现以下错误。 如果我移除具有默认测试的测试文件夹。工作很好。但为什么会这样。下面的文件夹是我删除的,它是
Im试图在maven中获得一个简单有效的登录测试版本,以便稍后在jenkins服务器上运行。 问题是:每次我构建(干净安装)时,我都会收到以下错误: 我在这里乱扔头发,怎么解决这个问题?(错误不是头发)
我升级了Selenium以支持GeckoDriver,然后Jenkins它。我对这种幕后升级非常陌生。自从我们运行Selenium 3以来,我们不再使用Selenium Grid插件。从那以后,我就无法运行任何测试。 我们为詹金斯主站和从站运行 Windows 7 机器。如果它有任何区别,我们使用Java。我们还有一个框架坐在硒的顶部。 尤其是这个错误让我很恼火: 我试图改变分叉配置,但无济于事。
几天来,我一直在尝试解决以下错误,但无法解决:( 我的模块是pom。xml文件是: 我得到以下错误: 我尝试了以下方法,但没有帮助: mvn依赖::树 mvn清洁安装-U或右键单击项目转到Maven 请救救我!
我正在做一个maven项目,我的IDE是Eclipse我无法理解的是,当我在Eclipse中使用“clean-X”时,它会报告以下错误: 但是当我使用终端操作时,它是有效的。
我正在尝试安装stanbol并得到以下错误 附加错误日志