Uploaded image for project: 'Arquillian'
  1. Arquillian
  2. ARQ-1356

TestResult isn't updated correctly when TestNG is used

    XMLWordPrintable

Details

    Description

      When a test fails, the state of TestResult is still PASSED and therefore it can't be used in observer:

      public class LifecycleObserver {
          @Inject
          private Instance<TestResult> result;
      
          public void afterTest(@Observes After event) {
              if (result.get().getStatus().equals(PASSED)) {
                  // something
              } else {
                  // something else
              }
          }
      }
      

      The problem is LocalTestExecutor updates the status to FAILED only if an exception is thrown, but TestMethodExecutor from TestNG implemenation doesn't throw any exception when the test fails. It memorizes it in ITestResult object.

      I propose to throw an exception in the end of test invocation, if the test fails.

      Attachments

        Activity

          People

            jpapouse Jan Papousek (Inactive)
            jpapouse Jan Papousek (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: