title: ScalaTest and SBT: Reporting progress of test suite?
body: <p>I am using ScalaTest and have a test suite that contains many tests, and each test can take about a minute to run.</p>
  
  <pre><code>class LargeSuite extends FunSuite {
      test("Name of test 1") { ... }
      ...
      test("Name of test n") { ... }
  }
  </code></pre>
  
  <p>As is usual with running ScalaTest tests from the SBT console, nothing is reported to the screen until each test in the <code>FunSuite</code> has been run. The problem is that when <code>n</code> is large and each test is slow to run, you do not know what is happening. (Running <code>top</code> or Windows Task Manager and looking for the CPU usage of Java is not really satisfactory.)</p>
  
  <p>But the real problem is when the build is run by Travis CI: Travis assumes that the build has gone wrong and kills it if 10 minutes pass and nothing is printed to the screen. In my case, Travis is killing my build, even though the tests are still running, and each individual <code>test</code> in a <code>FunSuite</code> does not require 10 minutes (although the entire suite does require more than 10 minutes because of the number of tests).</p>
  
  <p><em>My first question is therefore this:</em> how can I get ScalaTest to report on progress to the console after each <code>test</code> in <code>FunSuite</code>, in an idiomatic way?</p>
  
  <p>My partial solution is to use the following trait as a mixin, which solves the problem with Travis:</p>
  
  <pre><code>trait ProgressConsolePrinter extends BeforeAndAfterEach with BeforeAndAfterAll {
    self: Suite =&gt;
  
    override def beforeAll: Unit = {
      Console.print(s"$suiteName running")
      Console.flush
    }
  
    override def afterEach: Unit = {
      Console.print(".")
      Console.flush
    }
  
    override def afterAll: Unit = {
      Console.println
      Console.flush
    }
  }
  </code></pre>
  
  <p>But I understand that using <code>Console</code> to print to the SBT console is not entirely reliable (Googling this seems to somewhat confirm this from the experiences of others).</p>
  
  <p>Also (i) anything you print from <code>Console</code> does <em>not</em> go via SBT's logger, and is therefore not prefixed with <code>[info]</code>, and (ii) when trying the above, the messages printed from <code>Console</code> are jumbled up with other messages from SBT. If I was able to use the proper logger, then neither of these things would happen.</p>
  
  <p><em>My second question is therefore this:</em> How can I print to an SBT logger from within a test in ScalaTest?</p>