Maven - как мне игнорировать сбои и ошибки при начальном выполнении для лучшего отчета о сборке - PullRequest
0 голосов
/ 08 июля 2020

в моем POM - у меня есть 2 <executions>, <id>Initial Test Run</id> и <id>Failed Test ReRun</id>, которые запускают <goal>integration-test</goal>.

Как мне maven failsafe "игнорировать" ошибку выполнения Initial Test Run или неудачи? В своей голове я бы хотел, чтобы при повторном запуске "последний" сказал, действительно ли сборка проходит или терпит неудачу.

Текущее поведение

  1. Тестовый повторный запуск проходит, но сборка maven, сообщает об ошибке из-за сбоев / ошибок начального запуска теста

Желаемое поведение

  1. Если есть ошибка или сбой при начальном выполнении теста, запустите повторный запуск неудавшийся тест - сообщить сборку как «успешную», если она прошла успешно.
  2. В противном случае, если неудачный тест не прошел при повторном запуске, пометьте сборку как неудачную.

Вот мой файл POM (шаг выполнения)

                <executions>
                    <execution>
                        <id>Initial Test Run</id>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                        <configuration>
                            <excludes>
                                <exclude>**/DeveloperTools.java</exclude>
                                <exclude>**/FailedTestReRunnerIT.java</exclude>
                            </excludes>
                            <forkCount>3</forkCount>
                            <reuseForks>false</reuseForks>
                            <parallel>classesAndMethods</parallel>
                            <useUnlimitedThreads>true</useUnlimitedThreads>
                            <perCoreThreadCount>false</perCoreThreadCount>
                            <!-- ignore any failures in initial test run, since it will be captured in rerun-->
                            <testFailureIgnore>true</testFailureIgnore>
                        </configuration>
                    </execution>
                   <execution>
                       <id>Failed Test ReRun</id>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                        <configuration>
                            <excludes>
                                <exclude>**/DeveloperTools.java</exclude>
                                <exclude>**/CucumberRunnerIT.java</exclude>
                            </excludes>
                            <forkCount>3</forkCount>
                            <reuseForks>false</reuseForks>
                            <parallel>classesAndMethods</parallel>
                            <useUnlimitedThreads>true</useUnlimitedThreads>
                            <perCoreThreadCount>false</perCoreThreadCount>
                            <rerunFailingTestsCount>1</rerunFailingTestsCount>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

Текущий отчет Maven:

05:30:40 INFO: Detected dialect: W3C
05:30:40 [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 48.92 s - in MKS - price reduction scenarios
05:30:40 [INFO] 
05:30:40 [INFO] Results:
05:30:40 [INFO] 
05:30:40 [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
05:30:40 [INFO] 
05:30:41 [INFO] 
05:30:41 [INFO] --- cluecumber-report-plugin:2.3.1:reporting (ALL BANNERS TEST REPORT) @ testframework ---
05:30:41 [INFO] ------------------------------------------------------------------------
05:30:41 [INFO]  Cluecumber Report Maven Plugin, version 2.3.1
05:30:41 [INFO] ------------------------------------------------------------------------
05:30:41 [INFO] - source JSON report directory     : /home/fmdigi/data/jenkins/workspace/Cucumber Acceptance Test Suite QA1/target/cucumber-report/
05:30:41 [INFO] - generated HTML report directory  : test-report/all-cluecumber-reports
05:30:41 [INFO] ------------------------------------------------------------------------
05:30:41 [INFO] - fail pending/undefined scenarios : false
05:30:41 [INFO] - expand before/after hooks        : true
05:30:41 [INFO] - expand step hooks                : false
05:30:41 [INFO] - expand doc strings               : false
05:30:41 [INFO] - page title                       : Cluecumber Report
05:30:41 [INFO] - colors (passed, failed, skipped) : #28a745, #dc3545, #ffc107
05:30:41 [INFO] ------------------------------------------------------------------------
05:30:43 [INFO] => Cluecumber Report: test-report/all-cluecumber-reports/index.html
05:30:43 [INFO] 
05:30:43 [INFO] --- cluecumber-report-plugin:2.3.1:reporting (RERUN ALL BANNERS TEST REPORT) @ testframework ---
05:30:43 [INFO] ------------------------------------------------------------------------
05:30:43 [INFO]  Cluecumber Report Maven Plugin, version 2.3.1
05:30:43 [INFO] ------------------------------------------------------------------------
05:30:43 [INFO] - source JSON report directory     : /home/fmdigi/data/jenkins/workspace/Cucumber Acceptance Test Suite QA1/target/rerun_cucumber-report/
05:30:43 [INFO] - generated HTML report directory  : test-report/rerun-cluecumber-reports
05:30:43 [INFO] ------------------------------------------------------------------------
05:30:43 [INFO] - fail pending/undefined scenarios : false
05:30:43 [INFO] - expand before/after hooks        : true
05:30:43 [INFO] - expand step hooks                : false
05:30:43 [INFO] - expand doc strings               : false
05:30:43 [INFO] - page title                       : Cluecumber Report
05:30:43 [INFO] - colors (passed, failed, skipped) : #28a745, #dc3545, #ffc107
05:30:43 [INFO] ------------------------------------------------------------------------
05:30:43 [INFO] => Cluecumber Report: test-report/rerun-cluecumber-reports/index.html
05:30:43 [INFO] 
05:30:43 [INFO] --- maven-failsafe-plugin:3.0.0-M4:verify (Initial Test Run) @ testframework ---
05:30:43 [ERROR] There are test failures.
05:30:43 
05:30:43 Please refer to /home/fmdigi/data/jenkins/workspace/Cucumber Acceptance Test Suite QA1/target/failsafe-reports for the individual test results.
05:30:43 Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
05:30:43 [INFO] 
05:30:43 [INFO] --- maven-failsafe-plugin:3.0.0-M4:verify (Failed Test ReRun) @ testframework ---
05:30:43 [INFO] ------------------------------------------------------------------------
05:30:43 [INFO] BUILD FAILURE
05:30:43 [INFO] ------------------------------------------------------------------------
05:30:43 [INFO] Total time: 12:33 min
05:30:43 [INFO] Finished at: 2020-07-08T05:32:58-06:00
05:30:43 [INFO] Final Memory: 38M/929M
05:30:43 [INFO] ------------------------------------------------------------------------
05:30:43 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:3.0.0-M4:verify (Failed Test ReRun) on project testframework: There are test failures.
05:30:43 [ERROR] 
05:30:43 [ERROR] Please refer to /home/fmdigi/data/jenkins/workspace/Cucumber Acceptance Test Suite QA1/target/failsafe-reports for the individual test results.
05:30:43 [ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
05:30:43 [ERROR] -> [Help 1]
05:30:43 [ERROR] 
05:30:43 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
05:30:43 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
05:30:43 [ERROR] 
05:30:43 [ERROR] For more information about the errors and possible solutions, please read the following articles:
05:30:43 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
05:30:43 Build step 'Invoke top-level Maven targets' marked build as failure
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...