public class BaseState extends Object implements IBaseState
getLocator()
指定的测试对象,则基态将含有该测试对象的窗口前置,并立即返回找到的测试对象。CommonOptions.OPT_APPREADY_TIMEOUT
指定超时。默认超时值为 30 秒。要更改超时,可参见
Desktop.setOption(String, Object)
。您还可以在“脚本选项”对话框的“重放”选项卡中编辑“应用程序就绪超时”,
以更改 UI 中的超时。LaunchApplicationTimeoutException
异常。
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()
使用默认设置文件 "silk4j.settings" 中的信息创建一个基态。
|
BaseState(File silk4jSettingsFile)
使用给定的 .settings 文件中的信息创建一个基本状态。
|
BaseState(String silk4jFile)
使用给定的 .settings 文件中的信息创建一个基态。
|
BaseState(String executable,
String locator)
创建一个基态。
|
BaseState(String executable,
String commandLineArguments,
String locator)
创建带有附加命令行参数的基态.
|
BaseState(String executable,
String commandLineArguments,
String locator,
TechDomain... techDomains)
Deprecated.
从 Silk Test 15.5 开始已不再使用,而使用
BaseState(String, String, String) ,因为 Silk Test 会自动检测应该加载哪个 TechDomain。
|
BaseState(String executable,
String locator,
TechDomain... techDomains)
Deprecated.
从 Silk Test 15.5 开始已不再使用,而使用
BaseState(String, String) ,因为 Silk Test 会自动检测应该加载哪个 TechDomain。
|
Modifier and Type | Method and Description |
---|---|
<T extends TestObject> |
execute(Desktop desktop)
在由桌面指定的机器上执行基本状态。
|
String |
getCommandLineArguments()
当被测试应用程序没有在运行时,返回启动该应用程序时将会使用的附加命令行参数。
|
String |
getCommandLinePattern()
返回用于将代理附加到被测试应用程序中的命令行模式。
|
String |
getExecutable()
当被测试应用程序没有在运行时,返回启动该应用程序时将会使用的可执行文件。
|
String |
getExecutablePattern()
返回用于将代理附加到被测试应用程序中的可执行模式。
|
String |
getLocator()
返回指定基态应等待的测试对象的定位器。
|
String |
getMobileDeviceName()
Deprecated.
|
Set<TechDomain> |
getTechDomains()
Deprecated.
从 Silk Test 15.5 开始已不再使用。Silk Test 会自动检测应该加载哪个 TechDomain。
|
String |
getWorkingDirectory()
当被测试应用程序没有在运行时,返回启动该应用程序时使用的工作目录。
|
void |
setCommandLineArguments(String commandLineArguments)
当被测试应用程序没有在运行时,设置启动该应用程序时将会使用的附加命令行参数。
|
void |
setCommandLinePattern(String commandLinePattern)
覆盖用于附加到被测试应用程序中的命令行模式。
|
void |
setExecutable(String executable)
被测试应用程序没有在运行时,设置启动该程序时将会使用的可执行文件。
|
void |
setExecutablePattern(String executablePattern)
覆盖用于将代理附加到被测试应用程序中的默认可执行模式。
|
void |
setLocator(String locator)
设置用于指定基态应等待的测试对象的定位器。
|
void |
setMobileDeviceName(String mobileDeviceName)
Deprecated.
|
void |
setOption(String optionName,
Object optionValue)
设置一个代理选项。
|
void |
setWorkingDirectory(String workingDirectory)
覆盖启动被测试应用程序时的默认工作目录。
|
public static final String CONFIGURATION_NAME_SYSTEM_PROPERTY
public BaseState(String executable, String locator, TechDomain... techDomains)
BaseState(String, String)
,因为 Silk Test 会自动检测应该加载哪个 TechDomain。
executable
- 可执行文件。可包含 Windows 环境变量。
"C:/Program Files/SampleApplication/sampleApplication.exe"
"%ProgramFiles%/SampleApplication/sampleApplication.exe"
locator
- 指定在运行基态时要等待的对象。如:
"//Window[@caption='Calculator']"
techDomains
- 测试指定的应用程序所需的 tech 域。如:TechDomain.SWT
public BaseState(String executable, String locator)
executable
- 可执行文件。可包含 Windows 环境变量。
"C:/Program Files/SampleApplication/sampleApplication.exe"
"%ProgramFiles%/SampleApplication/sampleApplication.exe"
locator
- 指定在运行基态时要等待的对象。如:
"//Window[@caption='Calculator']"
public BaseState(String executable, String commandLineArguments, String locator, TechDomain... techDomains)
BaseState(String, String, String)
,因为 Silk Test 会自动检测应该加载哪个 TechDomain。
executable
- 可执行文件。可包含 Windows 环境变量。
"C:/Program Files/SampleApplication/sampleApplication.exe"
"%ProgramFiles%/SampleApplication/sampleApplication.exe"
commandLineArguments
- 如:"-debug"locator
- 指定在运行基态时要等待的对象。如:
"//Window[@caption='Calculator']"
techDomains
- 测试指定的应用程序所需的 tech 域。如:TechDomain.SWT
public BaseState(String executable, String commandLineArguments, String locator)
executable
- 可执行文件。可包含 Windows 环境变量。
"C:/Program Files/SampleApplication/sampleApplication.exe"
"%ProgramFiles%/SampleApplication/sampleApplication.exe"
commandLineArguments
- 如:"-debug"locator
- 指定在运行基态时要等待的对象。如:
"//Window[@caption='Calculator']"
public BaseState()
public BaseState(File silk4jSettingsFile)
silk4jSettingsFile
- public BaseState(String silk4jFile)
silk4jFile
- public String getExecutable()
public void setExecutable(String executable)
executable
- 被测试应用程序没有在运行时,启动该程序时将会使用的可执行文件。
@Deprecated public String getMobileDeviceName()
@Deprecated public void setMobileDeviceName(String mobileDeviceName)
mobileDeviceName
- public String getCommandLineArguments()
public void setCommandLineArguments(String commandLineArguments)
commandLineArguments
- 当被测试应用程序没有在运行时,启动该应用程序时将会使用的附加命令行参数
public String getExecutablePattern()
public void setExecutablePattern(String executablePattern)
C:/MyApplication.exe
会产生默认模式 */MyApplication.exe
。executablePattern
- 用于附加到测试应用程序的可执行模式
public String getCommandLinePattern()
public void setCommandLinePattern(String commandLinePattern)
commandLinePattern
- 用于附加到被测试应用程序中的命令行模式
public String getLocator()
public void setLocator(String locator)
locator
- 指定基态应等待的测试对象的定位器
public String getWorkingDirectory()
public void setWorkingDirectory(String workingDirectory)
workingDirectory
- 要设置的工作目录。可以包含 Windows 环境变量。
"C:/temp/test"
"%TEMP%/test"
public void setOption(String optionName, Object optionValue)
baseState.setOption(CommonOptions.OPT_WAIT_RESOLVE_OBJDEF, true)
optionName
- 选项名称。关于可用的选项列表,可参见 CommonOptions
。optionValue
- 选项的值。
public Set<TechDomain> getTechDomains()
public <T extends TestObject> T execute(Desktop desktop)
IBaseState
execute
in interface IBaseState
desktop
- 桌面Copyright 2009-2012 Micro Focus. All Rights Reserved.