-
Notifications
You must be signed in to change notification settings - Fork 432
/
FBXCTestConfiguration.h
201 lines (158 loc) · 6.5 KB
/
FBXCTestConfiguration.h
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <Foundation/Foundation.h>
#import <FBControlCore/FBControlCore.h>
NS_ASSUME_NONNULL_BEGIN
/**
A String Enum for Test Types.
*/
typedef NSString *FBXCTestType NS_STRING_ENUM;
/**
An UITest.
*/
extern FBXCTestType const FBXCTestTypeUITest;
/**
An Application Test.
*/
#define FBXCTestTypeApplicationTestValue @"application-test"
extern FBXCTestType const FBXCTestTypeApplicationTest;
/**
A Logic Test.
*/
extern FBXCTestType const FBXCTestTypeLogicTest;
/**
The Listing of Testing of tests in a bundle.
*/
extern FBXCTestType const FBXCTestTypeListTest;
@class FBXCTestDestination;
@class FBXCTestShimConfiguration;
/**
The Base Configuration for all tests.
*/
@interface FBXCTestConfiguration : NSObject <NSCopying>
/**
The Default Initializer.
This should not be called directly.
*/
- (instancetype)initWithShims:(nullable FBXCTestShimConfiguration *)shims environment:(NSDictionary<NSString *, NSString *> *)environment workingDirectory:(NSString *)workingDirectory testBundlePath:(NSString *)testBundlePath waitForDebugger:(BOOL)waitForDebugger timeout:(NSTimeInterval)timeout;
/**
The Shims to use for relevant test runs.
*/
@property (nonatomic, copy, nullable, readonly) FBXCTestShimConfiguration *shims;
/**
The Environment Variables for the Process-Under-Test that is launched.
*/
@property (nonatomic, copy, readonly) NSDictionary<NSString *, NSString *> *processUnderTestEnvironment;
/**
The Directory to use for files required during the execution of the test run.
*/
@property (nonatomic, copy, readonly) NSString *workingDirectory;
/**
The Test Bundle to Execute.
*/
@property (nonatomic, copy, readonly) NSString *testBundlePath;
/**
The Type of the Test Bundle.
*/
@property (nonatomic, copy, readonly) FBXCTestType testType;
/**
YES if the test execution should pause on launch, waiting for a debugger to attach.
NO otherwise.
*/
@property (nonatomic, assign, readonly) BOOL waitForDebugger;
/**
The Timeout to wait for the test execution to finish.
*/
@property (nonatomic, assign, readonly) NSTimeInterval testTimeout;
/**
Gets the Environment for a Subprocess.
Will extract the environment variables from the appropriately prefixed environment variables.
Will strip out environment variables that will confuse subprocesses if this class is called inside an 'xctest' environment.
@param entries the entries to add in
@return the subprocess environment
*/
- (NSDictionary<NSString *, NSString *> *)buildEnvironmentWithEntries:(NSDictionary<NSString *, NSString *> *)entries;
@end
@protocol FBXCTestProcessExecutor;
/**
A Test Configuration, specialized to the listing of Test Bundles.
*/
@interface FBListTestConfiguration : FBXCTestConfiguration
/**
The Designated Initializer.
*/
+ (instancetype)configurationWithShims:(FBXCTestShimConfiguration *)shims environment:(NSDictionary<NSString *, NSString *> *)environment workingDirectory:(NSString *)workingDirectory testBundlePath:(NSString *)testBundlePath runnerAppPath:(nullable NSString *)runnerAppPath waitForDebugger:(BOOL)waitForDebugger timeout:(NSTimeInterval)timeout;
@property (nonatomic, copy, readonly) NSString *runnerAppPath;
@end
/**
A Test Configuration, specialized in running of Tests.
*/
@interface FBTestManagerTestConfiguration : FBXCTestConfiguration
/**
The Path to the Application Hosting the Test.
*/
@property (nonatomic, copy, readonly) NSString *runnerAppPath;
/**
The Path to the test target Application.
*/
@property (nonatomic, copy, readonly, nullable) NSString *testTargetAppPath;
/**
The test filter for which test to run.
Format: <testClass>/<testMethod>
*/
@property (nonatomic, copy, readonly, nullable) NSString *testFilter;
/**
The path of log file that we dump all os_log to.
(os_log means Apple's unified logging system (https://developer.apple.com/documentation/os/logging),
we use this name to avoid confusing between various logging systems)
*/
@property (nonatomic, copy, readonly, nullable) NSString *osLogPath;
/**
The path of video recording file that record the whole test run.
*/
@property (nonatomic, copy, readonly, nullable) NSString *videoRecordingPath;
/**
A list of test artifcats filename globs (see https://en.wikipedia.org/wiki/Glob_(programming) ) that
any files in app's container folder matching them will be copied out to a temporary path before
simulator is cleaned up.
*/
@property (nonatomic, copy, readonly, nullable) NSArray<NSString *> *testArtifactsFilenameGlobs;
/**
The Designated Initializer.
*/
+ (instancetype)configurationWithShims:(FBXCTestShimConfiguration *)shims environment:(NSDictionary<NSString *, NSString *> *)environment workingDirectory:(NSString *)workingDirectory testBundlePath:(NSString *)testBundlePath waitForDebugger:(BOOL)waitForDebugger timeout:(NSTimeInterval)timeout runnerAppPath:(NSString *)runnerAppPath testTargetAppPath:(nullable NSString *)testTargetAppPath testFilter:(nullable NSString *)testFilter videoRecordingPath:(nullable NSString *)videoRecordingPath testArtifactsFilenameGlobs:(nullable NSArray<NSString *> *)testArtifactsFilenameGlobs osLogPath:(nullable NSString *)osLogPath;
@end
typedef NS_OPTIONS(NSUInteger, FBLogicTestMirrorLogs) {
/* Does not mirror logs */
FBLogicTestMirrorNoLogs = 0,
/* Mirrors logs to files */
FBLogicTestMirrorFileLogs = 1 << 0,
/* Mirrors logs to logger */
FBLogicTestMirrorLogger = 1 << 1,
};
/**
A Test Configuration, specialized to the running of Logic Tests.
*/
@interface FBLogicTestConfiguration : FBXCTestConfiguration
/**
The Filter for Logic Tests.
*/
@property (nonatomic, copy, nullable, readonly) NSString *testFilter;
/**
How the logic test logs will be mirrored
*/
@property (nonatomic, readonly) FBLogicTestMirrorLogs mirroring;
/**
The Directory to use for storing logs generated during the execution of the test run.
*/
@property (nonatomic, nullable, copy, readonly) NSString *logDirectoryPath;
/**
The Designated Initializer.
*/
+ (instancetype)configurationWithShims:(FBXCTestShimConfiguration *)shims environment:(NSDictionary<NSString *, NSString *> *)environment workingDirectory:(NSString *)workingDirectory logDirectoryPath:(nullable NSString *)logDirectoryPath testBundlePath:(NSString *)testBundlePath waitForDebugger:(BOOL)waitForDebugger timeout:(NSTimeInterval)timeout testFilter:(nullable NSString *)testFilter mirroring:(FBLogicTestMirrorLogs)mirroring;
@end
NS_ASSUME_NONNULL_END