Class FailureDiagnostics

  • All Implemented Interfaces:
    org.junit.rules.TestRule

    @GlobalRule(priority=-2147483648)
    @TestScope
    public class FailureDiagnostics
    extends org.junit.rules.TestWatcher
    Attach diagnostic file related to a test failure.

    The harness can attach any number of diagnostic files to be stored in /target/diagnostics/$TEST_NAME/. The same 'kind' of diagnostic information is expected to use the same file/subdir name.

    Author:
    ogondza
    • Constructor Detail

      • FailureDiagnostics

        @Inject
        public FailureDiagnostics​(TestName test)
    • Method Detail

      • touch

        public File touch​(String filename)
        Get ready for writing in diagnosis file.
      • write

        public void write​(String filename,
                          String content)
        Write string in diagnostic file.
        Parameters:
        filename - Name of the file
        content - Content to write.
      • succeeded

        protected void succeeded​(org.junit.runner.Description description)
        Overrides:
        succeeded in class org.junit.rules.TestWatcher
      • failed

        public void failed​(Throwable e,
                           org.junit.runner.Description description)
        Overrides:
        failed in class org.junit.rules.TestWatcher