All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.scalatest.concurrent.IntegrationPatience.scala Maven / Gradle / Ivy

There is a newer version: 2.0.M6-SNAP27
Show newest version
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 ParameterDefault 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 {
 *   // ...
 * }
 * 
* * @param timeout the maximum amount of time to retry before giving up and throwing * TestFailedException. * @param interval the amount of time to sleep between each attempt * * @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 }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy