Documentos de Académico
Documentos de Profesional
Documentos de Cultura
BY
Value Labs
1. Silk test software is divided into two parts: silk test host and silk test agent. The host software
provides the user with functionality to create plans, test scripts etc, while the agent software
interacts directly with the GUI (or drives the application under test).
[In short, Agent is required on the machine where u want to run the script. While host is what u
2. There are two kinds of applications you might automate with silk test.
a) Web based
Here, we are not discussing about automation of web based application. There are lots of
similarities, so anyone who understands automating a desktop application can learn web based
b. Then write (or record) test scripts (.t files) and call these from the plan file (.pln files).
When the script is run or we do some recording, the agent software is automatically
launched (can be observed it in the taskbar) as this is the software which does all
a) First Click on File -> New, then select “Test Frame” in the file types listed and click ok.
b) You shall find the new test frame dialog box, here, you shall find a list of applications
that are open, including the program manager. Select the application whose frame you
that application and then switch back to silk test to see it listed in the dialog box.
5. Now, let us create a frame file for notepad. As such when you select the notepad application
in the dialog box mentioned in step 4, it automatically creates a frame file for this. But this frame
file does not include the class descriptions for the dialog boxes that are invoked when we click on
one of the menu items (file->open, for ex). Save the frame file that is automatically created with
name X.
6. Now, Let us study this inc file before proceeding any further. The inc file starts with a very
points to the home page of your application or the main window of the application(to which u have
pointed in the dialog box of step 4).When the test fails, this is treated as the base state. [After we
run the test, it can be observed in the result file a statement saying: default base state is closing
this window etc, this means that silk is trying to bring back the UI to this wMainWindow state to
ensure that the next state works fine. Default base state is explained later]
7. The next statement you see would look something like this:
This declaration identifies an object in the application under test. This window is a keyword.
MainWin is the class and Notepad is the name of the object here. An object is essentially seen
as a container for the other objects that are declared in the window: wMainWindow which we
discussed in step 6, is essentially pointing to this window as we can see. MainWin is the class for
8. If we expand this (window MainWin Notepad), we shall find the following statement
[ ] "$C:\WINNT\system32\notepad.exe"
multi tag statement. Other than differences in syntax both are the same. These statements are
used by the “Silk Agent” to identify the GUI object at runtime. There are 5 types of tags as in the
table below:
Prior text ^Find What: The closest static text above the check box.
In this particular case, the notepad’s caption and its id (see that id starts with $ and caption is just
the string) are used to identify the window. We shall find similar statements for the other objects
[ ] tag "File"
This statement simply says that there is an object with identifier “File” and which is an object of
the class “Menu”. Further it also says that this object is to be identified by the tag “File”, which is
the caption is “File”. Also, since this is “inside” the Notepad object, this is contained in it.
9. The sDir constant contains the working directory of the application when it is started and the
sCmdLine constant contains the application’s exe. This is used to invoke the application. The
wMainwin will identify the main window. And in this main window sCmdLine constant is used to
invoke it.
10. The wStartup constant is commented out. This is used if when the application is invoked an
additional window appears before the main window’s appearance. For example, for some
window. This logon window needs to be handled. In such cases we record the logon window
separately and assign the identifier of this window object to wStartup. Let us discuss what shall
11. The lwLeaveopen constant is commented too. This is a set of windows we do not want the
recovery system to close when arriving at the default base state. Usually when a test case fails
(or ends), the silk recovery system comes into play.There is an inc file with name defaults.inc in
the silk test program directory. This contains the routines for recovery system. That is it contains
the DefaultBaseState function which does the clean up in recovery process. There are other
scripts like DefaultScriptEntry, DefaultScriptExit etc . These functions are called before a test
script entry, and at exit etc. lwLeaveOpen constant stops the default base state from closing
12. What is default base state? Default base state is an application state. That is , suppose u do
some operations and at the end of those operations you are in an application state. We can
define application states (by specifying how to arrive at them) and make specific test cases start
from such application states. Default base state is the application state where the test cases start
by default. By default this is the main window. But, this may be modified, as we shall see soon.
13. The rest of the statements are simply Menu object declarations. Each Menu object
declaration contains the declarations for MenuItems. If you look into each of these statements
14. We also have one MessageBox object declaration of MessageBoxClass. This is for message
Boxes. This is included by default, as message boxes may pop up any time while a windows
application is running.
listed in the use files text box in Options Runtime Options. If you are using web based
applications make sure to select the correct browser type in this runtime options dialog box. If you
are not using any browser, make sure to set the browser in runtime options dialog to none.
[ ] wMainWindow.File.Open.Pick()
Now. Open is an object of MenuItem type. This MenuItem class will have lots of functions. See
the help for the list. You can use these functions on it. Also, in order to navigate in the editor of
these .t files, we will have to use Alt + Left arrow to “go in” and Alt + Right Arrow to move out.
Note this since we do not have { and } as in c++ to state what all is inside an if statement, say.
The only way we can ensure this, therefore is by indenting the lines accordingly. For example, in
17. If you have run this particular program the result file automatically appears.
[ ] Closing Notepad.DialogBox("Open")
Default base state is invoked and finally restored, so that the next test case may run. As I already
18. When in Results mode, the silk test menu is different. There is a menu item Results that is
added. The .res file is by default saved in the program directory of silk. This path may be changed
through runtime options. Options RuntimeOptions, Results, enter the directory in the text box
here. There is also an option to mention the history size. This may be varied too. This is the
results with the current ones. You can try this after creating the plan fine and calling this .t file
from there.
19. We could have recorded the test case using the Record Actions or Record TestCase
options. But we chose to write it manually, coz we think we are good programmers ;).
20. Let us now proceed to record the File open dialog box also. To record the File open dialog
box and add it to the .inc file. Open the .inc file, Invoke the notepad and the Fileopen dialog box
and select Record WindowDeclaration. Point to the Open DialogBox and press “Alt + Ctrl” to
stop recording. Copy it to clip board and paste it to the .inc file. Now the dialogbox is recognized.
21. Let us now rerun the .t file. We get the following result:
[ ] Closing Open
Just see that the last statement is no more Closing Notepad.DialogBox(“Open”) ! This is coz silk
is now recognizing the Open dialog box. You wont get this this way if you either do not include the
correct frame file in Runtime Options, or if you have not compiled (using Run Compile all).
22. Let us now get back to the .inc file for a moment. We have an additional statement: window
DialogBox Open. This appeared when we recorded the window declarations. You might have
straight away recognized what this means. It is simply the declaration for this object whose
identifier is “Open” and whose class is “dialogbox”. Classes are created much the same way as
we do in c++. We may write our own classes. Let us try this one. Let us write a class called
statements
which means we are deriving our new class from the previous one. Then we may add
functions to this class in place of the “statements” . So, here is the piece of code I have added
As you see, I have also added a function validateme() to this class which prints “Jagan:
Validation” to the output screen. Also this particular class inherits all the methods and objects of
23. I have included the above definition of DialogBox1 class in the .inc file just after the
wMainwin statement. Let us now try this. Instead of having Open as an object of DialogBox , we
may make it an object of Dialogbox1. This is pretty simple, just modify the window statement of
Open as below:
24. Having done this, let also modify the .t file to call this validateme function as below:
[ ] wMainWindow.File.Open.Pick()
[ ] Open.validateme()
[ ] Jagans : Validation
[ ] Closing Open
Note the second line; it is printing the statement in validateme function. So that serves our
purpose.
26. Let us now add this test case to a test plan . This is very simple too. First create a plan file ,
by file New option and selecting a TestPlan in the file types. Here is what I wrote in the test
plan file:
[ ] script: test.t
[]
[ ] testcase: t()
[ ] wMainWindow.File.Open.Pick()
[ ] print(param)
[ ] Open.validateme()
[ ] script: test.t
[]
[ ] $param = 5
28. We can create a new appstate. This means, our test case can be made to start from a
different state than the default base state. The following change in the .t file would do it for us:
[ ] wMainWindow.File.Open.Pick()
[]
[]
[ ] //wMainWindow.File.Open.Pick()
[ ] print(param)
[ ] Open.validateme()
If we run this, it runs just like the previous program! That is despite the fact that the first
Platform Independent
Silk Test doesn’t care about how the application is created, in which software the application is
written, what kind of design is used, which browser it is being worked, in which operating system
All that needs for an application to be tested using silktest is that it needs a frame (like window)
Browser Independent
There are various kinds of browsers used by various people for running their applications. The
user may use any browser of his choice to test the standard application. Each and every browser
acts differently with different applications. They show the same page differently. The web objects
SilkTest just looks at these browser contents as objects and hence they cannot avoid any
images, texts, that they are not identifiable. Also we can write a test in one browser and run it in
any other browser (to some extend). i.e, using SilkTest, we can do cross browser testing.
With minor modifications, your tests are robust enough to support different browsers and different
Technology Independent
Silktest does not care how the application was built. It seamlessly works with the different web
Start writing the silk scripts. Capture the window declarations (.inc file) and write the .t file. Say if
you are capturing the declarations from Internet Explorer & run successfully on it. As we captured
1. Declare all the window names and its objects (used in writing scripts) starting from the first
window.
2. In the File-> New option in the menu bar, select the test frame.
3. In the resulting ‘new Test Frame’ dialog box, specify the path of the executable file of your
application.
4. After submitting that dialog box, the silktest will automatically create a declaration file with the
Before you start testing the java applications or applets, you have to set the java classpath.
• Point to a Java archive (.jar file) that contains the software the powers SilkTest’s Java
support for JDK 1.2 and JRE 1.2. This file is called SilkTest_Java2.jar.)
• If you will use only JDK 1.2 for testing, you can activate Java support for JDK 1.2 by
If you do not copy SilkTest_Java2.jar to your JDK 1.2 install directory, you must point to it from
your CLASSPATH.