Scoop API

scoop:scoop.test:0.1.0

src/execution/data.scoop

Selected production source · src/execution/data.scoop

1package scoop.test.execution
3/**
4 * The stage of test execution in which a failure occurred.
5 */
6public enum TestPhase {
7 /**
8 * Creating the test instance or its actions failed.
9 */
10 Initialization,
11 /**
12 * The setup action failed before the body could run.
13 */
14 BeforeTest,
15 /**
16 * The test body failed.
17 */
18 Body,
19 /**
20 * The cleanup action failed.
21 */
22 AfterTest }
24/**
25 * One test action paired with the source location used when an ordinary exception has no assertion
26 * location.
27 */
28public struct TestAction(
29 val call: () -> Unit,
30 val location: SourceLocation = currentSourceLocation()
33/**
34 * A test body with optional setup and cleanup actions. Cleanup runs after an initialized case even
35 * when setup or the body fails.
36 */
37public struct TestActions(
38 val body: TestAction,
39 val before: TestAction? = None,
40 val after: TestAction? = None
43/**
44 * A captured exception with its test phase and attributed source location.
45 */
46public struct TestFailure(
47 val phase: TestPhase,
48 val cause: Throwable,
49 val location: SourceLocation
52/**
53 * The completed result of executing one initialized test case.
54 */
55public enum TestResult {
56 /**
57 * Initialization and all configured test actions completed successfully.
58 */
59 Passed,
60 /**
61 * The primary failure and, when present, an additional cleanup failure.
62 */
63 Failed(TestFailure, TestFailure?)