public class BaseState extends Object implements IBaseState
getLocator() is found the base state brings the window
containing the test object to the front and returns the found test object immediately.CommonOptions.OPT_APPREADY_TIMEOUT. The default value for the timeout is 30 seconds. For changing the timeout see
Desktop.setOption(String, Object). You can also change the timeout in the UI by editing the Application ready timeout in the
Replay tab of the Script Options dialog box.LaunchApplicationTimeoutException is thrown.
String executable = "C:/MyWindowsFormsApplication.exe";
String locator = "//Window[@caption='My Window Title']";
BaseState baseState = new BaseState(executable, locator, TechDomain.WINDOWS_FORMS);
Window mainWindow = baseState.execute(desktop);
| Modifier and Type | Field and Description |
|---|---|
static String |
CONFIGURATION_NAME_SYSTEM_PROPERTY |
| Constructor and Description |
|---|
BaseState()
Creates a base state with the information from the default settings file "silk4j.settings".
|
BaseState(File silk4jSettingsFile)
Creates a base state with the information from a given .settings file.
|
BaseState(String silk4jFile)
Creates a base state with the information from a given .settings file.
|
BaseState(String executable,
String locator)
Creates an base state.
|
BaseState(String executable,
String commandLineArguments,
String locator)
Creates an base state with additional command line arguments.
|
BaseState(String executable,
String commandLineArguments,
String locator,
TechDomain... techDomains)
Deprecated.
Deprecated since Silk Test 15.5. Use
BaseState(String, String, String) instead because Silk Test automatically detects which techdomains should be loaded.
|
BaseState(String executable,
String locator,
TechDomain... techDomains)
Deprecated.
Deprecated since Silk Test 15.5. Use
BaseState(String, String) instead because Silk Test automatically detects which techdomains should be loaded.
|
| Modifier and Type | Method and Description |
|---|---|
<T extends TestObject> |
execute(Desktop desktop)
Executes the base state on the machine as specified by the desktop.
|
String |
getCommandLineArguments()
Returns the additional command line arguments that will be used when starting the application under test if it is not already running.
|
String |
getCommandLinePattern()
Returns the command line pattern to be used for attaching the Agent to the application under test.
|
String |
getExecutable()
Returns the executable that will be used when starting the application under test if it is not already running.
|
String |
getExecutablePattern()
Returns the executable pattern to be used for attaching the Agent to the application under test.
|
String |
getLocator()
Returns the locator that specifies the test object for which the base state should wait.
|
String |
getMobileDeviceName()
Deprecated.
Deprecated as of Silk Test 17.0.
|
Set<TechDomain> |
getTechDomains()
Deprecated.
Deprecated since Silk Test 15.5. Silk Test automatically detects which techdomains should be loaded.
|
String |
getWorkingDirectory()
Returns the working directory that is used when starting the application under test if it is not already running.
|
void |
setCommandLineArguments(String commandLineArguments)
Sets the additional command line arguments that will be used when starting the application under test if it is not already running.
|
void |
setCommandLinePattern(String commandLinePattern)
Overwrites the default command line pattern to be used for attaching to the application under test.
|
void |
setExecutable(String executable)
Sets the executable that will be used when starting the application under test if it is not already running.
|
void |
setExecutablePattern(String executablePattern)
Overwrites the default executable pattern to be used for attaching to the application under test.
|
void |
setLocator(String locator)
Sets the locator that specifies the test object for which the base state should wait
|
void |
setMobileDeviceName(String mobileDeviceName)
Deprecated.
Deprecated as of Silk Test 17.0.
|
void |
setOption(String optionName,
Object optionValue)
Sets an Agent option.
|
void |
setWorkingDirectory(String workingDirectory)
Overwrites the default working directory for launching the application under test.
|
public static final String CONFIGURATION_NAME_SYSTEM_PROPERTY
public BaseState(String executable, String locator, TechDomain... techDomains)
BaseState(String, String) instead because Silk Test automatically detects which techdomains should be loaded.
executable - the executable. Can contain Windows environment variables.
"C:/Program Files/SampleApplication/sampleApplication.exe""%ProgramFiles%/SampleApplication/sampleApplication.exe"locator - specified the object to wait for when running the base state, e.g
"//Window[@caption='Calculator']"techDomains - the tech domains required for testing the specified application. e.g TechDomain.SWTpublic BaseState(String executable, String locator)
executable - the executable. Can contain Windows environment variables.
"C:/Program Files/SampleApplication/sampleApplication.exe""%ProgramFiles%/SampleApplication/sampleApplication.exe"locator - specified the object to wait for when running the base state, e.g
"//Window[@caption='Calculator']"
public BaseState(String executable, String commandLineArguments, String locator, TechDomain... techDomains)
BaseState(String, String, String) instead because Silk Test automatically detects which techdomains should be loaded.
executable - the executable. Can contain Windows environment variables.
"C:/Program Files/SampleApplication/sampleApplication.exe""%ProgramFiles%/SampleApplication/sampleApplication.exe"commandLineArguments - e.g "-debug"locator - specified the object to wait for when running the base state, e.g
"//Window[@caption='Calculator']"techDomains - the tech domains required for testing the specified application. e.g TechDomain.SWTpublic BaseState(String executable, String commandLineArguments, String locator)
executable - the executable. Can contain Windows environment variables.
"C:/Program Files/SampleApplication/sampleApplication.exe""%ProgramFiles%/SampleApplication/sampleApplication.exe"commandLineArguments - e.g "-debug"locator - specified the object to wait for when running the base state, e.g
"//Window[@caption='Calculator']"
public BaseState()
public BaseState(File silk4jSettingsFile)
silk4jSettingsFile - public BaseState(String silk4jFile)
silk4jFile - public String getExecutable()
public void setExecutable(String executable)
executable - the executable that will be used when starting the application under test if it is not already running.
@Deprecated public String getMobileDeviceName()
@Deprecated public void setMobileDeviceName(String mobileDeviceName)
mobileDeviceName - public String getCommandLineArguments()
public void setCommandLineArguments(String commandLineArguments)
commandLineArguments - the additional command line arguments that will be used when starting the application under test if it is not already running
public String getExecutablePattern()
public void setExecutablePattern(String executablePattern)
C:/MyApplication.exe results in the
default pattern */MyApplication.exe.executablePattern - the executable pattern to be used for attaching to the application under test
public String getCommandLinePattern()
public void setCommandLinePattern(String commandLinePattern)
commandLinePattern - the command line pattern to be used for attaching to the application under test
public String getLocator()
public void setLocator(String locator)
locator - the locator that specifies the test object for which the base state should wait
public String getWorkingDirectory()
public void setWorkingDirectory(String workingDirectory)
workingDirectory - the workingDirectory to set. Can contain Windows environment variables.
"C:/temp/test""%TEMP%/test"public void setOption(String optionName, Object optionValue)
baseState.setOption(CommonOptions.OPT_WAIT_RESOLVE_OBJDEF, true)optionName - The name of the option. For a list of available options see CommonOptions.optionValue - The value of the option.
public Set<TechDomain> getTechDomains()
public <T extends TestObject> T execute(Desktop desktop)
IBaseStateexecute in interface IBaseStatedesktop - The desktopCopyright 2009-2012 Micro Focus. All Rights Reserved.