java.lang.RuntimeException: This should failure

Sonatype JIRA | Chester Chen | 4 years ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    This project is intended to a set of extensions to the existing testNG framework. The extension includes Listeners/reporter etc.Currently, I only have one listener: ConsoleReporter. ConsoleReporter displays the methods being tested and print the results and exceptions directly to the console. This is useful when one is trying to debug a problem. Without the ConsoleReporter, the sample test output will be like the following: [testng] [TestNG] Running: [testng] =============================================== [testng] testng-ext [testng] Total tests run: 4, Failures: 1, Skips: 0 [testng] =============================================== [testng] The tests failed. We know 4 tests were run and 1 failed, but we don't know which one failed and why failed. To figure out the result, we need to run the report and open up the output files to example. Here is the output of the same example with the ConsoleReporter: Running: [testng] =============================================== [testng] Suite: testng-ext [testng] =============================================== [testng] Test: test status: [testng] [testng] 1) method-name:com.xiaoguangchen.testngex.Sample.sampleTest3 passed [testng] 2) method-name:com.xiaoguangchen.testngex.Sample.sampleTest2 passed [testng] 3) method-name:com.xiaoguangchen.testngex.Sample.sampleTest1 passed [testng] 4) method-name:com.xiaoguangchen.testngex.Sample.failureTest failed [testng] FAILED: Sample.failureTest()[pri:0, instance:com.xiaoguangchen.testngex.Sample@7946738] [testng] java.lang.RuntimeException: This should failure [testng] at com.xiaoguangchen.testngex.Sample.failureTest(Sample.java:28) [testng] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [testng] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [testng] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [testng] at java.lang.reflect.Method.invoke(Method.java:601) [testng] at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80) [testng] at org.testng.internal.Invoker.invokeMethod(Invoker.java:714) [testng] at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901) [testng] at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231) [testng] at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127) [testng] at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111) [testng] at org.testng.TestRunner.privateRun(TestRunner.java:767) [testng] at org.testng.TestRunner.run(TestRunner.java:617) [testng] at org.testng.SuiteRunner.runTest(SuiteRunner.java:334) [testng] at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329) [testng] at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291) [testng] at org.testng.SuiteRunner.run(SuiteRunner.java:240) [testng] at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) [testng] at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) [testng] at org.testng.TestNG.runSuitesSequentially(TestNG.java:1198) [testng] at org.testng.TestNG.runSuitesLocally(TestNG.java:1123) [testng] at org.testng.TestNG.run(TestNG.java:1031) [testng] at org.testng.TestNG.privateMain(TestNG.java:1338) [testng] at org.testng.TestNG.main(TestNG.java:1307) [testng] [testng] [testng] [testng] =============================================== [testng] testng-ext [testng] Total tests run: 4, Failures: 1, Skips: 0 [testng] =============================================== [testng] [testng] The tests failed.

    Sonatype JIRA | 4 years ago | Chester Chen
    java.lang.RuntimeException: This should failure
  2. 0

    This project is intended to a set of extensions to the existing testNG framework. The extension includes Listeners/reporter etc.Currently, I only have one listener: ConsoleReporter. ConsoleReporter displays the methods being tested and print the results and exceptions directly to the console. This is useful when one is trying to debug a problem. Without the ConsoleReporter, the sample test output will be like the following: [testng] [TestNG] Running: [testng] =============================================== [testng] testng-ext [testng] Total tests run: 4, Failures: 1, Skips: 0 [testng] =============================================== [testng] The tests failed. We know 4 tests were run and 1 failed, but we don't know which one failed and why failed. To figure out the result, we need to run the report and open up the output files to example. Here is the output of the same example with the ConsoleReporter: Running: [testng] =============================================== [testng] Suite: testng-ext [testng] =============================================== [testng] Test: test status: [testng] [testng] 1) method-name:com.xiaoguangchen.testngex.Sample.sampleTest3 passed [testng] 2) method-name:com.xiaoguangchen.testngex.Sample.sampleTest2 passed [testng] 3) method-name:com.xiaoguangchen.testngex.Sample.sampleTest1 passed [testng] 4) method-name:com.xiaoguangchen.testngex.Sample.failureTest failed [testng] FAILED: Sample.failureTest()[pri:0, instance:com.xiaoguangchen.testngex.Sample@7946738] [testng] java.lang.RuntimeException: This should failure [testng] at com.xiaoguangchen.testngex.Sample.failureTest(Sample.java:28) [testng] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [testng] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [testng] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [testng] at java.lang.reflect.Method.invoke(Method.java:601) [testng] at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80) [testng] at org.testng.internal.Invoker.invokeMethod(Invoker.java:714) [testng] at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901) [testng] at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231) [testng] at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127) [testng] at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111) [testng] at org.testng.TestRunner.privateRun(TestRunner.java:767) [testng] at org.testng.TestRunner.run(TestRunner.java:617) [testng] at org.testng.SuiteRunner.runTest(SuiteRunner.java:334) [testng] at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329) [testng] at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291) [testng] at org.testng.SuiteRunner.run(SuiteRunner.java:240) [testng] at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) [testng] at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) [testng] at org.testng.TestNG.runSuitesSequentially(TestNG.java:1198) [testng] at org.testng.TestNG.runSuitesLocally(TestNG.java:1123) [testng] at org.testng.TestNG.run(TestNG.java:1031) [testng] at org.testng.TestNG.privateMain(TestNG.java:1338) [testng] at org.testng.TestNG.main(TestNG.java:1307) [testng] [testng] [testng] [testng] =============================================== [testng] testng-ext [testng] Total tests run: 4, Failures: 1, Skips: 0 [testng] =============================================== [testng] [testng] The tests failed.

    Sonatype JIRA | 4 years ago | Chester Chen
    java.lang.RuntimeException: This should failure

    Root Cause Analysis

    1. java.lang.RuntimeException

      This should failure

      at com.xiaoguangchen.testngex.Sample.failureTest()
    2. com.xiaoguangchen.testngex
      Sample.failureTest
      1. com.xiaoguangchen.testngex.Sample.failureTest(Sample.java:28)
      1 frame
    3. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:601)
      4 frames
    4. TestNG
      TestNG.main
      1. org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
      2. org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
      3. org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
      4. org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
      5. org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
      6. org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
      7. org.testng.TestRunner.privateRun(TestRunner.java:767)
      8. org.testng.TestRunner.run(TestRunner.java:617)
      9. org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
      10. org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
      11. org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
      12. org.testng.SuiteRunner.run(SuiteRunner.java:240)
      13. org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
      14. org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
      15. org.testng.TestNG.runSuitesSequentially(TestNG.java:1198)
      16. org.testng.TestNG.runSuitesLocally(TestNG.java:1123)
      17. org.testng.TestNG.run(TestNG.java:1031)
      18. org.testng.TestNG.privateMain(TestNG.java:1338)
      19. org.testng.TestNG.main(TestNG.java:1307)
      19 frames