Silk Set interview questions 2
 
Testing Technologies
Load Runner
Win Runner
QTP
SilkTest

More Silk Test Questions 

Set 1

Set 2

Set 3

Manual Testing

Automated Testing

Test Director

Courses for International Certifications, ASQ CQE, CSTE, CSQA, ISEB, ISTQB


Freshers Resources

QA & Testing

Data WareHousing Computer Science Analysis  Design Operating Systems
C++ Mainframes Sap/Abap Databases HR VB
Java Jobs C#

.Net

VC++ ASP

Brief Description:
The general syntax for performing any operation on the browser is as follows
<window-name>.<object-name>.<control-name>.<operation>
It is not necessary to use class to write testscripts. We can also write using the Window name followed by control name. In that case the syntax will be as below
<window-name>.<control-name>.<operation>
If an operation is to be done on the window itself (not in its controls, say activating a window), Window object need not be mentioned. thus,
<window-name>.<operation>
CONTROLS / OBJECTS:
Controls are the various text fields, html links, buttons, popuplists, check boxes etc., in a browser window or dialog box or in any non web application.
OPERATIONS:
Depending upon the different type of controls, respective operations are defined. It can be SETTEXT for TEXTFIELDS; CLICK for BUTTONS, CHECK BOXES, LINKS; SELECT for POPUPLISTS etc.
In the above example,
resister(), is the function name used to do registration in the Yahoo site. Function name can be anything, as the User's choice.
The file clsregistration.inc is included in decregistration.inc, which in turn is included in tregistration.t. Windows are declared in deregistration.
The corresponding classes, which consists of the various controls in the window are initialized in clsregistration.inc
The command statement,
Browser.LoadPage("www.yahoo.mail.com"), is used to load the site.
The command line, SignInYahooMail.objSignInYahooMail.SignUpNow.Click(), clicks the link 'signupnow'. Here, 'SignInYahooMai' is the window name, 'objSignInYahooMail' is the object of that particular window, 'SignUpNow', is the name of the control link and 'CLICK()' is the operation performed to click that control link.
Similarly Text Values are entered into various text fields in the window 'WelcomeToYahoo' with the help of 'SetText' operator. 'objWelcomeToYahoo' is the object of 'WelcomeToYahoo' window. Note that the inverted commas is necessary with Settext operation, other than when passing parameters.
Select is the operation used to select a particular value from a popup list. Select(3), will select the third value from the list.
'WelcomeToYahoo.objWelcomeToYahoo.Entertainment.Click()', will check the check box Entertainment and 'WelcomeToYahoo.objWelcomeToYahoo.SubmitThisForm.Click()'will click the button SubmitThisForm. SetActive(), IsActive(), Exists() are some of the methods used to verify the browser window status. Here there is no need to specify the window object.
Print is the method used to print a particular statement on the result file, once the testcase completes execution. logerror behaves similarly like print, except the statement will be printed in red colour in the .res file
To write a testcase using classes

This example is to write the script for logging in to the yahoo site.
To declare the window objects
Start the SilkTest by selecting from the 'Start' menu.
Configure the settings as given in lab I. Set it to Netscape.
Click 'File -> New' menu, and select the '4Test include file' option and click OK.
Click on the OK button.
It will open a new include file (of type .inc)
Open the application in parallel. ie., open the browser in which application has to be run.(say Netscape)
In the netscape browser, load the page 'www.yahoo.com'.
Go to the silktest.
Select 'Record -> Window Declarations' option from the menu bar and go to the browser (your application)
Wait till the 'Record Declarations' dialog box appears. Till that your application will be scrolled up and down to trap all the objects in that window.
In the resultant 'Record Declarations' dialog box, you can view all the objects of the yahoo home page declared.
Press the 'Ctrl'+ 'Alt' keys simultaneously. It will activate the button 'paste to editor' in the 'Record Declarations' dialog box.
Click on the 'paste to editor' button to paste the window objects in the silk editor.
Now it will display a code as given below. (say)
[-] window BrowserChild Yahoo  //identifier for window
           tag "Yahoo - Netscape" //tag for window
           parent Browser
          [+]  HtmlLink Mail
[+]  HtmlImage LoginInfo
[+]  HtmlText Newsletter
[-]  HtmlPushButton Search // identifier for variiable search of type HtmlPushButton
            tag "Search"  // tag value for the control pushbutton search.
[+]  HtmlPushButton Submit

Now click on the 'Mail' link in the home page.
It will load the SignIn page. Now declare that page in the include / declaration  file.
Go to silktest.
Select 'Record -> Window Declarations' option from the menu bar and go to the browser.
Wait till the 'Record Declarations' dialog box appears. Till that the application will be scrolled up and down to trap all the objects in that window.
In the resultant 'Record Declarations' dialog box,all the objects of the yahoo SignIn page declared can be viewed.
Press the 'Ctrl'+ 'Alt' keys simultaneously. It will activate the button 'paste to editor' in the 'Record Declarations' dialog box.
Click on that button and paste the second page of the application in to the editor. Now the include file will look as below.
[-] window BrowserChild Yahoo
           tag "Yahoo - Netscape"
           parent Browser
          [+]  HtmlLink Mail
[+]  HtmlImage LoginInfo
[+]  HtmlText Newsletter
[+]  HtmlTextField Search
[+]  HtmlPushButton Submit
[-] window BrowserChild SignInYahoo
           tag "Sign In Yahoo - Netscape"
           parent Browser
          [+]  HtmlLink CheckMail
[+]  HtmlImage SignIn
[+]  HtmlText Mails
[-]  HtmlTextField Password
            tag "Pasword"
[+]  HtmlPushButton Submit
Login into the site by supplying the username and password and get into it.
Now the browser will contain the 'Yahoo Mail' page.
Now using the above few steps declare the objects available in this page too. Now the include file will be (say):
[-] window BrowserChild Yahoo
           tag "Yahoo - Netscape"
           parent Browser
          [+]  HtmlLink Mail
[+]  HtmlImage LoginInfo
[+]  HtmlText Newsletter
[+]  HtmlTextField Search
[+]  HtmlPushButton Submit
[-] window BrowserChild SignInYahoo
           tag "Sign In Yahoo - Netscape"
           parent Browser
          [+]  HtmlLink CheckMail
[+]  HtmlImage SignIn
[+]  HtmlText Mails
[+]  HtmlTextField username
[-]  HtmlTextField Password
            tag "Pasword"
[+]  HtmlPushButton Submit
[-] window BrowserChild YahooMail
           tag "Yahoo Mail - Netscape"
           parent Browser
          [+]  HtmlLink Mail
[+]  HtmlImage LoginInfo
[+]  HtmlText Newsletter
[+]  HtmlTextField Search
[+]  HtmlPushButton Submit
Create a folder called myscripts (say) in any drive to save the include file. Assume that the folder is created in c:\ drive. It is not necessary to save the scripts in that same drive where the silktest has been installed.
Create a folder myscripts in c:\ drive.
Save the above inlcude file as 'decyahoo.inc' in 'c:\myscripts' folder. The dec is just to mark that it is a declaration/include file.
include the code given below in the above file.
const wMainWindow = Yahoo // default window name.
const sLocation="www.yahoo.com"
This is to mark that the 'Yahoo' window will be the application base state and every testcase will starts with the above window. Also the silktest will automatically load the home page as the sLocation variable has been declared. The above two variables are declared in the 'c:\program files\segue\silktest\defaults.inc' file.

Differentiating the Window & Dialog box
If we are opening the application in the browser, then we can make the window declaraiton as given above. Many times we have to come  across the dialog boxes that is apart from a browser. The Pop-Up window is what we call as dialog box in SilkTest.
Assume composing a mail in Yahoo,with some attachment. In the composing page, on clicking the 'Add attachment' link, a pop-up window 'Yahoo! Mail' will be loaded. For that dialog box, the declaration cannot be done as the other browsers.The following steps has to be performed.
Assume that all the windows in Yahoo are declared and thye current window is in 'Yahoo! Mail' dialog box.
Open the declaration / include file 'decsample.inc'.
Select the Record -> Window Declarations menu, and click on the 'Yahoo! Mail' popup window.
Wait till the 'Record Declarations' dialogbox appears.
Now, keep the cursor on the top of the window frame of the pop-up window (a blue pane that contains the window name 'Yahoo! Mail - Netscape'.
Press the 'Ctrl' + 'Alt' keys simultaneously and paste the dialog name into the editor. But don't close the 'Record Declarations' dialogbox. The declaration will be as below.




[-] window DialogBox PreferencesNetscape
 [ ] tag "Preferences - Netscape"
Now go to the application and in the 'Record Declarations' dialogbox, click the 'Resume Tracking' button to continue tracking the window objects. Now, keep the mouse cursor inside the dialogbox (not on the dialog frame name) and press 'Crtl'+'Alt' keys. This will save the exact contents of the windows as below.
[-] window BrowserChild Preferences
 [ ] tag "Preferences"
 [ ] parent PreferencesNetscape
 [+] HtmlTextField ChangePassword
 [+] HtmlPushButton OK
 [+] HtmlPushButton Cancel
Now check for the difference between the two.
The dialogbox name bears the declaration of the window name and the browserchild bears the contents of the window. Here the name of the dialogbox can be used for activating / maximizing / minimizing the window while the name of the browserchild can be used for performing the action in the window.
Make sure that the parent name of the browserchild is same as that of the dialogbox name, and the name of the browserchild and the dialogbox should not be the same.

Consider the following testcase that uses the above window declarations.
..............in decsample.inc..................
[-] window DialogBox PreferencesNetscape
[-] window BrowserChild Preferences
............in sample.t........................
....
PreferencesNetscape.SetActive()
PreferencesNetscape.Maximize()
Sleep(2)
PreferencesNetscape.SetActive()
Preferences.ChangePassword.SetText("newpassword")
Preferences.OK.Click()
...................
To write the class file using the above declaration file:
Now the declaration / include file that contains the declaration of the following windows (say).

Yahoo, SignInYahoo, YahooMail, Preferences.
To start with the class file, select the File -> New menu, in which select the '4Test include file' type.
Copy the first window declaration from the decsample.inc file into this new include file. Here, copy the declaration Yahoo.
[-] window BrowserChild Yahoo
           tag "Yahoo - Netscape"
           parent Browser
          [+]  HtmlLink Mail
[+]  HtmlImage LoginInfo
[+]  HtmlText Newsletter
[+]  HtmlTextField Search
[+]  HtmlPushButton Submit
Since this is a class file, it should contain only the class definition and its variables. No detail regarding window should exists.
Hence change the text 'window BrowserChild' to the keyword 'winclass'.
Then change the name 'Yahoo' to 'clsYahoo' (say)since the name of the window should not be the same as that of its class. The name can be changed to anything but to make it clear that it is a class file,precede it with the word cls.
Then remove the tag value for the window name only. Don't remove the tag value for the variables.
After performing the above, the class file will look like as below:
[-] winclass clsYahoo
          [+]  HtmlLink Mail
[+]  HtmlImage LoginInfo
[+]  HtmlText Newsletter
[+]  HtmlTextField Search
[+]  HtmlPushButton Submit
Now go to the 'decsample.inc' file and make the changes given below.
Delete all the variables. ie., whatever comes next to the 'parent browser', delete it.
Create an object for that class to where you have put all those variables that comes under this window.
ie., that class should contain all the variables or controls that belong to this window.
After performing the above changes the window declaration for the Yahoo will look like as below.
[-] window BrowserChild Yahoo
           tag "Yahoo - Netscape"
           parent Browser
           clsYahoo objYahoo  // object of the class clsYahoo
Perform the above set of task for all the windows.
Now save the class file in any name, say 'clsSample.inc', in the location 'c:\myscripts'.
Declare the declaration file in the testscripts file
Declare the Class file in the declaration file.
ie., put 'use "c:\myscripts\decsample.inc"' in the sample.t file
       put 'use "c:\myscripts\clssample.inc"' in the decsample.inc file
For the dialog boxes, create objects for the BrowserChild 's and not for the 'DialogBox'es.
To write testscript using the above include file:
Already the include file 'decsample.inc' in the folder c:\myscripts.
Now, click on the File -> New option and open a new '4Test include file' file.
Declare the inlcude file in your script file by including the below line in the begining.
        use "c:\myscripts\decsample.inc"
Open a new testcase by marking the keyword 'testcase'.
Start with the keyword 'testcase Login()' and press Enter key in your keyboard. The testcase is the default keyword for any testcase and the name Login is the name of the testcase. The name of the testcase can be anything but it is advisable to name it clearly so that it will represent the functionality of the test.
Now start writing the testcase (write the below code).
Assume that classes have been created for all the windows.
use "c:\myscripts\decsample.inc"
testcase Login()
    Yahoo.SetActive() // this is to activate the window
    Yahoo.objYahoo.Mail.Click() // to click the mail link in home page
     if SignInYahoo.Exists()
        print("The yahoo sign in page is loaded")
        SignInYahoo.Username.SetText("username")
        SignInYahoo.Password.SetText("pasword")
        SignInYahoo.Submit.Click()
        if YahooMail.Exists()
            print("You have sucessfully logged in")
        else
            LogError("Sorry, Cannot log in")
    else
        LogError("Cannot Load Yahoo sign in page")
After completing the script, save it in the folder.
Save it as 'sample.t' in the 'c:\myscripts' folder. Now compile the above tetscase and run it.
At the end of the run,  a result file will be obtained where the status of the test can be known.For running the scripts, refer Lab I.
To write a testcase using 4test include file & 4test script file

This example is to write the script for logging in to the yahoo site.
To declare the window objects
Start the SilkTest by selecting from the 'Start' menu.
Configure the settings as given in lab I. Set it to Netscape.
Click 'File -> New' menu, and select the '4Test include file' option and click OK.
Click on the OK button.
It will open a new include file (of type .inc)
Open the application in parallel. ie., open the browser in which the application has to be run.(say Netscape)
In the netscape browser, load the page 'www.yahoo.com'.
Go to the silktest.
Select 'Record -> Window Declarations' option from the menu bar and go to the browser (your application)
Wait till the 'Record Declarations' dialog box appears. Till that the application will be scrolled up and down to trap all the objects in that window.
In the resultant 'Record Declarations' dialog box, all the objects of the yahoo home page declared can be viewed.
Press the 'Ctrl'+ 'Alt' keys simultaneously. It will activate the button 'paste to editor' in the 'Record Declarations' dialog box.
Click on the 'paste to editor' button to paste the window objects in the silk editor.
Now it will display a code as given below. (say)
[-] window BrowserChild Yahoo  //identifier for window
           tag "Yahoo - Netscape" //tag for window
           parent Browser
          [+]  HtmlLink Mail
[+]  HtmlImage LoginInfo
[+]  HtmlText Newsletter
[-]  HtmlPushButton Search // identifier for variiable search of type HtmlPushButton
            tag "Search"  // tag value for the control pushbutton search.
[+]  HtmlPushButton Submit

Now click on the 'Mail' link in the home page.
It will load the SignIn page. Now you have to declare that page in to your include / declaration  file.
Go to silktest.
Select 'Record -> Window Declarations' option from the menu bar and go to the browser.
Wait till the 'Record Declarations' dialog box appears. Till that your application will be scrolled up and down to trap all the objects in that window.
In the resultant 'Record Declarations' dialog box,all the objects of the yahoo SignIn page declared can be viewed.
Press the 'Ctrl'+ 'Alt' keys simultaneously. It will activate the button 'paste to editor' in the 'Record Declarations' dialog box.
Click on that button and paste the second page of the application in to the editor. Now the include file will look as below.
[-] window BrowserChild Yahoo
           tag "Yahoo - Netscape"
           parent Browser
          [+]  HtmlLink Mail
[+]  HtmlImage LoginInfo
[+]  HtmlText Newsletter
[+]  HtmlTextField Search
[+]  HtmlPushButton Submit
[-] window BrowserChild SignInYahoo
           tag "Sign In Yahoo - Netscape"
           parent Browser
          [+]  HtmlLink CheckMail
[+]  HtmlImage SignIn
[+]  HtmlText Mails
[-]  HtmlTextField Password
            tag "Pasword"
[+]  HtmlPushButton Submit
Login into the site by supplying the username and password and get into it.
Now the browser will contain the 'Yahoo Mail' page.
Now using the above few steps declare the objects available in 'Yahoo Mail' page. Now the include file will be (say):
[-] window BrowserChild Yahoo
           tag "Yahoo - Netscape"
           parent Browser
          [+]  HtmlLink Mail
[+]  HtmlImage LoginInfo
[+]  HtmlText Newsletter
[+]  HtmlTextField Search
[+]  HtmlPushButton Submit
[-] window BrowserChild SignInYahoo
           tag "Sign In Yahoo - Netscape"
           parent Browser
          [+]  HtmlLink CheckMail
[+]  HtmlImage SignIn
[+]  HtmlText Mails
[+]  HtmlTextField username
[-]  HtmlTextField Password
            tag "Pasword"
[+]  HtmlPushButton Submit
[-] window BrowserChild YahooMail
           tag "Yahoo Mail - Netscape"
           parent Browser
          [+]  HtmlLink Mail
[+]  HtmlImage LoginInfo
[+]  HtmlText Newsletter
[+]  HtmlTextField Search
[+]  HtmlPushButton Submit
Create a folder called myscripts (say) in any drive to save the include file. Assume that the folder is created in c:\ drive. It is not necessary to save the scripts in that same drive where the silktest has been installed.
Create a folder myscripts in c:\ drive.
Save the above inlcude file as 'decyahoo.inc' in 'c:\myscripts' folder. The dec is just to mark that it is a declaration/include file.
include the code given below in the above file.
const wMainWindow = Yahoo // default window name.
const sLocation="www.yahoo.com"
This is to mark that the 'Yahoo' window will be the application base state and every testcase will start with the above window. Also the silktest will automatically load the home page as we have declared the sLocation variable. The above two variables are declared in the 'c:\program files\segue\silktest\defaults.inc' file.
To write testscript using the above include file
Already the include file 'decsample.inc' is in the folder.
Now, click on the File -> New option and open a new '4Test include file' file.
Declare the inlcude file in your script file by including the below line in the beggining.
        use "c:\myscripts\decsample.inc"
Open a new testcase by marking the keyword 'testcase'.
Start with the keyword 'testcase Login()' and press Enter key in your keyboard. The testcase is the default keyword for any testcase and the name Login is the name of the testcase. The name of the testcase should be meaningful so that it represents the functionality of the test.
Now start writing the testcase (write the below code).
use "c:\myscripts\decsample.inc"
testcase Login()
    Yahoo.SetActive() // this is to activate the window
    Yahoo.Mail.Click() // to click the mail link in home page
     if SignInYahoo.Exists()
        print("The yahoo sign in page is loaded")
        SignInYahoo.Username.SetText("username")
        SignInYahoo.Password.SetText("pasword")
        SignInYahoo.Submit.Click()
        if YahooMail.Exists()
            print("You have sucessfully logged in")
        else
            LogError("Sorry, Cannot log in")
    else
        LogError("Cannot Load Yahoo sign in page")
After completing the script, save it in the folder.
Save it as 'sample.t' in the 'c:\myscripts' folder. Now you can compile the above tetscase and run it.
At the end of the run,  you will get a result file where you can know the status of the test.For running the scripts, refer Lab I.
    Note:
Here various methods are available for every control. Assume the above code. Here SetActive() method for the windows is to activate the given window. The window can be checked using Exists(),IsActive() methods.
The SetText() method is for the type textfield. Value can be entered into the textbox/textfield using the SetText() method.
Click() method is used to click the text, links and images.
For dropdown control,Select(n) function can be used where 'n' value depends on our selection.
Your code is ready now. Now start writing the next testcase..
testcase login()
testcase checkmail()
    ...............
    ..............
If we need to write a new testscript file, it can be done and saved in another name.

Differentiating the Window & Dialog box
If the application is opened in the browser, then the window declaration can be as above. Many times we have to come  across the dialog boxes that is apart from a browser. The Pop-Up window is what we call as dialog box in SilkTest.
Assume composing a mail in yahoo,with some attachment. In the composing page, on clicking the 'Add attachment' link, a pop-up window 'Yahoo! Mail' will be loaded. For that dialog box, we cannot cannod do the declaration as the other browsers.We need to follow the following steps.
Assume that all the windows in yahoo are declared and the current window is in 'Yahoo! Mail' dialog box.
Open the declaration / include file 'decsample.inc'.
Select the Record -> Window Declarations menu, and click on the 'Yahoo! Mail' popup window.
Wait till the 'Record Declarations' dialogbox appears.
Now, keep the cursor on the top of the window frame of the pop-up window (a blue pane that contains the window name 'Yahoo! Mail - Netscape'.
Press the 'Ctrl' + 'Alt' keys simultaneously and paste the dialog name into the editor. But dont close the 'record Declarations' dialogbox. The declaration will be as below.


[-] window DialogBox PreferencesNetscape
 [ ] tag "Preferences - Netscape"
Now go to the application and in the 'Record Declarations' dialogbox, click the 'Resume Tracking' button to continue tracking the window objects. Now, keep the mouse cursor inside the dialogbox (not on the dialog frame name) and press 'Crtl'+'Alt' keys. This will save the exact contents of the windows as below.
[-] window BrowserChild Preferences
 [ ] tag "Preferences"
 [ ] parent PreferencesNetscape
 [+] HtmlTextField ChangePassword
 [+] HtmlPushButton OK
 [+] HtmlPushButton Cancel
Now check for the difference between the two.
The dialogbox name bears the declaration of the window name and the browserchild bears the contents of the window. Here the name of the dialogbox can be used for activating / maximizing / minimizing the window while the name of the browserchild can be used for performing the action in the window.
Make sure that the parent name of the browserchild is same as that of the dialogbox name, and the name of the browserchild and the dialogbox should not be the same.
Consider the following testcase that uses the above window declarations.
..............in decsample.inc..................
[-] window DialogBox PreferencesNetscape
[-] window BrowserChild Preferences
............in sample.t........................
PreferencesNetscape.SetActive()
PreferencesNetscape.Maximize()
Sleep(2)
PreferencesNetscape.SetActive()
Preferences.ChangePassword.SetText("newpassword")
Preferences.OK.Click()
...................
..................
Session IV:
Lab II : How to login into the yahoo site:
Write a script to check for the existence of the mail in yahoo site. (save it as testscript1.t)   -  use any maid id to check for mail
Write a script to delete all the mails in the yahoo inbox. (save it as testscript2.t)
Create a test suite to run the above two testscripts at-once. (refer Session I)
Look at the result files and if you see any error or warning, try to rectify it.
Session VI:
Lab III :

How to login into the yahoo site using classes:
Write a testcase using classes to compose and send a yahoo mail with an attachment. Use any file to attach.
Write a testcase to perform a stress test by adding 100 addresses into the addressbook of the yahoo site.
Write a testcase for registering into the yahoo mail-id. Use do…except statement to verify whether the email id already exists.
Session VIII:
Lab IV:
Source code for testing non-web application:
Write a script to test the non-web application provided above and check whether the number being displayed, changes after clicking the button provided.
Write a testcase to find the time taken to add 100 addresses in Yahoo address book, using timer function.
Session X:
Lab V:

            Write the following testcases for Yahoo site.
             Use Internet Explorer 5.0 / Win NT combination to test the application.
             Start from the beginning to declare the windows and its objects in IE.
             Enable  the extension to 'IE - DOM' for Internet Explorer 5.0 in Options -> Extensions.
Login to yahoo mail and check for the existence of mails.
Delete all the mails in the inbox and send a new mail to your id.
Open that mail and delete that after opening.
Send a mail with the subject 'subject', and search for the word 'subject' in the 'Search' option.
In the option menu, change the password to the same word.
Add Invalid addresses and check for errors.
            Concluding the session.
 SilkTest architecture

Normal use of an application consists of a person manipulating a keyboard and mouse to initiate application operations. The person is said to be interacting with the GUI (Graphical User Interface). During SilkTest testing, SilkTest interacts with the GUI to submit operations to the application automatically. Thus SilkTest can simulate the actions of a person who is exercising all the capabilities of an application and verifying the results of each operation. The simulated user (SilkTest) is said to be driving the application. The application under test reacts to the simulated user exactly as it would react to a human user. SilkTest consists of two distinct software components that execute in separate processes:
The SilkTest host software
The 4Test Agent software
SilkTest host software
The SilkTest host software is the program you use to develop, edit, compile, run, and debug your 4Test scripts and testplans. This manual refers to the system that runs this program as the host machine or the SilkTest machine.
The Agent
The 4Test Agent is the software process that translates the commands in your 4Test scripts into GUI-specific commands. In other words, it is the Agent that actually drives and monitors the application you are testing. One Agent can run locally on the host machine. In a networked environment, any number of Agents can run on remote machines. This manual refers to the systems that run remote Agents as target machines. In a client/server environment, SilkTest drives the client application by means of an Agent process running on each application’s machine. The application then drives the server just as it always does. SilkTest is also capable of driving the GUI belonging to a server or of directly driving a server database by running scripts that submit SQL statements to the database. These methods of directly manipulating the server application are intended to support testing in which the client application drives the server.
Silktest Features:   


SilkTest is the industry's leading functional testing product for e-business applications, whether Web, Java, or traditional client/server-based. SilkTest also offers test planning and management, direct database access and validation, the flexible and robust 4Test scripting language, a built-in recovery system for unattended testing, and the ability to test across multiple platforms, browsers, and technologies. SilkTest provides an unprecedented level of user and management convenience, along with enhanced control over the QA process. It can help you maximize your organization’s investment in automation and increase your workgroup productivity with such advanced feature sets as:

Power Testing with the 4Test Language
Centralized Testing of Distributed Applications
Distributed Access to Test Results
Extensive Component Testing
Cross-Platform Java Testing
Testing Across Multiple Browsers and Windows Versions, and
Against Over 35 Databases
Validation of Advanced Database Structures and Techniques

The SilkTest solution and features
SilkTest delivers a complete solution for automated testing of client/server and web applications. With SilkTest you can perform:
Functional and regression testing
Test planning and management using the testplan editor
Database validation using DBTester
The 4Test language
The 4Test language is an object-oriented fourth-generation language (4GL) designed specifically to meet the needs of the QA professional. You write your tests using the 4Test language. 4Test’s robust language features are organized into several basic kinds of functionality:
A set of statements, operators, and data types that can be used to add structure and logic to a recorded testcase
A library of built-in functions for performing common support tasks
The SilkTest Agent
The SilkTest Agent is the component of Silk that interacts with the graphical user interface (GUI) of your application. The Agent translates your 4Test commands into GUI-specific event calls.
Built-in recovery system
The built-in recovery system allows automatic recovery from errors that occur when the script you are running fails. The recovery system is fully integrated into SilkTest and makes it possible for you to run your tests unattended. SilkTest invokes the recovery system at the following stages:
• Before executing the first line of the testcase
The recovery system restores the application to the base state even if an unexpected event causes the application to fail between testcases.
• During the execution of a testcase
 If an error occurs, the recovery system terminates the execution of the testcase, writes a message in the error log, and restores the application to the base state before executing the next testcase.
To write a new plug & play testcase (using Action)
This example is to write the script for logging in to the yahoo site.
Start the SilkTest by selecting from the 'Start' menu.
Configure the settings as given in lab I.
Click 'File -> New' menu, and select the '4Test script file' option.
Click on the OK button.
Start with the keyword 'testcase Action()' and press Enter key in your keyboard. The testcase is the default keyword for any testcase and the name Action is the name of the testcase. The testcase name can be anything but it is advisable to name it clearly so that will represent the functionality of the test.
Now start writing the testcase (Follow the below instrutions).
Open the application in parallel. ie., open the browser in which the application has to be run.(say Netscape)
Go to SilkTest
Click Record -> Actions.. menu from the menu bar.
It will load the 'Record Actions' dialog box.
Keep the dialog box as it is, go to the application and do the action what ever you want to perform.
The silktest will record the events you do sequentially and you can view it in the 'Record Actions' dialog.
After completing your task (till whatever you want to record), click on the 'paste to editor' button in the 'Record Action' dialog box.
Then click the close button to close the Record actions dialog box and go to your application.
Now the recorded code will be readily available in the testscript editor, inside the testcase.
Now delete the keyword 'recording' in your first line of the recorded code.
Now, select the entire recorded code by keeping the mouse arrow at the leftmost dot (.) in your editor at the first line,  and drag it till the end.
Right click on the selected code and select the 'Move Left' option.
The code is ready now.
Now, compile the code from the 'Run -> compile' option and run the script by selecting the 'Run -> Run' menu.
Now the testcase will automatically start the application and perform the events recorded and throws the results.
The sample recorded testcase for yahoo login look like this:
testcase Action()
//[-] 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 ()
To make programming clear

To make the coding clear we can create three separate folders for testscripts, classes, and declarations. We can also write scripts without using classes. But to increase the effectiveness and easy updation, classes are used. Here what ever we specify as testcases/testscripts should be available at the (say) ‘testscripts’ folder, the classes and its fields, variables (say HtmlText) at the ‘classes’ folder, the window declarations in the ‘declarations’ folder. It will be easy to find the path of all these files if we put these folders in a separate folder called ‘silktest’.
Silktest
Declarations         for keeping the window declarations
Classes                for keeping the winclasses & its contents
Testscripts           for keeping the testscripts.
If we follow the above style of programming, we can write the scripts effectively with easy understanding and it will be usefull if there is any need for future updation of scripts.
Scripts have to be tuned fine by putting in sleep() commands so that the script will wait for actions which may take some time to complete. Also to activate the window, we can use SetActive(),Maximize() commands. This will enable quick access to objects that are hidden fomr the window, that are available in the viewport.
Statements in SilkTest
There are various statements available in 4Test language for writing testcases.
By using 4Test flow-of-control statements, we can add logic and robustness
to a recorded testcase. The following table summarizes the statements.


  To                                        Use one of these 4Test statements
  Execute statement
  blocks more than
  once
                     for each executes a statement block once for each
                      element in a list.
                     for executes the loop once for each increment of a
                      counter.
                     while executes a loop until a test condition (boolean
                      expression) is false.
  Conditionally
  execute
  a statement block
                     if...else executes a statement block based on the
                      value
                      of a boolean expression.
                     select executes one case from a group of cases.
                     switch executes one of the statements that follow,
                      depending on the value of an expression.
  Handle exceptions
                      do...except handles an exception (error) rather than
                      having it halt the script.
                     raise raises a user-defined exception.
                     reraise reraises an exception the testcase is handling
                      itself within a do...except statement.
  Transfer flow of
  control
                     break transfers control of the script out of the
                      innermost nested for, for each, while, switch, or
                           select statement.
                     continue begins the next iteration of a for, for each,
                            or while statement without completing the current
                      iteration.
                     exit ends the execution the current script.
                     goto transfers control to the statement prefixed with
                      the
                      specified label.
                     return returns control back to the calling function,
                      optionally passing back a return value.

For statement numeric iteration
Action : Uses numeric iteration to control the number of times a statement executes.
Syntax
for loop-var = start-expr to end-expr [step step-expr]
statement

VariableDescription
loop-var A loop variable to hold the current value of the for loop.
start-expr A number which specifies the starting value of loop-variable.
end-expr A number which specifies the end value of loop-variable.
step-expr Optional for incrementing loop-variable by a value other than
1. Specify a positive number to increment,
2. A negative number to decrement.
Note You must specify an explicit step-expr to decrement a loop.
For example, to decrement a loop by 1, specify step -1. If you fail to do this, the
for statement skips the loop but does not generate an error.
statementCode to be executed a specified number of times until loop-var is outside the range
start-expr to end-expr; either a single statement or a series of statements.
Example
testcase ForExample ()
INTEGER i = 0
for i = 2 to 9 step 2
Print (i)
// This script prints:
//2
//4
//6
//8


for each statement
Action
Iterates over the elements of a list or a set.
Syntax
for each item in expr
statement

VariableDescription
itemA variable name.
exprAn expression that evaluates to a list or a set.
statementA single statement or a series of statements.
Notes
The for each iterator executes once for each element in the list or set specified by expr. Each time it
executes, the iterator sets item to the value of another list or set element, the statement section
executes for that value, and then control passes back to the iterator to check for another item. When
every element in the list or set has been processed, control passes to the next statement in the script.
Example
testcase foreachExample ()
LIST OF STRING lsFruit = {...}
"apple"
"mango"
"kiwi"
STRING sFruit
for each sFruit in lsFruit
Print (sFruit)
// This script prints:
//apple
//mango
//kiwi
If Statement
Action : Executes particular statements depending on the value of a condition.
Syntax
if boolean-expr
statement
[else
statement]
VariableDescription
boolean-exprA boolean expression.
statementA single statement, or a series of statements.
Notes
If the value of the boolean expression is TRUE, the statement immediately below it is executed. If the
value of the boolean expression is FALSE, control passes to the else clause, if any.
If there is no else clause in an if statement, and if boolean-expr is FALSE, statement is not executed,
and control passes to the next statement in the script (which could be another if statement).
Example
testcase ifExample ()
INTEGER i = 1, j = 2
BOOLEAN b = TRUE
if (i == j)
Print ("Equal")
else
Print ("Not Equal")
Print ("Not even in the ballpark!")
if (b)
Print ("TRUE")
// Prints:
// Not Equal
// Not even in the ballpark!
// TRUE
switch statement
Action: Executes a particular statement depending on the value of an expression.
Syntax
switch (expr)
case case-value(s)
statement
[ case case-value(s)
statement ]...
[ default
statement ]...
VariableDescription
exprAn expression.
statementsOne or more statements.
case-valuesOne or more expressions, separated with commas. If the value of expr equals one of the
case-values, control passes to the first statement in the case-values clause. See the Notes below.
Notes
A switch statement can take the place of a series of if statements. Your script evaluates expr once
and compares this value to the value of each of the expressions in case-values. If the value equals
one of the expressions, control passes to the statement that follows. Otherwise control transfers to
the statement following the default label, if one exists. There can be only one default label, and it must
be the last.
          Although C requires a break statement in each case to explicitly transfer control out of the switch,
4Test does not require it. Once the last statement in the case has been executed, control
automatically passes to the next statement after the switch statement.
The syntax shown above is correct for Visual 4Test. Classic 4Test requires colons after the case and
default labels.
Example
The following example illustrates all of the ways you can specify case-values.
testcase switchExample ()
INTEGER i
for i = 1 to 12
switch (i)
case 1 // Compares i to 1
Print (i, "Case 1")
case 2, 4 // Compares i to 2 and 4
Print (i, "Case 2, 4")
case 5 to 7 // Compares i to 5, 6, and 7
Print (i, "Case 5 to 7")
case 8 to 9, 11 to 12 // Compares i to 8,9,11,12
Print (i, "Case 8 to 9 and 11 to 12")
default // If i is none of the above
Print (i, "Default Case")
// This script prints:
//1Case 1
//2Case 2, 4
//3Default Case
//4Case 2, 4
//5Case 5 to 7
//6Case 5 to 7
//7Case 5 to 7
//8Case 8 to 9 and 11 to 12
//9Case 8 to 9 and 11 to 12
//10Default Case
//11Case 8 to 9 and 11 to 12
//12Case 8 to 9 and 11 to 12
Select method (PageList)
Class : PageList class
Action : Sets the current page to the specified page.
Syntax
pagelist.Select (sPage)
VariableDescription
sPageThe page to select. LISTITEM
Notes
Select causes the specified page to become the current (active) page in the pagelist.
For information on specifying sPage, see the PageList class.
For TabList controls, Select generates a click on the specified tab.
Example
MyDialog.MyPageList.Select ("/Options/Agent")
do ... except statement
Action :Handles (ignores) an exception without halting a script.
Syntax
do
statements1
except
statements2
VariableDescription
statements1A single statement or series of statements that may generate an exception.
statements2A single statement or series of statements (executed only if exception is raised in
statements1).
Example
TestVerification (STRING sExpectedValue, STRING sTestValue)
if ( sExpectedValue == sTestValue )
Print ("Test was successful")
else
raise 1, "ERROR: Test verification failed"
return
ErrorHandler ()
Print (ExceptData())
//This script prints:
//ERROR: Test verification failed
return
testcase do_except_example ()
STRING sTestValue = "xxx"
STRINGsExpectedValue = "yyy"
do
TestVerification (sExpectedValue, sTestValue)
except
ErrorHandler ()
// Continue with testcase
...
Notes
The do...except statement allows a possible exception to be handled by the testcase instead of
automatically terminating the testcase. If an exception is raised while the do clause (statements1) has
control of the script, control immediately jumps to the first statement in statements2 in the except
clause (often a call to one of the built-in 4Test functions that gets information on exceptions).
If no exception is raised while statements1 has control of the script, control jumps to the first
statement beyond the do ... except statement (the statements in statements2 are not executed).

Guidelines for Testcases
Structuring testcases
When creating a testcase,the following steps should be followed:
Each testcase should verify one test objective
Typically each item of a testplan becomes a testcase
A testcase has three fundamental tasks:
Drive the application to the state to be tested
Verify that the actual state matches the expected state
Return the application to its initial state (also called the base state)
No script or testcase should rely on the successful completion of a previous script or testcase
 Each testcase is independent of other testcases
Running testcases
SilkTest allows you to run a single testcase, all of the testcases in the testplan, or only the testcases you have marked for execution.
When you run a testcase, SilkTest interacts with the application by executing all the actions you specified in the testcase and tests whether all the features of the application performed as expected.
The automated testing process
The testing process has these four steps:
1 Creating a testplan (if you are using the testplan editor)
2 Recording a test frame
3 Creating testcases
4 Running testcases and interpreting their results
Creating a testplan
If the testplan editor is used,the automated testing process is started by creating a testplan. A basic testplan is structured as a hierarchical outline and contains:
Descriptions of individual tests and groups of tests.As many levels of description can be used.
Statements that link the test descriptions in the plan to the 4Test routines, called testcases, that accomplish the actual work of testing.
Recording a test frame
Next, record a test frame, which contains descriptions, called window declarations, of each of the GUI objects in your application. A window declaration specifies a logical, cross-platform name for a GUI object, called the identifier, and maps the identifier to the object’s actual name, called the tag. In addition, the declaration indicates the type of the object, called its class.
Creating testcases
The 4Test commands in a testcase collectively perform three distinct actions:
Drive the application to the state to be tested.
Verify the state (this is the heart of the testcase).
Return the application to its original state.
The powerful object-oriented recorder can be used to automatically capture these 4Test commands to interact with the application, or to write the 4Test code manually if one is comfortable withprogramming languages. For maximum ease and power,these two approaches can be combined, recording the basic testcase and then extending it using 4Test’s flow of control features.
Running testcases and interpreting results
Next,run one or more testcases, either by running a collection of scripts, called a suite, or, if you are using the testplan editor, by running specific portions of the testplan. 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.
The Timer Function
The main use of timer function is to measure the time taken for an particular operation . It can be used like a stop watch to measure elapsed time. 4Test timers are accurate to the millisecond (.001 seconds). There are set of timer functions to accomplish the above tasks .
Illustration to  timer functions :
               This illustration used to calculate the time taken for the testcase to complete execution .
STRING sOverallTime
HTIMER TotalTimer
TotalTimer = TimerCreate ()
TimerStart (TotalTimer)
// Statements to accomplish any task . ( For Ex : The time taken by the browser to load a page )
TimerStop (TotalTimer)
sOverallTime = TimerStr (TotalTimer)
Print ("All code executed in {sOverallTime} seconds")
TimerDestroy (TotalTimer)
TimerCreate function creates a timer to keep track of an operation time .TimerStart function starts the specified timer. TimerStop stops the specified timer. Total time taken for an operation to complete is difference between timer stop and start minus the time paused. . TimerDestroy destroys the specified timer.

 

Technical Blogs..

Jokes & Fun
GDI+
Ado.Net Tutorial
Asp.Net Tutorial
Lectures videos
Winform Tutorial
C#.Net Tutorial
Programming Tips And Tricks
Visual C++ Tutorial
Ado.net Tutorial
ActiveX Controls Tutorial
ATL COM Tutorial
COM Tutorial
Managed C++The Buddha And His Dhamma
Bea WebLogic Interviews
TCL Programming FAQ's
Computer Science Notes
Discrete Mathematics notes
Database Management System(DBMS) Faqs
Professional Practices Faqs
Lotus Notes Faqs
Beautiful advertisements
Programming interview Questions and answers Blog List
Human Resource Tips
Tips for Windows XP Systems
Tips for Internet and Computer users
Tips for better e-mail etiquette
JavaScript Faq's
VB Script FAQ's
HTML Faq's
Perl Scripting FAQ's
Winrunner Faq'sLinux FAQ's
CCNA cisco Certification
Data WareHousing Interview
Microsoft SharePoint Interview
C++ Interview
Siebel Customer Relationship Management FAQ's
C Programming Language- Step by step learning
Unix FAQ'sSample Source Code for all languages
Various Technical and academic certifications

Source Code

Certifications

Misceleneous technical Faq's

VC++  Blog

Data structures Blog

.Net Blog

C#.Net Blog

VB.Net Blog

ASP.Net Blog

ADO.Net Blog

Winform Blog

WCF / WPF Blog

Job Openings

Operating Systems Faqs

Sybase Faq's

Download free e-books

All scripting Faq's

Oracle Faq's

All technical Faq's

Hasya-Vyang hindi kavite

HR, Car, Finance Faq's

Finance and Investment Faq's

All Freshers Resources

All Placement Papers

QA and testing Faq's

Sql Server Faq's

Interview Puzzles

Mainframes Faq's

Java Faq's

Sap Faq's