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):
trueyes1falseno0
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_TESTkey and provides information whether the application was run in the UI test environment.Note
IsInUITestHandlershould be used with theAM_IS_IN_UI_TESTkey, 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):
trueyes1falseno0
Declaration
Swift
public func handle(key: String, value: String)Parameters
keyAM_IS_IN_UI_TEST/AutoMateLaunchOptionKey.isInUITestvalueValue for the
key.
IsInUITestHandler Class Reference