IndexedMongoQueriesSupport
Causes queries which don't use an index to generate com.mongodb.MongoQueryException or com.mongodb.MongoWriteException containing error code 291 (for mongo 4.4+ and error code 2 with message 'No query solutions' previously).
Note, the notablescan option is a global server config. When running database tests with and without this trait, ensure that tests are not run in parallel.
Attributes
- Graph
-
- Supertypes
-
trait BeforeAndAfterAlltrait 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 after all of this suite's tests and nested suites have been run.
Defines a method to be run after all of this suite's tests and nested suites have been run.
This trait's implementation of run invokes this afterAll() method. This trait's implementation of this method does nothing.
Attributes
- Definition Classes
-
BeforeAndAfterAll
Defines a method to be run before any of this suite's tests or nested suites are run.
Defines a method to be run before any of this suite's tests or nested suites are run.
This trait's implementation of run invokes this beforeAll() method. This trait's implementation of this method does nothing.
Attributes
- Definition Classes
-
BeforeAndAfterAll
Inherited methods
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
Execute a suite surrounded by calls to beforeAll and afterAll.
Execute a suite surrounded by calls to beforeAll and afterAll.
This trait's implementation of this method ("this method") invokes beforeAll(ConfigMap) before executing any tests or nested suites and afterAll(ConfigMap) after executing all tests and nested suites. It runs the suite by invoking super.run, passing along the parameters passed to it.
If any invocation of beforeAll completes abruptly with an exception, this method will complete abruptly with the same exception. If any call to super.run completes abruptly with an exception, this method will complete abruptly with the same exception, however, before doing so, it will invoke afterAll. If afterAll also completes abruptly with an exception, this method will nevertheless complete abruptly with the exception previously thrown by super.run. If super.run returns normally, but afterAll completes abruptly with an exception, this method will complete abruptly with the same exception.
This method does not invoke either beforeAll or afterAll if runTestsInNewInstance is true so that any side effects only happen once per test if OneInstancePerTest is being used. In addition, if no tests are expected, then beforeAll and afterAll will be invoked only if the invokeBeforeAllAndAfterAllEvenIfNoTestsAreExpected flag is true. By default, this flag is false, so that if all tests are excluded (such as if the entire suite class has been marked with @Ignore), then side effects would happen only if at least one test will ultimately be executed in this suite or its nested suites.
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 the test started by this method has completed, and whether or not it failed . - Inherited from:
- BeforeAndAfterAll
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.
Runs a test.
Value parameters
- args
-
the
Argsfor this run - testName
-
the name of one test to execute.
Attributes
- Returns
-
a
Statusobject that indicates when the test started by this method has completed, and whether or not it failed . - Throws
-
NullArgumentException
if any of
testNameorargsisnull. - Inherited from:
- SuiteMixin
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
Flag to indicate whether to invoke beforeAll and afterAll even when there are no tests expected.
Flag to indicate whether to invoke beforeAll and afterAll even when there are no tests expected.
The default value is false, which means beforeAll and afterAll will not be invoked if there are no tests expected. Whether tests are expected is determined by invoking expectedTestCount passing in the passed filter. Because this count does not include tests excluded based on tags, such as ignored tests, this prevents any side effects in beforeAll or afterAll if no tests will ultimately be executed anyway. If you always want to see the side effects even if no tests are expected, override this val and set it to true.
Attributes
- Inherited from:
- BeforeAndAfterAll
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