Giter VIP home page Giter VIP logo

Comments (5)

MLG-ANolan avatar MLG-ANolan commented on June 7, 2024 5

Looking to do the same. Any suggestions?

from scalatestplus-play.

marcospereira avatar marcospereira commented on June 7, 2024 5

Hi @dpoetzsch,

Thanks for investigating this. Another solution is to declare GuiceOneAppPerSuite with a self-type for Suite instead of TestSuite (Suite is the parent type for both TestSuite and AsyncTestSuite):

trait GuiceOneAppPerSuite extends BaseOneAppPerSuite with GuiceFakeApplicationFactory {
  this: org.scalatest.Suite =>
}

That way, it should work when you mix GuiceOneAppPerSuite and AsyncTestSuite or TestSuite. If you want to give it a try and submit PR, let me know so I can help you by reviewing it. :-)

Best.

from scalatestplus-play.

tnielens avatar tnielens commented on June 7, 2024 3

For those looking for a quick hack, you can declare the async suite as a nested suite:

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

import scala.collection.immutable

class GuiceOneAppPerAsyncSuite extends TestSuite with GuiceOneAppPerSuite {

  val nestedSuite = new AsyncFlatSpec {
    // async tests here
  }

  override def nestedSuites: immutable.IndexedSeq[Suite] = Vector(nestedSuite)
}

from scalatestplus-play.

wuservices avatar wuservices commented on June 7, 2024 1

@marcospereira I'm also no Scala magician, but I was trying out your suggestion above to attempt this:

trait GuiceOneAppPerSuite extends BaseOneAppPerSuite with GuiceFakeApplicationFactory {
  this: org.scalatest.Suite =>
}

It seems like that won't work because BaseOneAppPerSuite extends TestSuiteMixin. Does this mean you're left with rewriting a bunch of the tree with async versions like @dpoetzsch's original suggestion?

from scalatestplus-play.

kwinter avatar kwinter commented on June 7, 2024

took at crack at this, moved TestSuite/TestSuiteMixin to Suite/SuiteMixin: #255

from scalatestplus-play.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.