/
TestConfig.java
179 lines (158 loc) · 5.48 KB
/
TestConfig.java
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
package io.quarkus.deployment.dev.testing;
import java.time.Duration;
import java.util.List;
import java.util.Optional;
import io.quarkus.runtime.annotations.ConfigGroup;
import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigRoot;
/**
* This is used currently only to suppress warnings about unknown properties
* when the user supplies something like: -Dquarkus.test.profile=someProfile or -Dquarkus.test.native-image-profile=someProfile
* <p>
* TODO refactor code to actually use these values
*/
@ConfigRoot
public class TestConfig {
/**
* If continuous testing is enabled.
*
* The default value is 'paused', which will allow you to start testing
* from the console or the Dev UI, but will not run tests on startup.
*
* If this is set to 'enabled' then testing will start as soon as the
* application has started.
*
* If this is 'disabled' then continuous testing is not enabled, and can't
* be enabled without restarting the application.
*
*/
@ConfigItem(defaultValue = "paused")
public Mode continuousTesting;
/**
* If output from the running tests should be displayed in the console.
*/
@ConfigItem(defaultValue = "false")
public boolean displayTestOutput;
/**
* Tags that should be included for continuous testing.
*/
@ConfigItem
public Optional<List<String>> includeTags;
/**
* Tags that should be excluded by default with continuous testing.
*
* This is ignored if include-tags has been set.
*
* Defaults to 'slow'
*/
@ConfigItem(defaultValue = "slow")
public Optional<List<String>> excludeTags;
/**
* Tests that should be included for continuous testing. This is a regular expression.
*/
@ConfigItem
public Optional<String> includePattern;
/**
* Tests that should be excluded with continuous testing. This is a regular expression.
*
* This is ignored if include-pattern has been set.
*
*/
@ConfigItem
public Optional<String> excludePattern;
/**
* Disable the testing status/prompt message at the bottom of the console
* and log these messages to STDOUT instead.
*
* Use this option if your terminal does not support ANSI escape sequences.
*/
@ConfigItem(defaultValue = "false")
public boolean basicConsole;
/**
* Disable color in the testing status and prompt messages.
*
* Use this option if your terminal does not support color.
*/
@ConfigItem(defaultValue = "false")
public boolean disableColor;
/**
* If test results and status should be displayed in the console.
*
* If this is false results can still be viewed in the dev console.
*/
@ConfigItem(defaultValue = "true")
public boolean console;
/**
* Disables the ability to enter input on the console.
*
*/
@ConfigItem(defaultValue = "false")
public boolean disableConsoleInput;
/**
* Changes tests to use the 'flat' ClassPath used in Quarkus 1.x versions.
*
* This means all Quarkus and test classes are loaded in the same ClassLoader,
* however it means you cannot use continuous testing.
*
* Note that if you find this necessary for your application then you
* may also have problems running in development mode, which cannot use
* a flat class path.
*/
@ConfigItem(defaultValue = "false")
public boolean flatClassPath;
/**
* Duration to wait for the native image to built during testing
*/
@ConfigItem(defaultValue = "PT5M")
Duration nativeImageWaitTime;
/**
* The profile to use when testing the native image
*/
@ConfigItem(defaultValue = "prod")
String nativeImageProfile;
/**
* Profile related test settings
*/
@ConfigItem
Profile profile;
/**
* Configures the hang detection in @QuarkusTest. If no activity happens (i.e. no test callbacks are called) over
* this period then QuarkusTest will dump all threads stack traces, to help diagnose a potential hang.
*
* Note that the initial timeout (before Quarkus has started) will only apply if provided by a system property, as
* it is not possible to read all config sources until Quarkus has booted.
*/
@ConfigItem(defaultValue = "10m")
Duration hangDetectionTimeout;
/**
* The type of test to run, this can be either:
*
* quarkus-test: Only runs {@code @QuarkusTest} annotated test classes
* unit: Only runs classes that are not annotated with {@code @QuarkusTest}
* all: Runs both, running the unit tests first
*
*/
@ConfigItem(defaultValue = "all")
TestType type;
@ConfigGroup
public static class Profile {
/**
* The profile (dev, test or prod) to use when testing using @QuarkusTest
*/
@ConfigItem(name = ConfigItem.PARENT, defaultValue = "test")
String profile;
/**
* The tags this profile is associated with.
* When the {@code quarkus.test.profile.tags} System property is set (its value is a comma separated list of strings)
* then Quarkus will only execute tests that are annotated with a {@code @TestProfile} that has at least one of the
* supplied (via the aforementioned system property) tags.
*/
@ConfigItem(defaultValue = "")
Optional<List<String>> tags;
}
public enum Mode {
PAUSED,
ENABLED,
DISABLED
}
}