trait BaseOneServerPerSuite extends TestSuiteMixin with ServerProvider
- Alphabetic
- By Inheritance
- BaseOneServerPerSuite
- ServerProvider
- TestSuiteMixin
- SuiteMixin
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def expectedTestCount(filter: Filter): Int
- Definition Classes
- SuiteMixin
- abstract def nestedSuites: IndexedSeq[Suite]
- Definition Classes
- SuiteMixin
- abstract def rerunner: Option[String]
- Definition Classes
- SuiteMixin
- abstract def suiteId: String
- Definition Classes
- SuiteMixin
- abstract def suiteName: String
- Definition Classes
- SuiteMixin
- abstract def tags: Map[String, Set[String]]
- Definition Classes
- SuiteMixin
- abstract def testDataFor(testName: String, theConfigMap: ConfigMap): TestData
- Definition Classes
- SuiteMixin
- abstract def testNames: Set[String]
- Definition Classes
- SuiteMixin
- abstract val styleName: String
- Definition Classes
- SuiteMixin
- Annotations
- @deprecated
- Deprecated
(Since version 3.1.0) The styleName lifecycle method has been deprecated and will be removed in a future version of ScalaTest with no replacement.
Concrete Value Members
- implicit lazy val app: Application
An implicit instance of
Application
.An implicit instance of
Application
.- Definition Classes
- → ServerProvider
- final def port: Int
The port used by the
TestServer
.The port used by the
TestServer
.- Definition Classes
- ServerProvider
- implicit def portNumber: PortNumber
Implicit
PortNumber
instance that wrapsport
.Implicit
PortNumber
instance that wrapsport
. The value returned fromportNumber.value
will be same as the value ofport
.- returns
the configured port number, wrapped in a
PortNumber
- Definition Classes
- ServerProvider
- def run(testName: Option[String], args: Args): Status
Invokes
start
on a newTestServer
created with theApplication
provided byapp
and the port number defined byport
, places theApplication
and port number into theConfigMap
under the keysorg.scalatestplus.play.app
andorg.scalatestplus.play.port
, respectively, to make them available to nested suites; callssuper.run
; and lastly ensures theApplication
and test server are stopped after all tests and nested suites have completed.Invokes
start
on a newTestServer
created with theApplication
provided byapp
and the port number defined byport
, places theApplication
and port number into theConfigMap
under the keysorg.scalatestplus.play.app
andorg.scalatestplus.play.port
, respectively, to make them available to nested suites; callssuper.run
; and lastly ensures theApplication
and test server are stopped after all tests and nested suites have completed.- testName
an optional name of one test to run. If
None
, all relevant tests should be run. I.e.,None
acts like a wildcard that means run all relevant tests in thisSuite
.- args
the
Args
for this run- returns
a
Status
object that indicates when all tests and nested suites started by this method have completed, and whether or not a failure occurred.
- Definition Classes
- BaseOneServerPerSuite → SuiteMixin
Trait that provides a new
Application
and runningTestServer
instance per ScalaTestSuite
.By default, this trait creates a new
Application
for theSuite
using default parameter values, which is made available via theapp
field defined in this trait and a newTestServer
for theSuite
using the port number provided by itsport
field and theApplication
provided by itsapp
field. If yourSuite
needs aApplication
with non-default parameters, overrideapp
. If it needs a different port number, overrideport
.This
TestSuiteMixin
trait's overriddenrun
method callsstart
on theTestServer
before executing theSuite
via a call tosuper.run
. In addition, it places a reference to theApplication
provided byapp
into theConfigMap
under the keyorg.scalatestplus.play.app
and to the port number provided byport
under the keyorg.scalatestplus.play.port
. This allows any nestedSuite
s to access theSuite
'sApplication
and port number as well, most easily by having the nestedSuite
s mix in the ConfiguredServer trait. On the status returned bysuper.run
, this trait's overriddenrun
method registers a call tostop
on theTestServer
to be executed when theStatus
completes, and returns the sameStatus
. This ensure theTestServer
will continue to execute until all nested suites have completed, after which theTestServer
will be stopped.Here's an example that demonstrates some of the services provided by this trait:
If you have many tests that can share the same
Application
andTestServer
, and you don't want to put them all into one test class, you can place them into differentSuite
classes. These will be your nested suites. Create a master suite that extendsOneServerPerSuite
and declares the nestedSuite
s. Annotate the nested suites with@DoNotDiscover
and have them extendConfiguredServer
. Here's an example: