ScalaTest 1.8 is source (but not necessarily binary) compatible with previous releases. To upgrade from 1.7.1 or 1.7.2, you should only need to do a clean build.
This release includes the following enhancements, bug fixes, dependency changes, and deprecations:
path.FunSpec, a sister trait to
org.scalatest.FunSpecthat isolates tests by running each test in its own instance of the test class, and for each test, only executing the path leading to that test.
path.FreeSpec, a sister trait to
org.scalatest.FreeSpecthat isolates tests by running each test in its own instance of the test class, and for each test, only executing the path leading to that test.
ConfigMapWrapperSuite, a wrapper
Suitethat passes an instance of the config map to the constructor of the wrapped
Suitewhen run is invoked.
Eventually, which provides an
eventuallyconstruct that periodically retries executing a passed by-name parameter until it either succeeds or the configured timeout has been surpassed.
AsyncAssertions, which facilitates performing assertions outside the main test thread, such as assertions in callback methods that are invoked asynchronously. Trait
Waiterclass that you can use to orchestrate the inter-thread communication required to perform assertions outside the main test thread, and means to configure it.
Timeouts, which provides a
failAfterconstruct that allows you to specify a time limit for an operation passed as a by-name parameter, as well as a way to interrupt it if the operation exceeds its time limit.
TimeLimitedTests, which, when mixed into a suite class, establishes a time limit for its tests.
Interruptor, an abstract interface defining a strategy for interrupting an operation after a timeout expires (
Interruptors are used by traits
TimeLimitedTests.). Provided four built-in implementations:
org.scalatest.timepackage containing class
Span, used to express time spans in ScalaTest (
Spanis used by several traits in
SpanSugar, and several other supporting classes and objects.
ScaledTimeSpans, which provides a
scaledmethod that will scale a
Spanlarger or smaller by a
Doublefactor taken from a sister method,
spanScaleFactor. Added a
Runnerfor specifying the span scale factor (and corresponding commands for sbt and ant).
PatienceConfiguration, which provides methods and classes used to configure timeouts and, where relevant, the interval between retries.
IntegrationPatience, which overrides the implicit
PatienceConfigobject providing default values appropriate for unit testing (150 millisecond timeout and 15 millisecond interval) with one more appropriate for integration testing (15 second timeout and 150 millisecond interval).
Conductors, moved a copy of
Conductorthere, and made changes so that
Conductoris configured in a manner consistent with
org.scalatest.exceptions, and left deprecated type aliases in place of their old names. This change was done to declutter their former homes, so it is easier for users to focus on the classes and traits they are more likely to use day to day.
TestFailedDueToTimeoutException, a subclass of
TestFailedExceptionthrown by the
failAftermethod of trait
Timeoutsif it times out.
TimeoutField, a trait mixed into exceptions thrown as the result of a timeout.
PayloadField, a trait mixed into exceptions that can carry a payload (an arbitrary object that will be fired in the corresponding ScalaTest event, so it can be consumed by custom reporters). Had to add payload to the primary constructor of several existing exception types. Left the old form in place as an auxiliary constructor so existing code would continue to work.
ModifiablePayload, which indicates a
PayloadFieldexception type can modify its payload.
Payloads, which facilitates the inclusion of a payload in a thrown ScalaTest exception, so that payload object can be included in a corresponding ScalaTest event and interpreted by custom reporters.
applymethod of trait
Informer, to facilitate the inclusion of a payload in an
InfoProvidedevent. The parameter has type
Option[Any]with a default value of
None, so old code will continute to work.
Assertionsa result type, so it would pass through any value in case someone wanted that. Previously it was
AppendedClues, which provides an implicit conversion that places a
Any, enabling clue strings to be placed after a block of code that may throw an exception. This construct complements the
withClueconstruct provided in trait
Assertionsthat allows clue strings to be placed before a block of code.
java.awt.AWTErrorto facilitate running ScalaTest on Android. ScalaTest will continue to treat
java.awt.AWTErrors in the same way: they cause the suite to abort rather than the test to fail, but checking is now done based on the string class name to avoid the explicit reference that caused problems on Android.
runmethod in the
org.scalatestpackage object as an
applymethod in an
org.scalatest.runsingleton object. The client code and behavior are the same, but this implementation enabled the addition of a
mainmethod as well that provides the "simple runner".
mainmethod on the new
org.scalatest.runsingleton object. This application provides a better out-of-box experience for users getting started with ScalaTest, and an easier to remember way to run tests from the command line for experienced ScalaTest users.
Runner. Added a new lifecycle method to
styleNameto support this feature. ScalaTest style traits override
styleNameand return their fully qualified name as a string. If chosen styles is defined, ScalaTest style traits that are not among the chosen list will abort with a message complaining that the style trait is not one of the chosen styles instead of running its tests. Chosen styles is also supported by the ScalaTest ant task and
ScalaTestFramework(so accessible via sbt).
-q, ScalaTest will only load and inspect class files whose name ends in the suffix to see if they are runnable
Suites. Also added a
-Qoption to specify suffixes
theyas an alternative to
org.scalatest.path.FunSpec. (This enhancement was inspired by a blog post by Christoph Henkelmann.)
ScalaTestAntTask, and deprecated the old usages. After the deprecation cycle, will deprecate the capital forms in favor of lower case forms. The goal is to have
-pmean parallel execution (currently
-cmean custom reporter (currently
-r), and -r mean runpath (currently
-p). The new names will be more consistent and hopefully easier to remember.
GeneratorDrivenPropertyCheckswere not reporting the given parameter names if they were specified in combination with explicit generators passed to
forAll. Now they do.
PropertyCheckExceptions were not correctly modifying their message if used with
withClue. Now they do.
org.scalatest.concurrent.Conductorafter moving a copy of it to trait
Conductors. The purpose of this move was so that
Conductorcould be configured via
PatienceConfigurationand scaled by
ScaledTimeSpans, making it consistent with traits
org.scalatest.concurrent.ConductorMultiFixture, which accidentally escaped deprecation in 1.5 when the other "multi fixture" traits (in
org.scalatest.fixture) were deprecated.
org.scalatest.prop.TableDrivenPropertyCheckFailedException. These deprecations were to support moving most exception types to the new
org.scalatest.exceptionspackage. Old code using the old names will continue to work during the deprecation phase. An
org.scalatest.proppackage object was created to hold the deprecated type aliases for that package. This package object will also be removed at the end of the deprecation period (unless it acquires a new, non-deprecated member in the meantime).
ScalaTestAntTasksyntax) in favor of their new names (see the previous Enhancements section). The old names will continue to work during the deprecation cycle.
-tto run TestNG tests. This use of
-twas deprecated in 1.7 and replaced by
-b, because in ScalaTest 2.0
-twill be used to indicate a test name to run. To make sure the ground was clear for this new use in ScalaTest 2.0,
-twill print an error message and abort the run in ScalaTest 1.8. If you haven't already, you'll have to change uses of
-bto upgrade to ScalaTest 1.8.
org.scalatest.exceptions.PropertyCheckExceptionby making it abstract. It was supposed to be abstract, but as an oversight was left concrete. This is a breaking change that likely will not affect any users.
AbstractSuiteand overriding and making it final in many style traits. It was never intended that users would mix together core style traits, and likely it wouldn't compile in many cases anyway. But now for sure it won't compile in most cases.