Silk test Interview questions Set 1
 
Freshers Resources

QA & Testing

Data WareHousingComputer ScienceAnalysis  DesignOperating Systems
C++MainframesSap/AbapDatabasesHRVB
JavaJobsC#

.Net

VC++ASP

Some methodologies to implement...
Creating an Include file
How to split different kind of script files?
How to make Window Declaration?
How to create Classes?
How to use Structures?
Creating a Script file
How to create a Testcase?
Different methods & statements
What kind of Testcases can be created?
Creating a Test Suite
How to create a Suite file?
SilkTest installation tips
Run the Silk Test setup from the CD or through the Network.
The SilkTest software is available in the 'Firesip\Europa\software\silktest5.0.1\silktest' directory in your Network Neighbourhood.
Get in to the above folder and select the setup.exe file to start the installation.
During installation, it will ask for the licence file. Set the path ''Firesip\Europa\software\silktest5.0.1\licence' for the "licence.dat" file.
In the installation process, it will ask for the SilkTest/ SilkTest Agent only option. Select the Silk Test option if you are installing this for testing applications in the stand-alone machine.
For the ‘Will you be testing browsers?’ message box, select “Yes” if you are going to test web based applications.
It will ask for the default browser option. Select the appropriate Browser you want to test the application using Silk Test. Note that you are allowed to select only one Browser option. By default SilkTest goes fine with Netscape browsers.
After installing, it will open the SilkTest tool with the Quick start wizard open. The quickstart wizard will assist you in creating various silk files. If you are a first time user of silktest, then continue with that.
Getting started with the QuickStart Wizard
If you are using SilkTest with the testplan editor, you can use the QuickStart Wizard, which greatly simplifies the four steps of automated testing.
When you start SilkTest the first time (or whenever you start and have no open windows), the QuickStart Wizard is displayed automatically. You can also invoke the wizard at any time by selecting File/New and clicking the QuickStart Wizard icon.
You can use the QuickStart wizard to:
1 Create a testplan.
You simply name the file (giving it the .pln extension) and its directory.
2 Create a test frame,
which contains descriptions of the GUI objects in your application that you want to test.As prompted, you simply open your application and open the various windows and dialogs that you want to test in the application. The wizard automatically records all the declarations in a file called frame.inc. You don’t have to do any coding.
3 Record testcases.
You name the testcase and provide a description for the testplan, then simply record the testcase. Again, you don’t have to do any coding. The wizard automatically saves the testcase in a script (.t) file with the same name as the testplan.
4 Run testcases.
Procedure To use the wizard:
1 Invoke the wizard by selecting File/New and clicking the QuickStart Wizard icon. Now you will name a new testplan, which will organize and manage your tests.
2 Click Next.
3 Name the file edit.pln and click Next. The next step is to record the test frame, which defines all the windows, dialogs, menus, and so on that you want to test.
4 To create a new test frame, leave New Test Frame selected and click Next. At this point, the wizard lists all the open (running and not minimized) applications. If Text Editor is not open, you can open it now (it is in the directory where you installed SilkTest). After you open the Text Editor, click on the QuickStart Wizard title bar to see Text Editor added to the list of applications.
5 Select Text Editor and click Next.
6 The Capture Windows panel displays, describing the procedure.
7 Click Next.
8 Now you simply open a document window and open all the dialogs that you want to test in the Text Editor. When you place the mouse pointer on a window or dialog, the wizard records all the declarations that SilkTest needs in a file called frame.inc in the same directory as your testplan.
9 When you have finished capturing the windows and dialogs in Text Editor, click Return to Wizard in the Capturing New Windows dialog. Now that you have created your test frame, you are ready to create a testcase.
10 Click Next twice.
11 Name the test FindBox and enter the description “Verify controls in Find dialog.” Click Next. Your test is now being recorded, as indicated by the Record Status window on your screen.
12 Now go to Text Editor, select Search/Find to open the Find dialog, place your mouse pointer over the dialog’s title bar, and press Ctrl+Alt to verify its state. The Verify Window dialog displays. Click OK to verify all properties for the dialog. Close the Find dialog (to return to your base state), then click Done in the Record Status window. You return to the Wizard and are asked to confirm that the test is what you want.
13 Click Next.
14 Run the test by clicking the Run Test Button.
15 The wizard reports the results. You can move the wizard to the side and look at the results file that is created whenever you run a test.
16 In the wizard, click Next to save your testcase. The testcase is saved in a script (.t) file with the same name as the testplan (in this case, edit.t).
17 Click Close to close the wizard. You see a window containing the results file from the test you just ran. In another window is the testplan.
Source code for a simple Java application
The given java application contains a button, and on clicking it will display the number of times it has been clicked.
Copy the code given below in a text editor.
Save the code as SwingApplication.java
Go to the command prompt.
Compile the code by giving the command 'javac SwingApplication.java' in the command prompt.
Run it by giving the command 'java SwingApplication'.
Now leave the application as it is and Create a new Test Frame.
Specify the path of the source file in Runtime -> Extentions.
Write the test script using that test frame.
-----------------------------------------------------------------------------------------
import javax.swing.*; //This is the final package name.
//import com.sun.java.swing.*; //Used by JDK 1.2 Beta 4 and all
//Swing releases before Swing 1.1 Beta 3.
import java.awt.*;
import java.awt.event.*;
public class SwingApplication {
private static String labelPrefix = "Number of button clicks: ";
private int numClicks = 0;
public Component createComponents() {
final JLabel label = new JLabel(labelPrefix + "0 ");
JButton button = new JButton("I'm a Swing button!");
button.setMnemonic(KeyEvent.VK_I);
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
numClicks++;
label.setText(labelPrefix + numClicks);
}
});
label.setLabelFor(button);
/*
* An easy way to put space between a top-level container
* and its contents is to put the contents in a JPanel
* that has an "empty" border.
*/
JPanel pane = new JPanel();
pane.setBorder(BorderFactory.createEmptyBorder(
30, //top
30, //left
10, //bottom
30) //right
);
pane.setLayout(new GridLayout(0, 1));
pane.add(button);
pane.add(label);
return pane;
}
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(
UIManager.getCrossPlatformLookAndFeelClassName());
} catch (Exception e) { }
//Create the top-level container and add contents to it.
JFrame frame = new JFrame("SwingApplication");
SwingApplication app = new SwingApplication();
Component contents = app.createComponents();
frame.getContentPane().add(contents, BorderLayout.CENTER);
//Finish setting up the frame, and show it.
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
frame.pack();
frame.setVisible(true);
}
}
----------------------------------------------------------------------------------------
Exposure to SilkTest IDE
To start the SilkTest tool
Select the 'Start' button in Windows status bar.
Go to 'Programs -> SilkTest -> SilkTest' option (with green color icon)
It will open the silktest tool.
If you get the QuickStart wizard, close the wizard if you dont need it or else, refer to the 'Installation tips' to go with the wizard.
To compile & run scripts
Open the testscript file (with the extention .t).
Select the Run -> Compile option from the menu bar. Also we can select the icon with the 'tick' mark to compile the scripts.
The files that are associated with the script files will also get compiled. Hence if there is any problem with the include file, you will get error by compiling the testscript file itself.
To compile a selected file, keep the mouse cursor on that particular file and give the Run-Compile option.
The 'Run' option will get enabled only for the testscript files. We cannot run a include file or a test frame.
We can run a testcase selectively, compile the testscript file and click the "=>t" icon in the tool bar.
To run the entire set of testcases in a testscript file, click the "==>" icon or select the Run -> Run option.
If there is any syntax error in the script file, it will show that if you move to the next line of the code. But the other errors are known only at the time of compilation or during the run.
To open a new or existing files
In Silktest,
Select the File -> New menu from the menu bar. (or) select from the 'white icon' in the left top corner of the window.
It will ask for various kind of files to open. Select the '4Test include file' to declare the window objects from the application.
The '4Test Script file' option is to open the script file where we will be writing testscript.
The above two files are more important for building the scripts.
Open the application you want to test. If you are going to test the Yahoo site, then open the browser load the page you want to start testing.
The page that you start testing the application will be assumed as the 'BaseState'. Even we can explicitily declare the window base state.
The Test Script file will be used only after creating the include file. We will be using the include file to write the script file. Hence we have to declare the include file that we are calling in the testscript files.
To open an existing file, select File -> Open and select the existing file.>
Limitations of SilkTest:
Some of the limitations of SilkTest are given below.
SilkTest may not recognise some objects in a window / page due to some technical reasons.
SilkTest may not recognise some window frames.
The 'tag' value may get changed frequently.
Sometimes it will be difficult to activate some window.
It may be necessary to make some modifications if testing should be shifted to other browser/operating system.
In web based applications, sometimes silktest will take the links as simple text.
Limitations of SilkTest:
Some of the limitations of SilkTest are given below.
SilkTest may not recognise some objects in a window / page due to some technical reasons.
SilkTest may not recognise some window frames.
The 'tag' value may get changed frequently.
Sometimes it will be difficult to activate some window.
It may be necessary to make some modifications if testing should be shifted to other browser/operating system.
In web based applications, sometimes silktest will take the links as simple text.
Multi - kind application testing:
SilkTest can be used to test any kind of applications such as Windows based, Java based, Web based,... But there should be a frame representing the contents of the application. In general silktest differenciates testing by the kind of the application it tests.
For example, if the tests has to be done on the web application, then the basic properties should be enabled / set. It includes the default browser, home page to be loaded first, inclusion of standard library files for the web based testing,...
If the tests is to be performed on the windows based testing means, then the executable file (.exe) has to be declared in the silktest so that it will automatically call that file (ie., starts the application automaticvally).The declaration of the window contents/objects, inclusion of library file for the windows based testing,...
We will discuss on this topic with examples.
This testcase shows the required code with which you start a multi-application testcase. It connects SilkTest to all the machines being tested and brings each to its first screen. This is just a template; you must tailor your code to fit your actual needs. Template.t explainedtemplate_t_explained>Second describes the significance of each line of code.
multitestcase MyTest (STRING sMach1, STRING sMach2)
SetUpMachine (sMach1, MyFirstApp, "MyFirstAppState")
SetUpMachine (sMach2, MySecondApp, "MySecondAppState")
SetMultiAppStates ()
spawn
SetMachine (sMach1)
// Here is placed code that drives test operations
spawn
SetMachine (sMach2) // Here is placed code that drives test operations
rendezvous
Naming conventions
SilkTest uses various files that contains declaration and uses the objects. Sometimes There may be chances for the programmer to get confused by looking at the name of the declarerd identifiers.
For example assume a case where we are declaring a window (say yahoo page)
[-] window BrowserChild SignInYahooMail
tag "Sign in - Yahoo! Mail"
parent Browser
[-] HtmlImage HtmlImage1
tag "#1"
[-] HtmlText HelpYahoo //
tag "Help - Yahoo!"
[-] HtmlLink HelpYahoo //
tag "Help"
[+] HtmlLink Yahoo
In the above case, there are two variables in same name 'HelpYahoo' but of different data types. Here after declaring the objects, it will be confused to use those objects in the testscript file. Hence we can follow a naming method to make the variables more presice and clear.
Consider the below code. It is the same code given above with the naming conventions used.
[-] winclass clsSignInYahooMail
[-] HtmlImage imgHtmlImage1
tag "#1"
[-] HtmlText txtHelpYahoo //
tag "Help - Yahoo!"
[-] HtmlLink lnkHelpYahoo //
tag "Help"
[+] HtmlLink lnkYahoo
Here, declaring the window name with a pre-name 'cls' is to show it as a class name. Also the text and links are preceded by 'txt' & 'lnk'.
Consider the code for a window declaration file.
[-] window BrowserChild winSignInYahooMail
tag "Sign in - Yahoo! Mail"
parent Browser
clsSignInYahooMail objSignInYahooMail
Here, the window name is preceded by the keyword 'win', and so the class name and its objects.
Note: This convention is not a must to follow but to make the coding more easy to understand.
Basic Object-oriented features

The following object-oriented programming terms and concepts are used
Classes
Methods
Objects
Properties
Inheritance
Classes
Classes are the core of object-oriented languages and are common to basic GUI architecture. A class contains a collection of information about a type of object. The following figure shows several classes in the main window of a sample application.
Methods
For each GUI object in your application, there is an associated class that defines the actions, called methods, that can be performed on all objects of that type. For example, the CheckBox class defines the actions that can be performed on all the checkboxes in your application. Methods defined for one class cannot be used to perform actions on a different class. For example, you cannot use methods defined for the CheckBox class to perform actions on objects in the PushButton class.
Objects
An object is a specific instance of a class. For example, in the 4Test language, the Exit button on a window is an object of the PushButton class. The methods that are available to an object are dictated by the class to which the object belongs.
Properties
A property is the physical characteristic of an object that you can access directly. Each class has an associated set of properties, although some properties are common among classes.
Inheritance
Classes are organized in a hierarchy. The reason for this is that classes are related to each other, sharing characteristics common to their parent classes. For example, the parent class Control defines all the characteristics common to all kinds of controls: check boxes, text fields, pushbuttons, and so on. In this way, each class does not need to define all the methods it needs; the class can just inherit the existing definition from its ancestor classes. For example, one action you can perform on objects of class DialogBox is the GetDefaultButton method. This method returns the identifier of the default pushbutton, which is the pushbutton that is pressed when the Return or Enter key is pressed. You could not use this method with objects that were not dialog boxes, such as menus or text fields. When you record testcases, the proper 4Test methods for each of your manual actions are recorded automatically for you, so it really is transparent to you which class the recorded methods belong to. However, if you decide to write or augment a testcase by hand, you can look up the class and the methods it supports in the online Help or Library Browser.
Operators in SilkTest

Operators: The 4Test language provides the programmer with operators which are similar to the operators which are used in the other programming languages.
The most commonly used operators are discussed in here briefly
These can be classified as
Arithmetic Operators
Logical Operators
Bit wise Operators
Arithmetic operators
Definition
The arithmetic operators perform addition, subtraction, multiplication, division, exponentiation, and modulus operations.
Addition+Adds one operand to the other
Subtraction -Subtracts the second operand from the first
Multiplication *Multiplies one operand by the other
Division /Divides the first operand by the second
Modulo%Divides the first INTEGER operand by the second, and returns the remainder
Exponentiation**Lets you refer to a number in terms of a base value and an exponent

Operand type
Operands for the arithmetic operators can be integers or real numbers.
Arithmetic operators with sets
The plus (+) and minus (-) operators are valid operators for sets. The plus operator is the equivalent of the SetUnion and SetAddMember functions; it performs the union of two sets:
SuperSet = SubSetA + SubSetB
SuperSet contains all members of both subsets with no duplicates. If either of the subsets is a single member, then the plus operator is the equivalent of the SetAddMember function.
The minus operator is the equivalent of the SetExclude and SetRemoveMember functions; it performs the exclusion of two sets, either of which could be a single member:

SubSet = SuperSetA - SuperSetB

SubSet is the set containing all members of SuperSetA that are not also contained in SuperSetB.

NoteThe exclusion of set B from set A is equivalent to:
SetIntersection (A, SetComplement (B))

The following examples should make the behavior of set exclusion operations more clear:

OperationResulting set
Red - [COLORS]{Green, Blue}Red
Red - [COLORS]{Red, Green, Blue}empty set
[COLORS]{Red, Green, Blue} - Red{Green, Blue}
In the third example above, the specification of a single member as the right operand works like the SetRemove function to remove that member from the left operand set.

-- (operator) and ++ (operator)
The ++ (increment) and -- (decrement) operators take a single argument.

·++ adds one to its operand.

·-- subtracts one from its operand.

In an assignment statement, the operand’s placement before or after the operand determines whether the increment/decrement operation takes place before or after the assignment.

·If the operator appears before the operand (++n), the increment or decrement operation occurs before the assignment

·If the operator appears after the operand (n++), the increment or decrement operation occurs after the assignment
Examples
// The following three statements are equivalent:
i++
i = i + 1
i +=1
// Increment n before assignment.
// Afterwards, both x and n have the value 11.
n = 10
x = ++n
// Increment n after assignment.
// Afterwards, x is 10 and n is ll.
n = 10
x = n++


Logical Operators
Definition
The logical operators perform logical and, or, and not operations. They work by evaluating the first operand and then, if necessary the second. The second operand is evaluated only if its value is needed to determine the result.
Logical and&&Returns TRUE if both operands evaluate to TRUE; returns FALSE if either operand is FALSE.
Logical or||Returns TRUE if either operand evaluates to TRUE; returns FALSE if both operands are FALSE.
Logical not!Takes only one operand. If the operand evaluates to TRUE, ! makes the resulting value FALSE. If the operand evaluates to FALSE, ! makes the resulting value TRUE.
Operand type
Operands to logical operators must all have type BOOLEAN.
Result type
The logical operators return one of the BOOLEAN values TRUE or FALSE.
Scope resolution operator
Use the scope resolution (::) operator inside a window or class declaration to refer to a method, property, child window, or variable that is inherited by the window or class, rather than the method, property, child window, or variable of the same name which the class itself defines.
Bitwise operators
Definition
The bitwise operators perform bitwise AND, bitwise inclusive OR, left shift, right shift, and one’s complement (unary).
Bitwise AND&Masks off the specified bits
Bitwise inclusive OR|Turns on the specified bits
Bitwise exclusive OR^Sets to 1 each bit position where the operands have different bits, and sets to 0 each bit position where the operands have the same bits.
Bitwise 1’s complement~Changes each 1-bit into a 0-bit and vice-versa.
Left Shift<<Shifts to the left the left operand by the number of bit positions indicated by the right operand.
Right Shift>>Shifts to the right the left operand by the number of bit positions indicated by the right operand.
Operand type

These operators apply to integers.

Result type
The following table shows each of the possible results for bitwise AND, OR, and exclusive OR (XOR).
01
AND (&)010001
OR ( | )010111
XOR ( ^ )010110
About Segue
The SilkTest testing tool is developed by the Segue Software, Inc. the e-business reliability experts, is committed to providing its customers worldwide with a critical Internet infrastructure specifically designed to increase e-business system performance, reliability, and quality. Segue is always first to market to offer the latest technologies and support to its customers worldwide.
Segue is the FIRST for...
First testing tool to test objects without relying on screen locations
First cross-platform testing tool -- supports over 20 platforms and development environments
First company to deliver 32-bit testing support for Microsoft Windows 95 and Windows NT
First company to provide automated link testing of web sites First and only company to provide direct database access for testing
First and only company to provide comprehensive testing for Web applications
First and only tool to test client/server applications end-to-end
First and only tool to test Java applications
First and only company to deliver scenario testing for e-business systems
First and only company to offer a complete e-business management solution
Other Segue products:
The Silk products include
SilkTest for functional and regression testing
SilkPerformer for load and performance simulation
SilkPilot for functional and regression testing CORBA and EJB servers
SilkRadar for automated defect tracking
SilkVision for enterprise application health monitoring
SilkExpress for a scalability and load testing consulting solution
for details Contact: Segue Software,201, Spring Street Lexington, MA 02421www.segue.com info@segue.com
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 the application is running.
All that needs for an application to be tested using silktest is that it needs a frame ( like window).
The SilkTest recognizes the objects as they appear in the screen. For example, in a web based application, the silkiest sees a link as a HTML Link, an image as a HTML Image, a table as a HtmlTable,...regardless of the technology behind them.

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 they display can also be aligned or displayed in different manner.
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 versions of these browsers.

Technology Independent
Silktest does not care how the application was built. It seamlessly works with the different web technologies commonly used today.

How to use the same code for multiple browsers:

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 & runs successfully on it. As we captured the declarations from I.E., we now have to make the same test case run on Netscape since the tag value changes from multiple browsers.
An Include file
-----------------
[-] window BrowserChild MyWebsite
· [-] HtmlImage Join
[+] multitag "Be Smarter, Feel Healthier. Join Today - Go!"
[ ] "#12"
[ ] "$http:??images.test.webmd.net?mywebmd?images?misc?JoinToday.gif"
-------------------------------------
The .t file for this we would write is
MyWebsite.Join.Click()
and this worked fine on IE5.0 If the same objects have different tags, you can use the browser tag specifiers to change the object for IE and Netscape.
For example
--------------------------------------------------------------------------------
HtmlLink SomeLink
explorer tag "Checkout" // for IE
netscape tag "#2" // for Netscape
------------------------------------------------------------------------
//Window Use
[-] window BrowserChild MyToica
[ ] tag "^?my?"
[ ] !netscape4 tag "Toica: My Toica-New"
[ ] netscape4 tag "Toica: My Toica"
[ ] parent Browser
//Object Use
[-] HtmlTextField FirstName
[ ] netscape4 tag "[TextField]First Name:"
[ ] !netscape4 tag "$ufn"
Using the above you can run the same script across browsers.
Recording the Events / Action

Writing scripts in SilkTest includes steps of commands with declaration of window names and its objects before that. To avoid these difficulties and to make the process easier ( this is an alternate for writing line-by-line steps of the scripts ) silktest provides a special feature of recording events. The steps are given below.
Create a new Testcase.
Select the option Record - Actions menu.
After getting the 'Record Actions' dialog box, the sequence of steps to be tested, should be done.
ie., the programmer has to simply do the ordinary testing process by selecting or useing the windows & its objects.
After completing these steps, the user has to click the 'Paste to Editor' button in the 'Record Actions' dialog box.
Now the scripts are automatically available in the script file.
Save the script and run that testcase.
A recorded statements for logging in to the yahoo site, will look line the sample given below.
[-] recording
BrowserPage.SetActive ()
Browser.Location.SetText ("www.yahoo.com")
Browser.Location.TypeKeys ("")
Yahoo.HtmlLink("Mail|#26|$http:??www.yahoo.com?r?m2").Click ()
BrowserPage.HtmlTextField("Yahoo! ID:|#1").SetPosition (1, 1)
BrowserPage.HtmlTextField("Yahoo! ID:|#1").SetText ("username")
BrowserPage.HtmlTextField("Yahoo! ID:|#1").TypeKeys ("")
BrowserPage.HtmlTextField("Password:|#2").SetText ("password")
BrowserPage.HtmlPushButton("Sign In|#1").Click ()
The alternate for the above recorded statements will be as below:
Browser.Loadpage("www.yahoo.com") // Loads the yahoo homepage as the default page
if Yahoo.Exists() // checking for the existence of the homepage
print("Yahoo window exists") // confirming that the window exists
Yahoo.objYahoo.Loginname.SetText("username")
Yahoo.objYahoo.Password.SetText("password")
Yahoo.objYahoo.Submit.Click()
The difference between the above two different scripts are, the method II needs windows & its objects to declared before the scripts are to be written. It is not in the case of the recording kind of the code.
Built-in recovery system
If you are runing a set of scripts simultaneously, a test failure shouldn't stop the rest of your tests from running. This will not happen in the SilkTest.
The SilkTest intelligently handles the unexpected errors and automatically returns your application to the desired state before running your next test. Hence after completing the first test, whether it is passed or failed, it will run the second test and stores the results in a log. This doesn't require human intervention.Hence you can run a set of scripts overnight and come in the next day with all the results waiting for you.
SilkTest uses its recovery system for all testcases that are based on DefaultBaseState or based on a chain of application states that ultimately are based on DefaultBaseState. The recovery system is not used with testcases based on an application state of None or based on a chain of application states ultimately based on None.
The base state
The base state is the state you expect the application to be in at the start of each testcase. Although this can differ from application to application, the default recovery system considers an application to be at the base state when
• The application is running
• The application is not minimized
• The application is active
• No other window besides the main window is open
If this is not sufficient or if the recovery system is not able to achieve one or more of these conditions, you need to modify the recovery system.
Running the silkscripts
The basic silk scripts will be in two forms. One as an include file and the other as a script file.
The include file with the extention *.inc can be used for the declaration of window names, window objects, variables, constants, structures and classes. The core objects of the scripts lies here.
The script file will be used in writing scripts. It will be with the extention *.t. The body of the scripts will be defined here. ie. the testcases that meets various test conditions will be written in the script file.
The script file (*.t) can be used for declaring objects and the include file (*.inc) for writing testcases. But to make the code clear we use different files for different purposes. If no testcases is written in a file (include) , then the include file can be compiled but cannot be run. It will show error that the file does not contain any testcases.Only the file with the testcase present will be allowed to run.
Before running the scripts, seperate declaration file have to be written ( for declaring the objects) and the script file (for writing scripts using that declaration file) and compile them.
The steps to be followed for running the scripts are as below.
Open the silk test tool.
Open the script (*.t) file that has to be run.
Compile the script by selecting the Run-> Compile menu from the menu bar (or) from the compile icon.
It will compile that particular script and the other related files, called by that script. The user can confirm that by looking at the progress status (in yellow color ) in the bottom-right corner of the silktest tool.
If there is any error, the error details are displayed in the compile time. The user has to make necessary changes.
Then, select the Run->Testcase from the menu bar (or) else select the Run icon.
The testcases can be run by selectively or at-a-stretch.
If the selective method is selected, it will ask for the testcase to be run from a list of testcases.
After selecting the testcase and start running, the silktest will automatically start the application and start the test from the basestate.
Customization of scripts by runtime options
The Runtime option are set by the user according to the kind of the software that is to be tested. This option should reflect the kind of the application that is to be tested.
There are two default settings that has to be done to make a minimal code run.
In the Options -> Runtime menu,
Set the use path = the path of the 'extend' directory in the installed silktest folder, say "c:\programfiles\segue\silktest\EXTEND"
Set the use files = The file you are including for the extension type. This will be automatically set if you select the kind of application you are testing. In the Options -> Extentions menu, set the primary extensions 'Enabled' and disable all the other extentions if not needed. This will automatically add the include file in to the 'use files' option in Options->Runtime.
If there is any common file that is used in many areas of the script, then set the path of that file in this 'use files' option.
For testing across networks, the protocol should be set in the runtime option.
Automatic generation of results
One or more testcases can be run, either by running a collection of scripts, or by running only the selected script (or) testcases. As each testcase runs, statistics are written to a results file. The results file and its associated comparison tools allow you to quickly pinpoint the problems in your application.
At the end of the running of each and every testcases, the status of the test will be saved in a result (.res) file and is displayed. The state of the testing can also be known by stopping the test, by pressing the two 'shift' keys simultaneously. The result file contains details such as script name, machine name, started time, elapsed time, total scripts run, total passed, total failed, errors or progress of each and every test case,and whether the testcase run is aborted automatically or externally.
For examples:
Consider the situation that a script (say login.t) is aborted manually, the generated result file will be as below.
Script login.t - 1 error
Machine: (local)
Started: 04:26:19PM on 25-Jul-2001
Elapsed: 0:00:09Totals: 1 error, 0 warnings
*** Program aborted by user
Consider the situation that a script (say login.t) is passed, the generated result file will be as below.
Script login.t - Passed
Machine: (local)
Started: 03:13:11PM on 02-Aug-2001
Elapsed: 0:19:47 [ ]
Passed: 1 tests (100%)
Failed: 0 tests (0%)
Totals: 1 tests, 0 errors, 0 warnings
[+] Testcase NewGroupMembersDelete - Passed
Delete current Member Test Pass
*** Warning: DefaultBaseState is closing Browser windows
-----------------------------------------------------------
Consider the situation that a script (say login.t) is failed due to some error, the generated result file will be as below.
Script login.t - 1 error
Machine: (local)
Started: 03:13:11PM on 02-Aug-2001
Elapsed: 0:19:47 [ ]
Passed: 1 tests (100%)
Failed: 0 tests (100%)
Totals: 1 tests, 1 errors, 0 warnings
[+] Testcase NewGroupMembersDelete - 1 error
*** Error: Window '[HtmlTable]NAME' was not found
Occurred in Yahoo.objYahoo.tblName.hcml1.lnkMail.Click()Called from LoginTahoo at tlogin.t(109)
Sample code with description

Let us consider the sample testcase for registering in the yahoo mail site.
//--------------------------------------------------------------------------------------------------------
// a sample script file ( registration.t )
use "c:\scripts\decregistration.inc"
testcase registration()
Browser.LoadPage("mail.yahoo.com")
SignInYahooMail.SetActive()
SignInYahooMail.objSignInYahooMail.SignUpNow.Click()
sleep(3)
WelcomeToYahoo.SetActive
WelcomeToYahoo.objWelcomeToYahoo.SignUpForYourYahooID1.SetText ("newuser@yahoo.com")
WelcomeToYahoo.objWelcomeToYahoo.SignUpForYourYahooID2.SetText("password")
WelcomeToYahoo.objWelcomeToYahoo.SignUpForYourYahooID3.SetText("confirmpassword")
WelcomeToYahoo.objWelcomeToYahoo.HtmlPopupList1.Select(5)
WelcomeToYahoo.objWelcomeToYahoo.HtmlTextField4.SetText("AnswerToSecurrityQuestion")
WelcomeToYahoo.objWelcomeToYahoo.HtmlPopupList2.Select(3)
WelcomeToYahoo.objWelcomeToYahoo.HtmlTextField5.SetText("birthmonth")
WelcomeToYahoo.objWelcomeToYahoo.HtmlTextField6.SetText("birthyear")
WelcomeToYahoo.objWelcomeToYahoo.HtmlTextField7.SetText("currentmailid")
WelcomeToYahoo.objWelcomeToYahoo.FirstName1.SetText("firstname")
WelcomeToYahoo.objWelcomeToYahoo.LastName1.SetText("lastname")
WelcomeToYahoo.objWelcomeToYahoo.LanguageContent1.Select(5)
WelcomeToYahoo.objWelcomeToYahoo.ZipPostalCode1.SetText("zipcode")
WelcomeToYahoo.objWelcomeToYahoo.Gender1.Select(2)
WelcomeToYahoo.objWelcomeToYahoo.Occupation1.Select(5)
WelcomeToYahoo.objWelcomeToYahoo.Industry1.Select(5)
WelcomeToYahoo.objWelcomeToYahoo.ContactMeOccasionallyAbout.Click()
WelcomeToYahoo.objWelcomeToYahoo.Entertainment.Click()
WelcomeToYahoo.objWelcomeToYahoo.SubmitThisForm.Click()
if RegistrationSuccess.Exists()
print("Test Pass")
else
logerror("Test Fail")
//--------------------------------------------------------------------------------------------------------
// a sample Window Declaration include file ( decregistration.inc )
· file://decregistration.inc
· use "c:\scripts\clsregistration.inc"
· [-] window BrowserChild SignInYahooMail
tag "Sign in - Yahoo! Mail"
parent Browser
clsSignInYahooMail objSignInYahooMail
· [-] window BrowserChild WelcomeToYahoo
tag "Welcome to Yahoo!"
parent Browser
clsWelcomeToYahoo objWelcomeToYahoo
//--------------------------------------------------------------------------------------------------------
// a sample class include file (clsregistration.inc)
· [-]winclass clsSignInYahooMail
[+] HtmlImage HtmlImage1
tag "#1"
[+] HtmlText HelpYahoo
tag "Help - Yahoo!"
[+] HtmlLink Help
tag "Help"
[+] HtmlLink Yahoo
tag "Yahoo!"
[+] HtmlHeading WelcomeToYahooMail
tag "Welcome to Yahoo! Mail"
[+] HtmlHeading YouMustSignInToRead
tag "You must sign in to read"
[+] HtmlHeading NewToYahoo
tag "New to Yahoo!?"
[+] HtmlHeading ExistingYahooUsers
tag "Existing Yahoo! users"