org.scalatest.Args.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.
/*
* Copyright 2001-2012 Artima, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.scalatest
/**
* Arguments bundle passed to four of ScalaTest's lifecycle methods: run
, runNestedSuites
,
* runTests
, and runTest
.
*
*
* The signatures of these methods, defined in trait Suite
, are:
*
*
*
* def run(testName: Option[String], args: Args)
* def runNestedSuites(args: Args)
* def runTests(testName: Option[String], args: Args)
* def runTess(testName: String, args: Args)
*
*
*
* The purpose of bundling these arguments into an Args
object instead of passing them in individually is to make the signature
* of these four lifecycle methods easier to read, and write, and remember, to make the methods more pleasant to override in user code.
*
*
* @param reporter the Reporter
to which results will be reported
* @param stopper the Stopper
that will be consulted to determine whether to stop execution early.
* @param filter a Filter
with which to filter tests based on their tags
* @param configMap a Map
of key-value pairs that can be used by the executing Suite
of tests.
* @param distributor an optional Distributor
, into which to put nested Suite
s to be executed
* by another entity, such as concurrently by a pool of threads. If None
, nested Suite
s will be executed sequentially.
* @param tracker a Tracker
tracking Ordinal
s being fired by the current thread.
* @param chosenStyles a (possibly empty) Set
of String
s specifying the run's chosen styles
* @param runTestInNewInstance a flag used to pass information between run methods
* in OneInstancePerTest
and ParallelTestExecution
.
* @param distributedTestSorter an optional DistributedTestSorter
used by ParallelTestExecution
to sort the events
* for the parallel-executed tests of one suite back into sequential order on the fly, with a timeout in case a test takes too long to complete
* @param distributedSuiteSorter an optional DistributedSuiteSorter
used by ParallelTestExecution
to ensure the events
* for the parallel-executed suites are sorted back into sequential order, with a timeout in case a suite takes to long to complete, even when tests are executed in parallel
*
* @throws NullPointerException if any passed parameter is null
.
*
*/
case class Args(
reporter: Reporter,
stopper: Stopper = Stopper.default,
filter: Filter = Filter.default,
configMap: Map[String, Any] = Map.empty,
distributor: Option[Distributor] = None,
tracker: Tracker = Tracker.default,
chosenStyles: Set[String] = Set.empty,
runTestInNewInstance: Boolean = false,
distributedTestSorter: Option[DistributedTestSorter] = None,
distributedSuiteSorter: Option[DistributedSuiteSorter] = None
) {
if (reporter == null)
throw new NullPointerException("reporter was null")
if (stopper == null)
throw new NullPointerException("stopper was null")
if (filter == null)
throw new NullPointerException("filter was null")
if (configMap == null)
throw new NullPointerException("configMap was null")
if (distributor == null)
throw new NullPointerException("distributor was null")
if (tracker == null)
throw new NullPointerException("tracker was null")
if (chosenStyles == null)
throw new NullPointerException("chosenStyles was null")
if (distributedTestSorter == null)
throw new NullPointerException("distributedTestSorter was null")
if (distributedSuiteSorter == null)
throw new NullPointerException("distributedSuiteSorter was null")
}