IsInUITestHandler
public class IsInUITestHandler : Handler
Provides information whether the application is running under UI test environment.
Handler should be added to LaunchEnvironmentManager
.
Used key: AM_IS_IN_UI_TEST
/ AutoMateLaunchOptionKey.isInUITest
.
Supported values (case insensitive):
true
yes
1
false
no
0
Example:
let launchManager = LaunchEnvironmentManager()
let isInUITest = IsInUITestHandler()
launchManager.add(handler: isInUITest, for: .isInUITest)
launchManager.setup()
Later in the code, you can check whether the application is running in UI test environment, by using below example:
Example:
if isInUITest.inUITest {
...
}
Note
defaultIsInUITestHandler
singleton could be used intead of creating new instance of the IsInUITestHandler
.
Note
Launch environment for the handler can be set by the IsInUITestLaunchEnvironment
from the AutoMate project.
Note
IsInUITestHandler
should be used with the AM_IS_IN_UI_TEST
key, but its implementation doesn’t require to use it.
Any key provided to the LaunchEnvironmentManager.add(handler:for:)
method will be handled correctly.
Seealso
Seealso
-
Indicates whether the application is running in UI test environment.
Declaration
Swift
private(set) public var inUITest: Bool
-
Initialize
IsInUITestHandler
.Declaration
Swift
public init()
-
Handles value for the
AM_IS_IN_UI_TEST
key and provides information whether the application was run in the UI test environment.Note
IsInUITestHandler
should be used with theAM_IS_IN_UI_TEST
key, but its implementation doesn’t require to use it. Any key provided to theLaunchEnvironmentManager.add(handler:for:)
method will be handled correctly.Requires
Method support only given set of values (case insensitive):
true
yes
1
false
no
0
Declaration
Swift
public func handle(key: String, value: String)
Parameters
key
AM_IS_IN_UI_TEST
/AutoMateLaunchOptionKey.isInUITest
value
Value for the
key
.