Interface LogCapturing

  • All Superinterfaces:
    org.scalatest.BeforeAndAfterAll, org.scalatest.SuiteMixin

    public interface LogCapturing
    extends org.scalatest.BeforeAndAfterAll
    Mixin this trait to a ScalaTest test to make log lines appear only when the test failed.

    Requires Logback and configuration like the following the logback-test.xml:

    
         <appender name="CapturingAppender" class="akka.actor.testkit.typed.internal.CapturingAppender" />
    
         <logger name="akka.actor.testkit.typed.internal.CapturingAppenderDelegate" >
           <appender-ref ref="STDOUT"/>
         </logger>
    
         <root level="DEBUG">
             <appender-ref ref="CapturingAppender"/>
         </root>
     
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void afterAll()  
      void clearCapturedLogs()
      May be called to explicitly clear the captured logs.
      boolean clearLogsAfterEachTest()
      If true, the logs will be cleared after each test.
      void super$afterAll()  
      org.scalatest.Outcome withFixture​(org.scalatest.TestSuite.NoArgTest test)  
      • Methods inherited from interface org.scalatest.BeforeAndAfterAll

        beforeAll, invokeBeforeAllAndAfterAllEvenIfNoTestsAreExpected, org$scalatest$BeforeAndAfterAll$_setter_$invokeBeforeAllAndAfterAllEvenIfNoTestsAreExpected_$eq, run
      • Methods inherited from interface org.scalatest.SuiteMixin

        expectedTestCount, nestedSuites, rerunner, runNestedSuites, runTest, runTests, styleName, suiteId, suiteName, tags, testDataFor, testNames
    • Method Detail

      • afterAll

        void afterAll()
        Specified by:
        afterAll in interface org.scalatest.BeforeAndAfterAll
      • clearCapturedLogs

        void clearCapturedLogs()
        May be called to explicitly clear the captured logs.

        Useful for when logs are not cleared after each test. If clearing after every test is desirable, overriding clearLogsAfterEachTest() is preferable.

      • clearLogsAfterEachTest

        boolean clearLogsAfterEachTest()
        If true, the logs will be cleared after each test.

        This is not enabled by default for Scala tests, since state may be shared between sequential tests, and logs from earlier tests may be important.

      • super$afterAll

        void super$afterAll()
      • withFixture

        org.scalatest.Outcome withFixture​(org.scalatest.TestSuite.NoArgTest test)