SilkTest

  Home  Applications Programs  SilkTest


“SilkTest Interview Questions and Answers will guide us now that SilkTest is an automation tool for testing the functionality of enterprise applications in most versions of Windows, Solaris 9 and 10, and Red Hat Enterprise Linux WS 2.1 and 3.0, s learn SilkTest or get preparation for the job of SilkTest with the help of this SilkTest Interview Questions with Answers guide”



146 SilkTest Questions And Answers

41⟩ How to get the integer value from a string ?

How to get the integer value from a string

print([int]"100")

this returns some different value some 49

need the value 100 to be print

Answer1:

There is one inbuild Silk's function which converts String value into Integer. Try with that

INTEGER iTemp = Val ("100")

Answer2:

Use Val function.....

print (Val("100"))...The int wrapper returns the ASCII value for the string "100"...

 223 views

42⟩ How silktest recognize objects in UI? What it intenally calls to find out that the particular UI element is of which class etc?

Silk recognizes a UI with the tag it assigns to the UI.....There are 5 tags, see silk help for them...Some of it are operating system specific......

Go to Silk-->Record-->Window declaration.......Move the mouse pointer to the object for which you want to know the class.......It is shown in the tree view in the record dialogue box....

You can also do by Silk-->Record-->Window Identifier .....

 223 views

43⟩ An application developed using Dotnet. and 1000 cases recorded for this application. All was working fine until...one fine day... Some one changed the namespaces which are used by this application. The scripts have started failing because it is as good as having a new window or a panel in the application. Obviously, Silk does not recongnise this window. Now is there any way to tackle this problem other than recording the windows all over again.?

Answer1:

First capture few windows and compare the new window declarations with old ones.

And try to find what are the changes in tags (Names) and any layers between windows.

Accordingly you just need to modify the few window identifies and need to include additional windows if any. ( you need not to touch your 1000 testcases ). Long back I had same problem with this method I solved.

Answer2:

If you are very sure that only the namespace name change has impact on the scripts then I can suggest you one approach.

I am assuming the following, Suppose the previous namespace name is "x" & now it is "y". And all your scripts are in a single folder say "F"

You need to write a script in any language C# or our own 4T language, that need to search all through the folder "F" and replace all the "X" with "Y" in each and every file.

This is the general way I go ahead when need to update one object in n number of files.

 251 views

44⟩ I have a GUI similar to Find Dialogue Box in Notepad..... Here the Check Box Match Case is recognized as Push Button and I want to check whether the check box has been checked or not..... I can not map a standard class PushButton to another class "CheckBox"....In the Window declaration I manually changed the PushButton class to CheckBox class but not working... Please suggest any solution?

Answer1: 1. Try to find the class of that object by using Window Identifier. Sometimes it already mapped.

2. If it is developed by VB or C++, try to use ActiveX properties.

Question 2:

I checked and the class is not mapped..... The application has been developed in C++.....can you share some information on how to use ActiveX properties using Silk....

Answer2:

I think, you have to add your application in the extension enabler and check ActiveX Properties. See the help for " ActiveX: enabling support for"

 250 views

46⟩ How to Setting Max value?

Here's the function you need to verify that an object (TextField) accepts a max char limit.

[code]

[+] boolean VerifyMaxChars (window wTarget, integer iMax, string sChar optional)

[ ]

[ ] string sText = ""

[ ] string sComp

[ ]

[+] if sChar == null

[ ]

[ ] sChar = "A"

[ ]

[ ]

[ ] sText = Replicate (sChar, iMax)

[ ]

[ ] wTarget.TypeKeys (sText)

[ ]

[ ] sComp = wTarget.GetText ()

[ ]

[+] if sText != sComp

[ ]

[ ] Verbose ("Verify Max Chars failed, expected number {iMax}, actual {Len (sComp)}")

[ ]

[ ] return false

[ ]

[ ]

[ ] sText = Replicate (sChar, iMax + 1)

[ ]

[ ] wTarget.SetText (sText)

[ ]

[ ] sComp = wTarget.GetText ()

[ ]

[+] if sText == sComp

[ ]

[ ] Verbose ("Verify Max Chars failed, expected number {iMax}, actual {iMax + 1}")

[ ]

[ ] return false

[ ]

[ ]

[ ] return true

[ ]

[/code]

 212 views

47⟩ Can SilkTest switch browsers automatically?

You can, but there's a few steps that need to be done.

You need to use Organizer to do this. There you can re-run the same testcases but at the top open a different .opt (options) file. You have to save these 2 opt files though after you set the runtime with Netscape, save the 1st one and save another after you set it up with IE.

Read more about organizer to learn more.

 209 views

48⟩ Is there a better way to generate a random integer than SilkTests RandInt() function?

Is there a better way to generate a random integer than SilkTest's RandInt() function? I need true random numbers that going through a loop will give a diffrent random number each time. How RandInt does it is you get the same number on a fast loop.

I did make a RandomInt() function (see below), which helps on general random numbers since it is using RandSeed(), but on a loop that just grabs some random numbers, I still get the same numbers.

Anyone have a better way?

[CODE]

[ ] // Function: RandomInt

[ ] // Arguments: 1) iMin = Integer of Minimal value

[ ] // 2) iMax = Integer of maxium value

[ ] // Returns: random integer withing iMin and iMax

[-] INTEGER RandomInt(INTEGER iMin, INTEGER iMax, INTEGER iSeed optional)

[ ] INTEGER iRandom

[ ]

[-] if (iSeed == NULL)

[ ] iSeed = GetDateTimePart (GetDateTime (), DTP_SECOND) * GetDateTimePart (GetDateTime (), DTP_SECOND)

[ ]

[ ]

[ ] RandSeed (iSeed)

[ ] iRandom = RandInt(iMin, iMax)

[ ]

[-] if (DEBUG)

[ ] print ("Random Seed = {iSeed} Random Int = {iRandom}")

[ ]

[ ] return iRandom

[ ]

[/CODE]

Answer1:

Most programming languages provide random number based on what is called a pseudo-random sequence. This provides the appearance of random selection via a list that is seeded automatically by the system or by a command by the programmer. Either way it is still a randomized repeating list.

I don't know what to tell you except that you could try to reseed the generator after some number of iterations. the number of iterations could be randomized to vary the reseed interval. The seed could be based on a number representing the number of seconds (in integer form) since some fixed point in the past. This process probably would not repeat but sequences of integers could repeat unless the pseudo-random sequence is itself randomized by the seed instead of just the starting point within the sequence. I don't know the answer to that one. Otherwise your best hope might be a dll designed to provide a random number.

Answer2:

Try to have your function sleep a random time (1-3 seconds or so) and after the sleep call the RandInt () function.

You sort of call the RandInt twice one in each other. that doubles your Randomness chances.

 251 views

49⟩ How to select a group of test cases in a testplan to run?

Usually, a testplan contains a big number of test cases. For some reason, you don't want to run all test cases in the testplan. You want to select a group of test cases and run them:

1. Open the testplan.

2. Select the test description line (linked to the testcase) to mark.

3. Click Testplan/Mark menu. The selected test description line is marked.

4. Repeat this process to select more linked testcases.

5. Click the Run/Run Marked Tests menu. SilkTest runs all the marked testcases.

6. Do not touch mouse or keyboard, to avoid interrupting the test case execution.

7. SilkTest finishes executing the testcase. The Restuls window shows up with the execution result.

8. Review the execution result.

 222 views

50⟩ How does Silk do with People Soft applications?

Two questionsfor Web and Application testing (People Soft)

[(1) Can Silk concurently drive BOTH a web application and a People Soft Application. Assuming I do not use appstates.

(2) How does Silk do with People Soft applications. Anyone out there have any war stories (good and bad) about this? I know people soft employs SQA and only SQA for this type of testing.

(3) When I do record the few People soft apps (for subsequent programming of tests) the recording is very slow. Also there are frequent agent freeze ups during a record session. The only way around this has been to reboot my machine.

I do not have any specific knowledge of People Soft applications but if you can see object with the recorder there should not be to many differences to other mixed application test scripts.

1) Yes Silk can drive both a web application and another application(such as People Soft)

I would recommend creating frames in separate *.inc files and then commenting out the const wMainWindow variable on the secondary application (I suggest the People Soft app as you can then use the default browser settings to assist in setting default states). The wMainWindow indicates what application to use for base states. This allows you to use application states if you need to. You can modify the default state to also start up the People Soft application. I have written scripts to manage browsers and FTP clients. This was quite successfull. The FTP clients were not web based (CuteFTP).

2) I don't know the specifics about this one. If you can automatically identify all of your object or Class map them effectively there should not be any large problems with using Silk with People Soft Applications. Our company has its own product called OpenUI for GUI design and Silk performs fine with it. We map our OuiFrames to VBFrames and the remainder of the objects are identified correctly. We have had a couple of strange things (tags altering) but nothing that could not be identified and worked around. We have quite a large suit of test cases. If you can record the object on the screen and they are identified as Text fields, Windows, buttons etc correctly you should not experience any large problems using Silk with People Soft products.

3) The recorder freezing up is quite common for everyone (at least everyone I know). If you are on NT you should only have to log out and back in again. If on Win 95/98, yes you will need to reboot. It is a real pain. I am getting nervouse about demonstrating the recorder to prospective customers. The good news is that Segue is addressing this issue with the recorder as we speak so I assume it should be resolved in future releases. (I am not from Segue so this is not an official statement, just heared it on the grapevine.) The speed of the recorder should not be a long term problem as these types of tools are really not good past the inital development stages. The are too limited and dont structure the code correctly. I have had problems with speed particulary associated with the freezing. It seems to slow down to about one micro instruction a second which is very frustrating.

 213 views

51⟩ Is this correct behavior for Silk or one of the idiosyncrasies of my non-standard windows?

When I extended the delay I noticed that Silk is a bit bizarre in the way it selects a sub menu item. For example, if you're selecting the first sub menu off the first menu item Silk drops down the menu, highlights the last item then back to the top and finally selects the sub item. Is this correct behavior for Silk or one of the idiosyncrasies of my non-standard windows app?

Answer1:

If I recall correctly, this behavior is a symptom of having changed the "Events used to invoke popup menus" string in the Agent Options/Other tab. Its default value is set to an unintuitive "<Button 2><Up><Down>". However, if you change it to "<Button 2><Down><Up>" it will perform as you describe.

Answer2:

If you select Options->Agent, then select the "Other" tab, you'll see a couple of checkboxes: "Pick menus before getting menu item information" and "Pick dropdowns before getting menu item information". I'm guessing that you have these checked by the behaviour you are describing. If you uncheck them, Silk won't check all of the menuitems before it does the Pick().

 222 views

52⟩ How can I access empty string from excel sheet?

customize code like this

Solution1:

==========

[-] if sText!=NULL

[ ] Page.tfldName.SetText(sText) // do the operation

[-] else

[ ] Page.tfldName.CleartText()

Permanent solution: Add the below winclass to your code(if it is web application simply paste it, else make HtmlTextField as TextField), Now Text field will not raise exception on null value.

[-] winclass HtmlTextField: HtmlTextField

[ ]

[-] void SetText(String sText optional)

[+] if sText==NULL

[ ] this.ClearText()

[+] else

[ ] derived::SetText(sText)

 226 views

53⟩ Need help regd. silk test runing thr .bat file on cmd prompt?

<Plan File path> - Enter Plan File Path - e.q - c:test

<Plan File Name> - Plan File Name - e.q - sample.pln

syntax :

"C:Program FilesSegueSilkTestpartner.exe" -r "<Plan File path><Plan File Name>.pln"

e.q

"C:Program FilesSegueSilkTestpartner.exe" -r "c:testsample.pln"

Copy above line in .Bat file or run this line in Command Prompt.

 215 views

54⟩ Need to get file size for a file present on Unix machine , thr silktest at run time. How to get it ?

Answer1:

SilkBean is used for working in unix...I haven't used it....See help...the steps for silk bean settings are mentioned there....

Otherwise, considering telnet window (whatever used for connection) as a DialogBox, automate the steps using TypeKeys()..

Answer2:

I guess SilkBean can be used ONLY with Java based applications :-?

I saw help in ST help .... as it looks too much .. for my simple task of getting a *file size *of one of the file on Unix machine ...

I would like to know the WAYs i can get file size OR properties of a file on Unix machine through ST ?

Anyways , but SilkBean looks nice solution for same ..

also how can i execute some application thr' ST ? lets say cmd prompt < * cmd.exe >*

Answer3:

Use SYS_Execute ("C:/Vaibhav/xyz.exe") if xyz.exe is lying at C:/Vaibhav

For standard commands there is no need to separately invoke Dos Command Prompt.....

e,g SYS_Execute ("echo %USERNAME%", lsOutput) would return the user name in the lsOutput variable...

Answer4:

How would you do this if you were running the test manually?

I suspect that you would open a terminal application and perform an ls -l You might also pass that through grep or awk.

We use cygwin under windows to perform bash shell scripts here so here's what I would do

You may need to create a system variable for your path to cygwin binaries or one directly to bash.exe, but if you install it normally, the bin directory will be exposed to the command line environment.

ls -l //servernamepathfilename | gawk '{print $(6)}'

encase that in a SYS_Execute () and parse the results

[ ] INTEGER iFileSize = SYS_Execute ("ls -l //servernamepathfilename | gawk '{print $(6)}'",lsSysResult)

You're set.

I haven't tried this, but it should work.

Answer5:

If its only a file size u need, and need to get it from a telnet session, read on....

putty is a windows client with which one can connect to a Unix/Lx m/c using standard telnet or ssh. Its easy to automate this UI on windows. If you enable logging to a file (the file saved on the windows client), all the telnet session is captured to this file. One can then get the file size or whatever the results of the commands run on the unix m/c over telnet. Even easier is the Hyper Terminal Program which comes with Windows.

Both PUTTY and HTERM give you a Windows UI and not the cmd prompt, which some people may find hard to automate

 239 views

55⟩ I ca not simple use DialogBox ( ).Close () from some reason it is not working?

I have a button that upon clicking on, pops a second BrowserChild. This window however does not have the usual toolbar. It is actually generated by a javascript function (openWindow). How do I close that window. I can't simple use "DialogBox (" ").Close ()" from some reason it is not working.

The trully depends on how the second window is declaried.

I work with browsers that have popup windows (using JavaScript) that contains no Browser characterists (no toolbar, status bar, location, etc). So, Silk views the browser as a dialog, but declaring it as a dialog, it fails. It also see's a browser inside. So, I let Silk declare it as a dialog and typically get something like:

[code]

[-] window DialogBox DBCreateOffer

[ ] tag "Requisition Create?Edit"

[-] window BrowserChild BCCreateOffer

[ ] tag "Create Offer"

[ ] parent "CustomBrowser"

[/code]

I then modify the declaration that Silk made and make the BrowserChild part of the dialog:

[code]

[-] window DialogBox DBCreateOffer

[ ] tag "Requisition Create?Edit *"

[-] BrowserChild BCCreateOffer

[ ] tag "Create Offer"

[/code]

I can then close the browser "dialog" by calling:

DBCreateOffer.Close()

 199 views

56⟩ Sessionids problem

[I am running a script on a webbased application...so many use cases are there in my excel sheet....once the checking for the errors I have to go through next iteration...but sessionids are still present in the browser and disturbing entire process.. what can I do through script itself I am clearing temp internet files,deletecookies etc.. even though I am getting problem ]

To go to next iteration (login) you make sure you logout for the previous login....

Before login, use ClearCache () and see whether it works or not....

 222 views

57⟩ Getting following error on selecting an item from a ListBox?

Getting following error on selecting an item from a ListBox (JavaJFCListBox)

[ ] *** Error: Control is not responding

[ ] Occurred in Select

[ ] Called from LetterEditTool at FabEditorScript.t(1060)

Sometimes it works fine.....

Any suggestion?

This is a catch-all error message. It usually occurs in a Select( ) statement when SilkTest is trying to select an item from a ListBox, TreeView ListView, etc.

Set the following option just before the line causing the error: Agent.SetOption(OPT_VERIFY_RESPONDING, FALSE)

 199 views

58⟩ How to read .xls file contents without using the ddt wizard?

How to read .xls file contents without using the ddt wizard? [the result file is result.res Parsed it to result.rex file such that I can read this file The test case file is testcase.xls

Now I need to search the contents of that file and next to the cell I need to update the result of the rex file

I succeeded to read a .rex file

Now I need to know is there any simple way to read the xls file and need to update this file

I tried with one approach and further i strucked

[ ] STRING gsDSNConnect = "DSN=Segue DDA Excel;DBQ=C:abcdef.xls;UID=;PWD="

[ ] HDATABASE DBHandle

[ ] HSQL SQLHandle

[ ] DBHandle=DB_Connect(gsDSNConnect)

[ ]

[ ] SQLHandle=DB_ExecuteSql(DBHandle,"select ")

From here on wards I didn't got the idea how to read the contents of .xls file)

[-] List of anytype ReadingDataFromXLS(string sFileName,inout anytype aRecordName, string sQuery optional)

[ ]

[ ] List of anytype lrRecordData

[ ]

[ ] HDATABASE hdbc

[ ] HSQL hstmnt

[ ]

[ ] string sFilePath = "{sFileName}.xls"

[-] do

[ ]

[-] if (!SYS_FileExists(sFilePath))

[ ] Log.Write("File does not exists in specified path i.e {sFilePath}, Please check the existance of the file.","ERROR")

[-] else

[ ]

[ ] // connect to xls file

[ ] hdbc = DB_Connect ("DSN=Segue DDA Excel;DBQ={sFilePath}")

[ ]

[-] if (sQuery != NULL)

[ ] // retrieve info from Excel worksheet

[ ] hstmnt = DB_ExecuteSql (hdbc, sQuery)

[-] else

[ ] // retrieve info from Excel worksheet

[ ] hstmnt = DB_ExecuteSql (hdbc, "SELECT * FROM `Sheet1$`")

[ ]

[ ] //Loop through excel file for retriving the data

[-] while (DB_FetchNext (hstmnt, aRecordName))

[ ] ListAppend(lrRecordData,aRecordName)

[ ]

[ ] //release SQL stmt resources

[ ] DB_FinishSQL (hstmnt)

[ ]

[ ] // Disconnect

[ ] DB_Disconnect (hdbc)

[ ]

[ ] //return the excel data in record structure

[ ] return lrRecordData

[ ]

[-] except

[ ] Log.Write("There may be problem in reading the excel file.. Please close all opened Excel files","ERROR")

 222 views

60⟩ How to access script from other machine?

Share the folder containing the script......very simple.... You can run the script from your machine and target may be some other machine using connect ()... But somebody else cannot access unless you share or try other options...

 208 views