org.scalatest.concurrent.IntegrationPatience.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scalatest_2.9.0 Show documentation
Show all versions of scalatest_2.9.0 Show documentation
ScalaTest is a free, open-source testing toolkit for Scala and Java
programmers.
package org.scalatest.concurrent
import org.scalatest.time.{Millis, Seconds, Span}
/**
* Stackable modification trait for PatienceConfiguration
that provides default timeout and interval
* values appropriate for integration testing.
*
*
* The default values for the parameters are:
*
*
*
* Configuration Parameter Default Value
*
*
* timeout
*
*
* scaled(15 seconds)
*
*
*
*
* interval
*
*
* scaled(150 milliseconds)
*
*
*
*
*
* The default values of both timeout and interval are passed to the scaled
method, inherited
* from ScaledTimeSpans
, so that the defaults can be scaled up
* or down together with other scaled time spans. See the documentation for trait ScaledTimeSpans
* for more information.
*
*
*
* Mix this trait into any class that uses PatienceConfiguration
(such as classes that mix in Eventually
* or AsyncAssertions
) to get timeouts tuned towards integration testing, like this:
*
*
*
* class ExampleSpec extends FeatureSpec with Eventually with IntegrationPatience {
* // ...
* }
*
*
* @author Bill Venners
* @author Chua Chee Seng
*/
trait IntegrationPatience extends AbstractPatienceConfiguration { this: PatienceConfiguration =>
private val defaultPatienceConfig: PatienceConfig =
PatienceConfig(
timeout = scaled(Span(15, Seconds)),
interval = scaled(Span(150, Millis))
)
/**
* Implicit PatienceConfig
value providing default configuration values suitable for integration testing.
*/
implicit abstract override val patienceConfig: PatienceConfig = defaultPatienceConfig
}