[SilkTest]Overview of tags
来源:互联网 发布:武汉java培训机构名单 编辑:程序博客网 时间:2024/05/01 23:50
When to record classes
Consider these criteria when deciding whether to record classes for Java objects. When you record classes, SilkTest derives tags from the Java class name.
Am I testing only predefined Java classes?
If you are testing only predefined Java classes, then you do not need to record additional classes. Check the list of predefined Java classes to be sure. If you want to access native methods for predefined Java classes, then you must remove the existing definition and re-record the class.
Am I testing visible custom controls?
If you are testing custom Java controls that are not predefined, then you must record classes for these controls. In this case, the custom controls are visible, but appear as CustomWin objects. After you record the class, you can retrieve information about any number of instances(objects) of that class.
Do I want to test custom controls that are currently ignored?
To maintain efficiency during the recording process, SilkTest ignores custom Java controls that are not considered relevant for testing, such as containers or panels. Ignored objects are not recognized at all by SilkTest, not even as CustomWin objects.
Even so, you can expose and record classes for ignored Java objects in standone Java applications or in Java applets that you consider important for testing purposes. See Recording classes for ignored Java objects.
Have I modified an existing class definition?
If you add, delete or modify any native methods or parameters for a custom Java class, you need to either re-record the class or modify your class include file to reflect the changes.
multitag statement
Action
In a window declaration, defines one or more tags that the Agent uses internally to uniquely identify the object at runtime. By default, the Agent generates multitag statements for GUI objects when you record window declarations.
Note
Never use the tag in your scripts to refer to an object; always use the object's identifier.
Syntax
[gui-specifier] multitag tag-string
[tag-string]
...
Variable Description gui-specifier Optional. Specifies the GUIs that the statement applies to.
See window declaration. If omitted, the statement applies to all GUIs. tag-string A STRING expression that evaluates to the object's tag.
You can specify as many tag-strings as you want. The tag can be expressed in several ways, as described below.
Forms for the tag-string argument
The tag-string argument can express the object's tag in one of five ways:
Tag type Description Caption The caption or label as it appears to the user. Prior text The closest static text above or to the left of the object. You must use the ^ character to preface a prior text tag. Index The order(from top left to bottom right) in relation to its sibling objects of the same class. Index tags must begin with # character. Window ID GUI-specific ID. You must use the $ cahracter to preface a window Id tag. Location The physical location, expressed as a pair of (x, y) coordinates. you must use the @ character to preface a loation tag.
Example
The check box in the Find dialog in the TextEditor has these possible tags(displayed inthe record Window Declarations dialog):
Tag type Description Comment Caption Case sensitive The label for the check box. Prior text ^Find What: The closest static text above the check box. Index #1 Window ID $1041 GUI-specific tag. Location @(57, 65) (x, y) location of the check box in the dialog
What is recorded by default
By defult, when you generate window declarations, the Agent generates tags based on the object's caption(if it has one) and window ID(if it has one).
Specifying additional tag-strings
You can specify as many tag-strings as you want in a multitag statement. You can even specify more than one value for each tag type. For example, if a control's caption can change dynamically, you would want to specify each valid caption in its tag, such as:
multitag "Yes"
"OK"
The Agent would find the pushbutton if it had either caption.
How to choose a tag-string form
The caption form for the window tag is the most portable. Along with the index, this is the form that the Agent uses by default when it creates tags for recorded declarations.
The Agent automatically generates valid, unique tags. However, in some situations you might want to edit the tags. The following table describes which form of the tag to use in specific situations:
Note: Avoid using the index format for objects of the MoveableWin class. This syntax may result in your choosing a window at random in cases where there are multiple windows.
The GUI object's parent can vary at runtime. For example, the Open dialog can have more than one application as a parent at runtime. Specify that the parent is the currently active application, for example:
"~ActiveApp/[DialogBox]Open" You want to assign the tag dynamically at runtime.
Replace the tag with a function call. For example, where CreateTag is a user-defined function that returns a string:
MenuItem CheckBox
tag CreateTag(this)
...
STRING CreateTag(WINDOW wWindowIdentifier)
switch (wWindowIdentifier)
case TestApp.Control.CheckBox
return "Check Box|$200"
"[DialogBox]Open/[TextField]First Name/..."
"[DialogBox]Open/[PushButton]New Search/..."
"[DialogBox]Open/[ComBox] #2/..." The GUI object has no label or caption and the position(and hence the index) can change dynamically at runtime. The window ID. The Gui object has a label or caption, but you don't want to use it as the tag because it is changeable for this object. The index or prior text. You need to internationalize your application. The window ID, or replace the tag with a variable. The GUI object is a graphical control like a tool bar. The location. You want to invoke a dialog, not the main window, when your application starts. For example, you want to invoke a dialog named Login. Change the class of the dialog from DialogBox to MainWin, and then specify the real class in the tag, for example:
"[DialogBox]Login" More than one instance of the window might be displayed at one time Use the instance syntax, which takes the form tag-string[n], where [n] refers to the instance. [1] refers to the instance of the window that is closest to the top on the desktop, [2] refers to the instance that is next highest to the top, and so on.
For example, you could have one declaration for the window whose tag is "MyWindow[1]" and another declaration whose tag is "MyWindows[2]". With these declarations, you can record and play back tests against two instances of the sam window. Note that when an instance of the window becomes active, it automatically becomes MyWindow[1].
The Agent automatically accounts for dynamic strings in the caption of a main window(for example, file names) and replaces these dynamic strings with the wildcard character "*".
Tag syntax
The examples in the table above use these syntactic elements:
- [SilkTest]Overview of tags
- [SilkTest]Overview of application states
- SilkTest高级进阶系列4-Window Tags和Window Identifiers
- SilkTest
- Overview of ASP.NET
- Overview of the Book
- Overview of Domain Models
- Overview of Models
- Overview of GSM protocol
- Overview of H323
- Overview of ACE
- Overview of webapp framework
- OVERVIEW OF EJB
- Overview of COCOMO
- An Overview of WebCore
- Overview of Soak testing
- Overview of malware inspection
- An overview of Android
- 世界排名在20多位的无名小站
- tomcat5.0 目录结构
- ASP.NET连接远程ORACLE数据库 远端:liux 系统
- Patterns in SOME –Iterator
- java集合类
- [SilkTest]Overview of tags
- Linux(Unix)时钟同步ntpd服务配置方法
- 61条面向对象设计的经验原则
- session and cookie
- 中文意思:人家说着玩儿,你怎么就认起真来了.2006年日语等级报名网站、报名与考试时间!
- Patterns in SOME – Command
- 出现 org.hibernate.NonUniqueObjectException 错误的解决方法
- 把数据库文件变成XML文件
- WiMAX的主要优势及发展现状(news_20060801)