2017-01-27 9 views
2

私のキュウリ(Java)テストプロジェクトにアリューアを添付する必要があります。目標org.apache.maven.pluginsを実行できませんでした:maven-surefire-plugin:2.19.1:キュウリのテスト中のテスト

実際、JUnitのテストスターターから開始すると、すべてのテストが正しく実行されます。 Mavenのの終わりには

mvn clean test 

私が手ログ:

私はコマンドを使用して私のテストを実行した場合

[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 

この原因アリュール・レポートはaftet形成することができなかった状況、 mvn siteコマンド。ここで

は、エラーのスタックトレースです:

<?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> 

あなたは、これで私を助けてくださいでした:

[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ファイルの内容は?

答えて

1

あなたはデープと設定を混乱させたからです。 まず、allure-junit-adapter依存関係を削除します。 最後に、surefire設定からプロパティセクションを削除します。

<?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> 
+0

確実な設定から構成を削除するのは非常に奇妙です。しかし、もしそうなら、このケースではどこを動かすべきですか? – SanchelliosProg

+0

Allure-cucumber-jvm-adapterは1.6から異なる相互作用メカニズムを使用しています。これは、junitリスナーの代わりにcucumber-jvmプラグインとして機能します。これは確かな設定からリスナーを削除する理由です。 –

+0

質問の説明に投稿したファイルをリファクタリングすることはできますか?私はあなたが推奨したことをやろうとしましたが、うまくいきません。今度は目標[org.apache.maven.plugins]を実行できませんでした:maven-surefire-plugin:2.19.1:プロジェクトのテスト(デフォルトテスト)b2b-web-test:目標orgの実行デフォルトテスト.apache.maven.plugins:maven-surefire-plug :2.19.1:テストに失敗しました:org.apache.maven.surefire.util.SurefireReflectionException:java.lang.ClassNotFoundException:ru.yandex.qatools.allure.junit。 AllureRunListener - > [ヘルプ1] – SanchelliosProg

関連する問題