1

JUnit 4、Maven、および Jenkins で Allure Test Reporting Framework を使用しようとしています。必要な依存関係で pom.xml を更新しました。Jenkins でプロジェクトをビルドすると、Allure レポートがビルドに添付されますが、0 個のテスト スイートと 0 個のテストが表示され、すべて合格で、その他の情報はありません。

壊れていると表示されるはずのテストが数十個あり、正当に合格したものもいくつかあります。Jenkins Allure プラグインのデフォルト設定を使用しています。テストの実行後、XML レポートは正しいディレクトリに生成されています。ビルドに添付されたレポートに実際には入力されていないようです。

以下は、スタックトレースを使用した Jenkins のコンソール出力です。

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project project-platform: There are test failures.
[ERROR] 
[ERROR] Please refer to /usr/share/tomcat/.jenkins/workspace/testingprojectplatform/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project project-platform: There are test failures.

Please refer to /usr/share/tomcat/.jenkins/workspace/testingprojectplatform/target/surefire-reports for the individual test results.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
    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:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:414)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:357)
Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures.

Please refer to /usr/share/tomcat/.jenkins/workspace/testingprojectplatform/target/surefire-reports for the individual test results.
    at org.apache.maven.plugin.surefire.SurefireHelper.reportExecution(SurefireHelper.java:82)
    at org.apache.maven.plugin.surefire.SurefirePlugin.handleSummary(SurefirePlugin.java:254)
    at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:854)
    at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:722)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 19 more
[ERROR] 
[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
Build step 'Invoke top-level Maven targets' marked build as failure
Allure Report Generation: started
Allure Report Generation: find directories by mask [target/surefire-reports/]
Allure Report Generation: found allure result directories [/usr/share/tomcat/.jenkins/workspace/testingprojectplatform/target/surefire-reports]
Allure Report Generation: copy founded directories in directory [/usr/share/tomcat/.jenkins/workspace/testingprojectplatform/allure4540046437484771478.tmp/results]
Allure Report Generation: generate report from directory [/usr/share/tomcat/.jenkins/workspace/testingprojectplatform/allure4540046437484771478.tmp]
Allure Report Generation: proxy settings [active:'false', host:'null', port:'0', username:'null', password: '']
Allure Report Generation: attach report link to build and project
Allure Report Generation: completed
Skipped archiving because build is not successful
Finished: FAILURE

target/surefire-reports ディレクトリにあるエラーのある .txt ファイルの 1 つを次に示します。

-------------------------------------------------------------------------------
Test set: com.company.project.rest.VisitRestTest
-------------------------------------------------------------------------------
Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.256 sec <<< FAILURE!
com.company.project.rest.VisitRestTest  Time elapsed: 0.256 sec  <<< ERROR!
java.lang.NoSuchMethodError: org.apache.commons.beanutils.ConvertUtilsBean.register(ZZI)V
    at ru.yandex.qatools.properties.decorators.DefaultFieldDecorator.<init>(DefaultFieldDecorator.java:24)
    at ru.yandex.qatools.properties.PropertyLoader.populate(PropertyLoader.java:29)
    at ru.yandex.qatools.properties.PropertyLoader.populate(PropertyLoader.java:23)
    at ru.yandex.qatools.allure.config.AllureConfig.<init>(AllureConfig.java:80)
    at ru.yandex.qatools.allure.config.AllureConfig.newInstance(AllureConfig.java:84)
    at ru.yandex.qatools.allure.Allure.fire(Allure.java:146)
    at ru.yandex.qatools.allure.junit.AllureRunListener.testFinished(AllureRunListener.java:84)
    at org.junit.runner.notification.SynchronizedRunListener.testFinished(SynchronizedRunListener.java:56)
    at org.junit.runner.notification.RunNotifier$7.notifyListener(RunNotifier.java:190)
    at org.junit.runner.notification.RunNotifier$SafeNotifier.run(RunNotifier.java:72)
    at org.junit.runner.notification.RunNotifier.fireTestFinished(RunNotifier.java:187)
    at org.junit.internal.runners.model.EachTestNotifier.fireTestFinished(EachTestNotifier.java:38)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:331)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
    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:483)
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:208)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:158)
    at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:86)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:95)

エラーは、commons.beansutils からメソッドが見つからないように見えますが、pom.xml に次の依存関係があります。

<dependency>
    <groupId>commons-beanutils</groupId>
    <artifactId>commons-beanutils</artifactId>
    <version>1.9.2</version>
    <scope>test</scope>
</dependency>
4

0 に答える 0