/
DistributedTestSorter.scala
69 lines (64 loc) · 2.6 KB
/
DistributedTestSorter.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
* 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 events.Event
/**
* A sorter for the events of a suite's distributed tests.
*
* <p>
* This trait is used, for example, by <a href="ParallelTestExecution.html"><code>ParallelTestExecution</code></a> to sort the
* events of tests back into sequential order, with a timeout if an event takes too long.
* </p>
*/
trait DistributedTestSorter {
/**
* Indicates a test with the specified name is about to be distributed.
*
* <p>
* For example, trait <code>ParallelTestExecution</code> invokes this method prior to
* passing a suite that will execute the specified test to the <code>Distributor</code>.
* Even though the tests are run in parallel, the events for the tests will be reported
* in the order this method is invoked.
* </p>
*
* @throws IllegalArgumentException if the specified test name has already
* completed (was already passed to <code>distributingTest</code>), but its events
* have not yet been fully reported.
* @throws NullArgumentException if <code>testName</code> is null.
*
* @param testName the name of the test that has completed
*/
def distributingTest(testName: String): Unit
/**
* Report an event for a distributed test.
*
* @param testName the name of the distributed test that produced this event
* @param event the event to report
* @throws NullArgumentException if either <code>testName</code> or <code>event</code> is null.
*/
def apply(testName: String, event: Event): Unit
/**
* Indicates the events for the distributed test with the specified name have all been fired.
*
* @throws IllegalArgumentException if the specified test name was never distributed
* (<em>i.e.</em>, was never passed to <code>distributingTest</code>), or has already
* completed (was already passed to <code>completedTest</code>.
* @throws NullArgumentException if <code>testName</code> is null.
*
* @param testName the name of the test that has completed
*/
def completedTest(testName: String): Unit
}