org.scalatest.Args.scala Maven / Gradle / Ivy
/*
* Copyright 2001-2013 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
import org.scalactic.Requirements._
import org.scalatest.time.{Seconds, Span}
/**
* 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 runTest(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, write, and remember, as well as 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 ConfigMap
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 NullArgumentException if any passed parameter is null
.
*
*/
case class Args(
reporter: Reporter,
stopper: Stopper = Stopper.default,
filter: Filter = Filter.default,
configMap: ConfigMap = ConfigMap.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
) {
requireNonNull(reporter, stopper, filter, configMap, distributor, tracker,
chosenStyles, distributedTestSorter, distributedSuiteSorter)
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy