CleanMongoCollectionSupport
Calls prepareDatabase before each test, ensuring a clean database
Attributes
- Graph
-
- Supertypes
-
trait BeforeAndAfterEachtrait SuiteMixintrait MongoSupporttrait ScalaFuturestrait Futurestrait PatienceConfigurationtrait AbstractPatienceConfigurationtrait ScaledTimeSpansclass Objecttrait Matchableclass AnyShow all
- Known subtypes
-
trait DefaultPlayMongoRepositorySupport[A]
- Self type
-
TestSuite
Members list
Type members
Inherited classlikes
Concept trait for futures, instances of which are passed to the whenReady methods of trait Futures.
Concept trait for futures, instances of which are passed to the whenReady methods of trait Futures.
See the documentation for trait Futures for the details on the syntax this trait provides for testing with futures.
Attributes
- Inherited from:
- Futures
- Supertypes
-
class Objecttrait Matchableclass Any
Configuration object for asynchronous constructs, such as those provided by traits Eventually and Waiters.
Configuration object for asynchronous constructs, such as those provided by traits Eventually and Waiters.
The default values for the parameters are:
| Configuration Parameter | Default Value |
|---|---|
timeout |
scaled(150 milliseconds) |
interval |
scaled(15 milliseconds) |
Value parameters
- interval
-
the amount of time to sleep between each check of the status of an asynchronous operation when polling
- timeout
-
the maximum amount of time to wait for an asynchronous operation to complete before giving up and throwing
TestFailedException.
Attributes
- Inherited from:
- AbstractPatienceConfiguration
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Value members
Concrete methods
Defines a method to be run before each of this suite's tests.
Defines a method to be run before each of this suite's tests.
This trait's implementation of runTest invokes this method before invoking super.runTest. Thus this method can be used to set up a test fixture needed by each test, before each test begins execution.
This trait's implementation of this method does nothing.
Attributes
- Definition Classes
-
BeforeAndAfterEach
Inherited methods
Defines a method to be run after each of this suite's tests.
Defines a method to be run after each of this suite's tests.
This trait's implementation of runTest invokes this method after invoking super.runTest. Thus this method can be used to tear down a test fixture needed by each test, after each test completes execution.
This trait's implementation of this method does nothing.
Attributes
- Inherited from:
- BeforeAndAfterEach
Attributes
- Inherited from:
- MongoSupport
Attributes
- Inherited from:
- MongoSupport
The total number of tests that are expected to run when this Suite's run method is invoked.
The total number of tests that are expected to run when this Suite's run method is invoked.
Value parameters
- filter
-
a
Filterwith which to filter tests to count based on their tags
Attributes
- Inherited from:
- SuiteMixin
Attributes
- Inherited from:
- MongoSupport
Returns an Interval configuration parameter containing the passed value, which specifies the amount of time to sleep after a retry.
Returns an Interval configuration parameter containing the passed value, which specifies the amount of time to sleep after a retry.
Attributes
- Inherited from:
- PatienceConfiguration
Attributes
- Inherited from:
- MongoSupport
An immutable IndexedSeq of this SuiteMixin object's nested Suites. If this SuiteMixin contains no nested Suites, this method returns an empty IndexedSeq.
An immutable IndexedSeq of this SuiteMixin object's nested Suites. If this SuiteMixin contains no nested Suites, this method returns an empty IndexedSeq.
Attributes
- Inherited from:
- SuiteMixin
Attributes
- Inherited from:
- MongoSupport
The fully qualified name of the class that can be used to rerun this suite.
The fully qualified name of the class that can be used to rerun this suite.
Attributes
- Inherited from:
- SuiteMixin
Runs this suite of tests.
Runs this suite of tests.
Value parameters
- args
-
the
Argsfor this run - testName
-
an optional name of one test to execute. If
None, all relevant tests should be executed. I.e.,Noneacts like a wildcard that means execute all relevant tests in thisSuite.
Attributes
- Returns
-
a
Statusobject that indicates when all tests and nested suites started by this method have completed, and whether or not a failure occurred. - Throws
-
NullArgumentException
if any passed parameter is
null. - Inherited from:
- SuiteMixin
Runs zero to many of this suite's nested suites.
Runs zero to many of this suite's nested suites.
Value parameters
- args
-
the
Argsfor this run
Attributes
- Returns
-
a
Statusobject that indicates when all nested suites started by this method have completed, and whether or not a failure occurred. - Throws
-
NullArgumentException
if
argsisnull. - Inherited from:
- SuiteMixin
Runs a test surrounded by calls to beforeEach() and afterEach().
Runs a test surrounded by calls to beforeEach() and afterEach().
This trait's implementation of this method ("this method") invokes beforeEach() before running each test and afterEach() after running each test. It runs each test by invoking super.runTest, passing along the two parameters passed to it.
If any invocation of beforeEach() completes abruptly with an exception, this method will complete abruptly with the same exception, however, before doing so, it will invoke afterEach(). If beforeEach() returns normally, but the subsequent call to super.runTest completes abruptly with an exception, this method will complete abruptly with the same exception, however, before doing so, it will invoke afterEach(). If afterEach() completes abruptly with an exception, this method will nevertheless complete abruptly with an exception previously thrown by either beforeEach() or super.runTest. If both beforeEach() and super.runTest return normally, but afterEach() completes abruptly with an exception, this method will complete abruptly with the exception thrown by afterEach().
The reason this method invokes afterEach() even if beforeEach() or super.runTest throws an exception is to reduce the chance that a resource acquired by beforeEach() or super.runTest prior to completing abruptly with the exception is not cleaned up and therefore leaked.
Value parameters
- args
-
the
Argsfor this run - testName
-
the name of one test to run.
Attributes
- Returns
-
a
Statusobject that indicates when the test started by this method has completed, and whether or not it failed . - Inherited from:
- BeforeAndAfterEach
Runs zero to many of this suite's tests.
Runs zero to many of this suite's tests.
Value parameters
- args
-
the
Argsfor this run - testName
-
an optional name of one test to run. If
None, all relevant tests should be run. I.e.,Noneacts like a wildcard that means run all relevant tests in thisSuite.
Attributes
- Returns
-
a
Statusobject that indicates when all tests started by this method have completed, and whether or not a failure occurred. - Throws
-
NullArgumentException
if either
testNameorargsisnull. - Inherited from:
- SuiteMixin
Scales the passed Span by the Double factor returned by spanScaleFactor.
Scales the passed Span by the Double factor returned by spanScaleFactor.
The Span is scaled by invoking its scaledBy method, thus this method has the same behavior: The value returned by spanScaleFactor can be any positive number or zero, including a fractional number. A number greater than one will scale the Span up to a larger value. A fractional number will scale it down to a smaller value. A factor of 1.0 will cause the exact same Span to be returned. A factor of zero will cause Span.ZeroLength to be returned. If overflow occurs, Span.Max will be returned. If underflow occurs, Span.ZeroLength will be returned.
Attributes
- Throws
-
IllegalArgumentException
if the value returned from
spanScaleFactoris less than zero - Inherited from:
- ScaledTimeSpans
The factor by which the scaled method will scale Spans.
The factor by which the scaled method will scale Spans.
The default implementation of this method will return the span scale factor that was specified for the run, or 1.0 if no factor was specified. For example, you can specify a span scale factor when invoking ScalaTest via the command line by passing a -F argument to Runner.
Attributes
- Inherited from:
- ScaledTimeSpans
A string ID for this Suite that is intended to be unique among all suites reported during a run.
A string ID for this Suite that is intended to be unique among all suites reported during a run.
The suite ID is intended to be unique, because ScalaTest does not enforce that it is unique. If it is not unique, then you may not be able to uniquely identify a particular test of a particular suite. This ability is used, for example, to dynamically tag tests as having failed in the previous run when rerunning only failed tests.
Attributes
- Returns
-
this
Suiteobject's ID. - Inherited from:
- SuiteMixin
A user-friendly suite name for this Suite.
A user-friendly suite name for this Suite.
This trait's implementation of this method returns the simple name of this object's class. This trait's implementation of runNestedSuites calls this method to obtain a name for Reports to pass to the suiteStarting, suiteCompleted, and suiteAborted methods of the Reporter.
Attributes
- Returns
-
this
Suiteobject's suite name. - Inherited from:
- SuiteMixin
A Map whose keys are String names of tagged tests and whose associated values are the Set of tag names for the test. If a test has no associated tags, its name does not appear as a key in the returned Map. If this Suite contains no tests with tags, this method returns an empty Map.
A Map whose keys are String names of tagged tests and whose associated values are the Set of tag names for the test. If a test has no associated tags, its name does not appear as a key in the returned Map. If this Suite contains no tests with tags, this method returns an empty Map.
Subclasses may override this method to define and/or discover tags in a custom manner, but overriding method implementations should never return an empty Set as a value. If a test has no tags, its name should not appear as a key in the returned Map.
Attributes
- Inherited from:
- SuiteMixin
Provides a TestData instance for the passed test name, given the passed config map.
Provides a TestData instance for the passed test name, given the passed config map.
This method is used to obtain a TestData instance to pass to withFixture(NoArgTest) and withFixture(OneArgTest) and the beforeEach and afterEach methods of trait BeforeAndAfterEach.
Value parameters
- testName
-
the name of the test for which to return a
TestDatainstance - theConfigMap
-
the config map to include in the returned
TestData
Attributes
- Returns
-
a
TestDatainstance for the specified test, which includes the specified config map - Inherited from:
- SuiteMixin
A Set of test names. If this Suite contains no tests, this method returns an empty Set.
A Set of test names. If this Suite contains no tests, this method returns an empty Set.
Although subclass and subtrait implementations of this method may return a Set whose iterator produces String test names in a well-defined order, the contract of this method does not required a defined order. Subclasses are free to implement this method and return test names in either a defined or undefined order.
Attributes
- Inherited from:
- SuiteMixin
Returns a Timeout configuration parameter containing the passed value, which specifies the maximum amount to wait for an asynchronous operation to complete.
Returns a Timeout configuration parameter containing the passed value, which specifies the maximum amount to wait for an asynchronous operation to complete.
Attributes
- Inherited from:
- PatienceConfiguration
Note, this changes the notablescan option, which is a global server config. If tests set this to different values, ensure they are not run in parallel.
Note, this changes the notablescan option, which is a global server config. If tests set this to different values, ensure they are not run in parallel.
Attributes
- Inherited from:
- MongoSupport
Queries the passed future repeatedly until it either is ready, or a configured maximum amount of time has passed, sleeping a configured interval between attempts; and when ready, passes the future's value to the passed function.
Queries the passed future repeatedly until it either is ready, or a configured maximum amount of time has passed, sleeping a configured interval between attempts; and when ready, passes the future's value to the passed function.
The maximum amount of time in milliseconds to tolerate unsuccessful attempts before giving up is configured by the timeout field of the PatienceConfig passed implicitly as the last parameter. The interval to sleep between attempts is configured by the interval field of the PatienceConfig passed implicitly as the last parameter.
If the eitherValue method of the underlying Scala future returns a scala.Some containing a scala.util.Failure containing a java.util.concurrent.ExecutionException, and this exception contains a non-null cause, that cause will be included in the TestFailedException as its cause. The ExecutionException will be be included as the TestFailedException's cause only if the ExecutionException's cause is null.
Value parameters
- config
-
an
PatienceConfigobject containingtimeoutandintervalparameters that are unused by this method - fun
-
the function to which pass the future's value when it is ready
- future
-
the future to query
Attributes
- Returns
-
the result of invoking the
funparameter - Inherited from:
- Futures
Queries the passed future repeatedly until it either is ready, or a configured maximum amount of time has passed, sleeping a configured interval between attempts; and when ready, passes the future's value to the passed function.
Queries the passed future repeatedly until it either is ready, or a configured maximum amount of time has passed, sleeping a configured interval between attempts; and when ready, passes the future's value to the passed function.
The maximum amount of time in milliseconds to tolerate unsuccessful attempts before giving up is configured by the timeout field of the PatienceConfig passed implicitly as the last parameter. The interval to sleep between attempts is configured by the value contained in the passed interval parameter.
Value parameters
- config
-
an
PatienceConfigobject containingtimeoutandintervalparameters that are unused by this method - fun
-
the function to which pass the future's value when it is ready
- future
-
the future to query
- interval
-
the
Intervalconfiguration parameter
Attributes
- Returns
-
the result of invoking the
funparameter - Inherited from:
- Futures
Queries the passed future repeatedly until it either is ready, or a configured maximum amount of time has passed, sleeping a configured interval between attempts; and when ready, passes the future's value to the passed function.
Queries the passed future repeatedly until it either is ready, or a configured maximum amount of time has passed, sleeping a configured interval between attempts; and when ready, passes the future's value to the passed function.
The maximum amount of time in milliseconds to tolerate unsuccessful queries before giving up and throwing TestFailedException is configured by the value contained in the passed timeout parameter. The interval to sleep between attempts is configured by the interval field of the PatienceConfig passed implicitly as the last parameter.
If the eitherValue method of the underlying Scala future returns a scala.Some containing a scala.util.Failure containing a java.util.concurrent.ExecutionException, and this exception contains a non-null cause, that cause will be included in the TestFailedException as its cause. The ExecutionException will be be included as the TestFailedException's cause only if the ExecutionException's cause is null.
Value parameters
- config
-
an
PatienceConfigobject containingtimeoutandintervalparameters that are unused by this method - fun
-
the function to which pass the future's value when it is ready
- future
-
the future to query
- timeout
-
the
Timeoutconfiguration parameter
Attributes
- Returns
-
the result of invoking the
funparameter - Inherited from:
- Futures
Queries the passed future repeatedly until it either is ready, or a configured maximum amount of time has passed, sleeping a configured interval between attempts; and when ready, passes the future's value to the passed function.
Queries the passed future repeatedly until it either is ready, or a configured maximum amount of time has passed, sleeping a configured interval between attempts; and when ready, passes the future's value to the passed function.
The maximum amount of time to tolerate unsuccessful queries before giving up and throwing TestFailedException is configured by the value contained in the passed timeout parameter. The interval to sleep between attempts is configured by the value contained in the passed interval parameter.
If the eitherValue method of the underlying Scala future returns a scala.Some containing a scala.util.Failure containing a java.util.concurrent.ExecutionException, and this exception contains a non-null cause, that cause will be included in the TestFailedException as its cause. The ExecutionException will be be included as the TestFailedException's cause only if the ExecutionException's cause is null.
Value parameters
- config
-
an
PatienceConfigobject containingtimeoutandintervalparameters that are unused by this method - fun
-
the function to which pass the future's value when it is ready
- future
-
the future to query
- interval
-
the
Intervalconfiguration parameter - timeout
-
the
Timeoutconfiguration parameter
Attributes
- Returns
-
the result of invoking the
funparameter - Inherited from:
- Futures
Inherited fields
Attributes
- Inherited from:
- MongoSupport
Attributes
- Inherited from:
- MongoSupport
Attributes
- Inherited from:
- MongoSupport
Deprecated and Inherited fields
The styleName lifecycle method has been deprecated and will be removed in a future version of ScalaTest.
The styleName lifecycle method has been deprecated and will be removed in a future version of ScalaTest.
This method was used to support the chosen styles feature, which was deactivated in 3.1.0. The internal modularization of ScalaTest in 3.2.0 will replace chosen styles as the tool to encourage consistency across a project. We do not plan a replacement for styleName.
Attributes
- Deprecated
- true
- Inherited from:
- SuiteMixin
Implicits
Inherited implicits
Implicitly converts a scala.concurrent.Future[T] to FutureConcept[T], allowing you to invoke the methods defined on FutureConcept on a Scala Future, as well as to pass a Scala future to the whenReady methods of supertrait Futures.
Implicitly converts a scala.concurrent.Future[T] to FutureConcept[T], allowing you to invoke the methods defined on FutureConcept on a Scala Future, as well as to pass a Scala future to the whenReady methods of supertrait Futures.
See the documentation for supertrait Futures for the details on the syntax this trait provides for testing with Java futures.
If the eitherValue method of the underlying Scala future returns a scala.Some containing a scala.util.Failure containing a java.util.concurrent.ExecutionException, and this exception contains a non-null cause, that cause will be included in the TestFailedException as its cause. The ExecutionException will be be included as the TestFailedException's cause only if the ExecutionException's cause is null.
The isExpired method of the returned FutureConcept will always return false, because the underlying type, scala.concurrent.Future, does not support the notion of expiration. Likewise, the isCanceled method of the returned FutureConcept will always return false, because the underlying type, scala.concurrent.Future, does not support the notion of cancelation.
Value parameters
- scalaFuture
-
a
scala.concurrent.Future[T]to convert
Attributes
- Returns
-
a
FutureConcept[T]wrapping the passedscala.concurrent.Future[T] - Inherited from:
- ScalaFutures
Implicit PatienceConfig value providing default configuration values.
Implicit PatienceConfig value providing default configuration values.
To change the default configuration, override or hide this def with another implicit PatienceConfig containing your desired default configuration values.
Attributes
- Inherited from:
- PatienceConfiguration