TestNg:如果配置方法失败,有没有办法让测试失败@AfterSuite

问题描述

我们在@AfterSuite 中编写了清理代码清理数据库中的所有测试数据。它只是一种测试用例,但我们希望在所有测试完成后执行,因此保存在@AfterSuite。如果@AfterSuite 方法失败,我的管道没有失败,是否有任何我们可以自定义它,以便我们可以在@AfterSuite 方法失败时失败???

输出快照-

Results :

Failed tests: 
  TestA>AbstractCommonBaseTest.afterSuite:179->AbstractCommonBaseTest.verifyDeleteSuccessResults:186->AbstractCommonBaseTest.printErrorFromrPAS:170 1 Excepted success but error or exception was thrown from RPAS = com.kobylynskyi.graphql.codegen.model.graphql.GraphQLError@22d86754

**Tests run: 334,Failures: 1,Errors: 0,Skipped: 0**

*Here it is failing @AfterSuiteMethod but at down it is showing as* **SUCCESS**

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6:11.466s
[INFO] Finished at: Thu Mar 18 11:37:14 UTC 2021
[INFO] Final Memory: 39M/123M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project rpas-functional-test: There are test failures.
[ERROR] 
[ERROR] Please refer to /ibp/data/ibpslave/workspace/8794421764755340381/test_rpas_integration/rpas-functional-test/target/surefire-reports for the individual test results.
[ERROR] -> [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
TestNG Reports Processing: START
Looking for TestNG results report in workspace using pattern: **/testng-results.xml
Saving reports...
Processing '/var/jenkins_home/jobs/8794421764755340381/jobs/test_rpas_integration/builds/40/testng/testng-results.xml'
TestNG Reports Processing: FINISH
**Finished: SUCCESS**

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)