Search code examples
scalaplayframeworkscalatest

ScalaTest: Is it possible to combine AsyncWordSpec and GuiceOneAppPerSuite


I wanted to switch my Acceptance tests from WordSpec to AsyncWordSpec.

The existing trait looks like:

import org.scalatest.WordSpec
import org.scalatestplus.play.guice.GuiceOneAppPerSuite

class PetDBSpec
    extends WordSpec
    with GuiceOneAppPerSuite {
}

If I change that I have to AsyncWordSpec I have to change it like that:

import org.scalatest._
import org.scalatestplus.play.guice.GuiceOneAppPerSuite

class PetDBSpec
    extends AsyncWordSpec
    with GuiceOneAppPerSuite {  this: TestSuite =>
}

But still get this Exception:

[error] ... class PetDBSpec needs to be abstract, since method withFixture in trait TestSuiteMixin of type (test: PetDBSpec.this.NoArgTest)org.scalatest.Outcome is not defined
[error] (Note that TestSuiteMixin.this.NoArgTest does not match AsyncTestSuite.this.NoArgAsyncTest)

It works fine with my UnitTests.

  • Do I have to adjust my Tests?
  • Or is it not possible to mix them?

Used Versions:

  • Play: 2.6.15
  • Scala Test: 3.0.5
  • scalatestplus-play: 3.1.2

Solution

  • I found the open Issue in Github:

    https://github.com/playframework/scalatestplus-play/issues/112