101. 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...
103.Any ideas how to customize the default recovery system in order to close dialog boxes ...
Any ideas how to customize the default recovery system in order to close dialog boxes that are parented not to MainWin but to ChildWin would be greatly appreciated.
The default recovery system only checks those dialogs that are parented to the MainWindow specified in the wMainWindow constant.
the problem is that I want to use any recovery system that will allow me to close dialog boxes that are parented not to MainWin and I need some hints on this (using dll functions like GetForegroundWindow(), or something else).
Windows NT 4.0 with SP4, and SilkTest 5.0.
Answer1:
Well, this wouldn't be changing the default recovery any, but you could use an appstate that is basedon none rather than basedon DefaultBaseState.
Answer2:
Create a global variable
lwClose = {...}
Windows to close
and add a
TestcaseExist ()
window wClose
for each wClose in lwClose
if wClose.Exists ()
wClose.Close ()
Answer3:
Here's what you do,
In a given tree structure like this:
Win1 Win7
Win2 Win3 Win8 Win9
Win4 Win5 Win6
Notice that Win7 and Win1 have 2 different threads,
Whenever you declare a window: You just add it to the lwClose list.
Here's How: (assuming you just want to keep Win1 open
lwClose = {...}
Win9
Win8
Win7
Win6
Win3
Win5
Win4
Win2
That way you create your tree threads.
Or you can create a fancy Dismiss ()
which does the following:
for i = 1 to ListCount (lwClose)
do
for each wClose in lwClose
wClose.Close ()
except
do nothing (this is incase you cannot close a window before another
Answer4:
I haven't tried this, but, could you create your own ScriptExit or TestcaseExit function that overrides the ScriptExit or DefaultTestcaseExit?
Or could you use the lwLeaveOpen defined in your MainWin and put the dialog name there? Perhaps you could make the variable lwLeaveOpen *not* const and then in either ScriptExit or TestcaseExit put the dialogs you want to leave open. And/or use the GetNextCloseWindow method to close everything down to the dialog you want to leave open.
To get a better understanding of how the recovery system works, I suggest you read the defaults.inc file (but I don't recommend editing it; use ScriptExit or TestcaseExit to override it).
104. I want to remove printing of this script of the test case in result window. How can I do this?
In the Result Window page once after case is passed, along with the Results what I am printing, script inside the test case is also printing line by line.
I want to remove printing of this script of the test case in result window. How can I do this?
Answer1:
In Option --^gt; Runtime dialogue Box, at the result section there are several check boxes....Depending on your selection result is generated..... Check/Uncheck the boxes as per your need.....
To be more specific; In Option -> Runtime dialog ; uncheck 'Print agent calls' and 'Print tags with agent calls' under the head 'Debugging'
Answer1:
Execute the test plan:
"C:\Program Files\Segue\SilkTest\partner.exe" -q -resextract -r
"C:\BVT\Build Verification Test.pln"
This creates a binary results file called Build Verification Test.res and a text results file Build Verification Test.txt.
Then from the batch file that called the script I make a call to head head -n1 "c:\BVT\Build Verification Test.txt" > "c:\BVT\Build Verification Test Summary.txt"
That gets me the first line, (Pass/Fail) I could make the -n switch larger to get all of the elements.
I then use a product called blat to e-mail that summary to my inbox along with the entire results as an attachment.
This way I don't have to print the results at all.
The version of head I use is part of cygwin. Here's where you get blat http://www.blat.net/
Note: What is Blat?
Blat is a Win32 command line utility that sends eMail using SMTP or post to usenet using NNTP.
106.What is the solution for this?
In the application, identify the objects in framefile. Suppose if one the abjects is custom object, you map custom object to standard object. Even after mappiing the custom object to standard object if the silktest does not idenify the object. What is the solution for this?
First you have to try by enabling various extensions so that the application could be recognized....Even if not possible, the last option is co-ordinates.....but these are not very much reliable unless done properly.....
106.What is the solution for this?
In the application, identify the objects in framefile. Suppose if one the abjects is custom object, you map custom object to standard object. Even after mappiing the custom object to standard object if the silktest does not idenify the object. What is the solution for this?
First you have to try by enabling various extensions so that the application could be recognized....Even if not possible, the last option is co-ordinates.....but these are not very much reliable unless done properly.....
106.What is the solution for this?
In the application, identify the objects in framefile. Suppose if one the abjects is custom object, you map custom object to standard object. Even after mappiing the custom object to standard object if the silktest does not idenify the object. What is the solution for this?
First you have to try by enabling various extensions so that the application could be recognized....Even if not possible, the last option is co-ordinates.....but these are not very much reliable unless done properly.....
107. How to sort List of List of String?
[+] testcase test() appstate none
[ ]
[ ] LIST OF LIST OF STRING llsStr =
{{"1234","A"},{"2242","B"},{"2234","C"}}
[ ] Print(Sort(llsStr))
[+] LIST OF LIST OF STRING Sort (LIST OF LIST OF STRING llsStr)
[ ]
[ ] LIST OF STRING lsStr
[ ] INTEGER i, j , k
[ ] k = ListCount(llsStr)
[+] for (i=1;i <= k;i++)
[+] for (j=i+1; j<=k; j++)
[+] if val(llsStr[i][1]) > val (llsStr[j][1])
[ ] lsStr = llsStr[j]
[ ] llsStr[j] = llsStr[i]
[ ] llsStr[i] = lsStr
[ ]
[ ]
[ ] return llsStr
108. How to write a Masterplan?
Answer1:
Yes, you can run all your sub-plans using master plan approach.
You just open new plan file and call your subplan/testcase from this file.
if you want to run subplan from master plan then sysntax is like
include: mysubplan.pln
Answer2:
1. Open your master plan,
2. You can mark the neccessary subplans.
3. Run the marked one from Master Plan
How to mark the subplans
1. select the entire line of subplan in the master plan (ex. include:
subplan1.pln)
2. goto TestPlan menu -> select "mark" in that.
3. like this mark all the neccessary sub plans in the Master Plan.
4. goto Run menu -> select "Run marked tests".
that's it, silk will just run the marked subplans only... in the final
result file you can easily make out the color differnece .. which plan runned .. which one not runned..
109. How to hide Password in the script file?
In Winrunner, the password is recorded in the encrypted form but in Silk it is recorded as it is.....
Can't be done right within the script, but if you want to make a work around, you could read it in from a file.
If that's not good enough (the password would be stored in the file in plain text too), you could use a tool to encrypt the password and use that tool to decrypt it. You could then make a call to an external language (Ruby, Perl, Python, etc.) to do the heavy work of encrypting and decrypting the information and pass that through as a variable.
The problem is that whatever method you use to enter the password unencrypted into the login screen can also be used to just write it to a file.
Don't use your own account. Use a dummy, testing account.
110. How can we Increase the virtual memory in Silk Test?
I think the licensing admin UI IS java. You can easily check by using Silk itself. (Try enabling Extensions wizard on the license admin UI). As for Silk the chances are that its MFC, as I have worked with its earlier avataar, Quality Assurance Partner, which itself was there before Java, I believe. That might be the reason it works best with MFC apps..
111. Can anybody explain me, where does logs get stored for an activity performed in Silktest?
Answer1:
Following command will export the log in text format.
"c:\program files\segue\silktest\partner.exe" -complog "c:\logs.txt"
-resextract -r "C:\sample.pln"
Answer2:
By default, Silk doesn't create log files, it create a .res files. They are binary files and .log giles are usually text files.
However if you call partner.exe from the command line with the -resextract it will create a copy of the .res file as .txt.
These files are created in the directory where the .t file or .pln file that is executed are located.
112. What is the meaning of the Automation framework especially in SilkTest?
Automation Framework is a discipline and should have proper design/architecture. You can understand and implement. Automation Framework should have some of following things.
1. AUT Specific libraries
2. Tool wrapper function libraries.
3. Execution Engine (Script Execution should be drived based on given test data) - Data Driven
4. Results reporting mechanisms (PASS & FAIL for each testcases/procedures and compiled results for all. It would be better, if it captured AUT's snapshots) 5. Planning for long term automation.
6. Keeping GUI objects info/declarations dynamically or static.
7. Planned approach of unattended execution.
Also framework design differs by tool, scripting languages and type of AUT etc,. Now a days, people are using PERL, PYTHON, TCL/TK for CLI automation. This design will vary much from GUI specific tool automation's design (QTP, Winrunner, Silktest,Robot and QARun etc).
You can go through following links. Each link is giving different set of components for Automation framework.
113. How to retrieve the decimal part of value stored in float variable. Also how to retrieve the Integer part? Is there a function?
the snippet code for the prob.
[ ] real rVal1=89.822 // Assume your real number is rVal1
[ ] integer iValue = [int]rVal1
[ ] real rVal2= rVal1-iValue
[ ] print(iValue) // Integer part of u r number
[ ] print(rVal2) // Decimal part of u r number
114. How to automate .Net application?
How to automate .Net application?
(I am using Silk v7.5 to automating .net application. But most of the control were not recognized by Silk. when I was forcefully mapped with standard Control then also its not works.)
Try to get .Net Extension... You have to pay separate fee for this Extension.....
115. Is there a way to handle this type of issue...
When click a link the new page(either same browser window or new) that opens doesnot load completely...meaning...the progress bar would stop to progress as shown in the attachment.....Finally the application would timeout after 180 seconds.
One work around for this is to increase the application timeout and wait longer. Can someone suggest a better workaround? Is there a way to handle this type of issue...
Try with browser.StopLoading ( ).....The method works by clicking the Stop button on the tool bar. When the browser is not responding(progress bar stops moving), use a Browser.ForceReady(True) to interact with the Browser and after performign necessary actions(In our case browser.StopLoading ( )..) use Browser.ForceReady(False)
116.I would like to verify the title of the new browser window that just popped after clicling link ....
I am not using any frame file with my scripts.I dynamically get all the links in a web page and click on the link I want to, by matching its caption....The problem I am facing is that, when I click a link "x" on a webpage it opens a new browser window.I would like to verify the title of the new browser window that just popped after clicling link "x".Since I am not using frame file I find it difficult to retrive the title of new browser window.....Any solution ?
Ttry with GetCaption ()....
BrowserPage.Getcaption () --> It would return the caption/title of the page...Compare it with the expected value...
Yes, here you have to make sure that the new invoked page gets the attention.....
BrowserPage.SetActive ()
BrowserPage.Getcaption ()
if
the caption is not same as the initial page, this is the new invoked page and what you desire
else
Desktop.TypeKeys ("")
if
if BrowserPage.IsActive ()
get the caption and check as earlier
else
Desktop.TypeKeys ("")
This is just a rough algol, you have to implement it with appropriate loop so that it becomes independent of the number of currently invoked windows....
Continues in next page
117.When I try to enable extensions for my browser i.e. IE, the following error occurs,
When I try to enable extensions for my browser i.e. IE, the following error occurs,
"Can't load helper qaphlpr.dll: The specified module could not be found."
My question is, does this mean that the SilkTest needs to be installed again or if there is any workaround.
Check whether the required dll is in the silk test installation folder.
118.Trying to create a datadriven tests ...
Trying to create a datadriven tests. Placed the .xls file in a data folder. The script should connect to the .xls file, open the file, read the contents in the .xls file and fill the form with the values. I have written some steps using the Help guide. Its not working i get errors Can any one suggest me the list of steps and in which folder these steps should go.
The following error:
C:\Program Files\Segue\SilkTest\examples\frame .inc(2): Window class BrowserChild is not defined or ambiguous
Database connectivity - Found word(s) list error in the Text body
the following error now:
Error: Variable (frmCompanyName) has not been set
Also I did the variable declaration as follows
[-] testcase DD_Test1 (REC_DATALIST_DD_Test1 rData)
[ ] STRING frmCompanyName
[ ] STRING Phone
[ ] STRING Contact
[ ] STRING Title
[ ] STRING Insights
[ ] STRING CoInsights
This looks like more of a scoping issue in Silktest than a problem with any DB connection to an excel file. Since I am heading out the door in just a few, I will have to take a closer look at this tommorow but typically, my data driven scripts are structured sort of like:
[ ] //this reads the data from the spreadsheet and then iterates
[ ] use "P:\Silk\au\includes\autoarch_temp.inc"
[ ]
[-] main()
[ ] HANDLE hDB
[ ] HANDLE hSQL
[ ] STRING sFirstName, sLastName, sAddress, sEmail, sComment, sExpected, sItem
[ ] INTEGER iCase, iPF, iRun
[ ] LIST OF STRING lsCases
[ ] STRING sQuery = "Select * from `Sheet1$`"
[ ] //open spreadsheet:
[ ] hDB = DB_connect ("DRIVER=Microsoft Excel Driver (*.xls);DBQ=P:\QA\Release\11.1\AU\Automation\contact_validation_words11_ 1.xls; READONLY=FALSE")
[ ] hSQL = DB_ExecuteSQL(hDB, sQuery)
[-] while DB_FetchNext(hSQL, iCase, sFirstName, sLastName, sAddress, sEmail, sComment, sExpected, iPF, iRun)
[ ] //print("{iCase} {sFirstName} {sLastName} {sAddress} {sEmail} {iRun}")
[-] if iRun == 1
[ ] ListAppend(lsCases, "{iCase}|{sFirstName}|{sLastName}|{sAddress}|{sEmail}|{sComment}|{sExpec ted}|{iPF}|{iRun}")
[ ]
[ ] DB_FinishSql (hSQL)
[ ]
[-] for each sItem in lsCases
[ ] TestContactInfo(sItem, hDB)
[ ]
[ ]
[ ]
[ ] DB_Disconnect(hDB)
[ ]
//-----------------------------------------------------------
[-] testcase TestContactInfo(STRING sTest, HANDLE hDB optional)
[ ] //logic to feed the functions and methods to run the cases and determine pass/fail.
[ ] //can even write results to the same excel file, if need be.
And of course, there are going to be plenty of people out there with var. setups (plans, suites...)
119.Need to use the relative paths in my SilkTest Project. How to change the absolute paths to relative paths.
Need to use the relative paths in my SilkTest Project. How to change the absolute paths to relative paths. The purpose is that, when package the project, that package can be used on any other machine, irrespective of the paths defined, it should run on that machine too.
Answer1:
Say you have following organization of files
C:\Test\Script\Script.t
C:\Test\WDec\WDec.inc
Now in Scrpt.t file to include WDec.inc, code following
1. use " C:\Test\WDec\WDec.inc" --> Absolute
OR
2. use "..\WDec\WDec.inc" --> Relative [Move one level up from Script folder, then go to WDec folder]
Answer2:
I think if you work with Silk Project, it offers you some out of the box solution for this. If your suite is not implemented as a project, the best option is to use relative path in the Runtime options dialogbox, with the Root of the suite hardcoded.
i.e. Use Path = S:\Suite << S maps to root of the automation suite
and use files are relative .i.e. frame.inc, ..\config\config.inc etc etc
120. Whether it will help you to get good opportunities on Silk after certification?
First of all it is very expensive ....( it cost around Level 1 - $150 + training - Rs 15000 +level 2 - $200)
Second you will learn indepth of silktest in the advanced training which is compulsory to take level 2 exam. Personally I felt this is useful even if you have 5 yrs expericne in silktest you will learn more about complete tool.
Leavel 1 is online and they did not change the question papre for long time. I know few people who are scoring more than 95% just because of that.
Segue certification stratagy is not that great like mercury I felt very bad when I heard few people who doesn't know anytihng about silktest test did their certification. (In india it too bad, I have no idea in another contries).
Sad part is there I konw some people who are able to take exam without paying fee also :( ( guess how strong their training division is )
Finally certification is only useful for decorating your cv. If you really have hands on experience in the tool no need go for certification.
121.I'm trying to run a remote application in Windows 2003. But everytime time I'm getting the following error:....
I'm trying to run a remote application in Windows 2003. But everytime time I'm getting the following error: 122. Executing more than one testcase. suppose in first testcase has one functions that is returning some string value. How to use first test case value into second test case Answer1: 123. How to down load latest silk test trial version? You don't as there are no free downloadable SilkTest trial versions. You must contact Segue sales and they will set you up with an account after you can demonstrate both need and desire to purchase, or at least evaluate. You then download SilkTest using that account. 124. How to launch 2 web application windows simultaneously thru Silktest? Testing a login feature for web application. 125. How to change the absolute paths to relative paths? Need to use the relative paths in my SilkTest Project. How to change the absolute paths to relative paths? (Note:The purpose is that, when package the project, that package can be used on any other machine, irrespective of the paths defined, it should run on that machine too.) 126. How to search for html link? A testcase for creating location. Silktest is reading location as html link. Locations are being stored alphabetically. But there is no tag associated with the latest tag (suppose its cg11). How to search for html link? 127. what if the object is dynamically changing.How does silktest identifies the object? 1. if you are talking about webpages, you can use BrowserPage.FlushCache( ) method. 128. How to validate that the data inserted via silktest is successfully inserted and the record of each user is found in the database? Using silk test to create automated user registration application. How to validate that the data inserted via silktest is successfully inserted and the record of each user is found in the database?
"*** Error: Bad channel to agent call" .
My host and agent machine is running on Windows 2003. I have changed the network option for both Host and Agent machine as TCP/IP and port no 2965. Along with that, I have also changed the Agent Name in the Runtime options by Agent machine IP address and network as TCP/IP. Along with that I have also enabled all the relevent extensions.
If any one can let me know whether I have missed out anything in the configuration or do I need to do something else also. Also has any one came accross this kind of error (marked in red) previously.
Trying to use remote recording and play facility provided by Silk, for the same, agentname/ipaddress of the system, where remote agent needs to be used, should be entrered in the host machine's runtime options.
Use Connect () to connect to the target machine....After you connect to the target, then you don't need the agent at m/c where host is installed....So at host place, agent is local or any thing else doesn't matter....If you don't use Connect (), then you have to mention the remote agent name at the host runtime option...[I think so but I haven't tried this]....Now let us come to remote machine....Here even if you don't have the host installed (only Agent installed) your script would run....The host at remote machine is not used and therefore the settings made on the remote host are irrelevant...Only remote agent is used for interaction and the network should be enabled at remote agent...
If you use "local" in agent-options, recording and playback would be done locally i.e silk host would use local agent to do this thing. But if you use "ipaddress:port", the same would instruct silk-host to use remote agent for record and playback..or simply any activity.
Here is a sample code which runs successfully invokes the notepad at remote m/c [192.168.240.102 <http://192.168.240.102> ] and closes it
[ ] const wMainWindow = Notepad
[ ]
[-] window MainWin Notepad
[ ] tag "*Notepad*"
[ ]
[ ] const sCmdLine = "C:\WINNT\system32\NOTEPAD.EXE"
[ ]
[-] main ()
[ ]
[ ] Connect ("192.168.240.102
[ ]
[ ] Notepad.Invoke ()
[ ] Sleep (2)
[ ]
[-] if Notepad.Exists ()
[ ] Print ("Notepad invoked at remote")
[ ] Notepad.SetActive ()
[ ] Notepad.TypeKeys ("<Alt-F4>")
[ ] Sleep (2)
[-] else
[ ] LogError ("Notepad not invoked")
At the top testcase , to declare something like:
create a global variable gPersonReferenceNumber and pass this into testcases as required.
void TestScriptSetup()
SetAppState ("YOURAPPSTATE")
gPersonReferenceNumber = CreateMinimalTestPerson()
testcase CallGlobalReference() appstate none
string sPersonString = gPersonReferenceNumber
etc
TestScriptSetUp() will be ran prior to CallGlobalReference. You can also include this into your recovery system if need be.
CreateMinimalTestPerson() returns a string value related to PersonID or whatever you would require
Answer2:
1. Use some public (global) variables to store your value
2. Writed testcase to return values, whatever you want and use it in later testcases..
Answer3:
To put it into an ini file or the registry.
Answer4:
Set the values in environment variables by SYS_SetEnv () and use them by SYS_GetEnv () wherever, whenever you want......Global variables also do this, but when you call the test cases from a plan file, global variables get reset......
Other alternative are to store them in a file and use them .
In the first window login will be successful, in the second window it will show error that user is already logged in.
But with the Recovery system set in SIlktest I can only launch One application window at a time.
How to launch 2 web application windows simultaneously thru Silktest?
Browser.Invoke ()
Browser.LoadPage ("URL for login screen")
Browser.WaitForReday ()
// Do login
Browser.Invoke ()
Agent.SetOption (OPT_VERIFY_UNIQUE, FALSE)
Browser.LoadPage ("URL for login screen")
Browser.WaitForReday ()
// Attempt to login and verify the message
Agent.SetOption (OPT_VERIFY_UNIQUE, TRUE)
Browser.TypeKeys ("<Alt-F4>")
Silk Projectoffers you some out of the box solution for this. If your suite is not implemented as a project, the best option is to use relative path in the Runtime options dialogbox, with the Root of the suite hardcoded.
i.e. Use Path = S:\Suite << S maps to root of the automation suite
and use files are relative .i.e. frame.inc, ..\config\config.inc etc etc,
Below function is related to HTML Table. This function checks whether passed link-name is HTML link or not. "this" paramter is refered as "HtmlTable".
[+] BOOLEAN IsHtmlLink(STRING sLinkName)
[+] do
[ ] INTEGER iColCnt=0,iRowCnt=0,iNextCCnt,iNextRCnt
[ ] BOOLEAN bflag=FALSE
[ ] iColCnt=this.GetColumnCount()
[ ] iRowCnt=this.GetRowCount()
[ ]
[-] for (iNextRCnt=1;iNextRCnt<=iRowCnt;iNextRCnt++)
[-] if !bflag
[-] for (iNextCCnt=1;iNextCCnt<=iColCnt;iNextCCnt++)
[-] if (this.HtmlColumn("#{iNextCCnt}").GetRowText(iNextRCnt) == sLinkName
)
[-] if (Trim(this.HtmlColumn("#{iNextCCnt}").HtmlLink("#{iNextRCnt}").GetLocation()) !="")
[ ] bflag=TRUE
[ ] break
[ ]
[-] else
[ ] break
[ ]
[ ] return (bflag)
[-] except
[ ] return (FALSE)
2. You can use multitag concept
Answer1:
After inserting the record at the same time you can check that the record has been inserted or not.... say you are inserting the record with Insert statement (SQL) and after insert statement you can validate whether the select statement returns any record or not. If it returns the proper record, proceed or display error or whatever you wan't to do..
Answer2:
You can use database functions to connecto to your database and veryfy the data against the submitted data in the registration screen.
SilkTest supports relational data bases so you connect then through ODBC. check the help for db_connect(),db_fetch() etc. funtions
Answer3:
Your intention is to verify the data integrity in the DB for a single registration. There are couple of ways to do that. One being, if you have a list of registrations provided from UI, after the registration is done successfully, go the listing page and select the particular record and go to the properties of it and compare the values against the corresponding values given during the filling of registration form. The second way is that, try to write a query(as simple stored procedure) in the db that displays all the values for a single registration and call that stored procedure from silk test using data driven functions. For the help on data driven functions, refer to the online help. This is the only best way to learn silk test. You'll not find code samples on net.