TestNG: How can we fail the Test Suite In case of Configuration failure

74 views
Skip to first unread message

Spandan G

unread,
May 9, 2021, 3:52:54 AM5/9/21
to testng-users
In my project, We have written many test cases and one Configuration method with annotation @AfterSuite to delete all the test data. Some times this configuration methos is failing but in final result this failure is not getting considered and my Test Suite is passing. Can some one please provide the solution how can we fail the Test Suite in case of Configuration failur as well.

Results : Failed tests: QueryResourceTests>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 [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   

⇜Krishnan Mahadevan⇝

unread,
May 9, 2021, 4:12:07 AM5/9/21
to testng-users
There's hardly any details in what you have shared, to help us debug.

Can you please share some additional context (Stacktrace or a sample project that can be used to reproduce the problem)

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ https://rationaleemotions.com/


On Sun, May 9, 2021 at 1:22 PM Spandan G <spand...@gmail.com> wrote:
In my project, We have written many test cases and one Configuration method with annotation @AfterSuite to delete all the test data. Some times this configuration methos is failing but in final result this failure is not getting considered and my Test Suite is passing. Can some one please provide the solution how can we fail the Test Suite in case of Configuration failur as well.

Results : Failed tests: QueryResourceTests>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 [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   

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/testng-users/d90389e3-44cb-41da-8b8f-fe2e77994f3fn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages