Showing posts with label solution. Show all posts
Showing posts with label solution. Show all posts

Saturday, January 30, 2010

Indian Stock Quotes through Selenium

I thought to get the current indian (NSE) stock quotes by using Selenium tool. I chose Selenium RC and Java language. I have developed a java class for all file related tasks. Another java program used to get the stock values from set of given scrips.

Selenium RC required set of configuration to run the tests. We need to give the proxy details (with or without proxy) for internet connection. I'm planning to cover the configuration in upcoming posts. Below I have given the java code to get current stock values.

Current Stock quotes - Selenium RC with Java
Note: FileHandlerLib class - file related tasks.

/* To get all stockquotes * To Compile: javac GetAllStockQuotes.java -Xlint:unchecked * To Run: java junit.textui.TestRunner com.palani.tests.GetAllStockQuotes * To Run: java GetAllStockQuotes * Note: Recompile with -Xlint:unchecked for details. * javac FileHandlerLib.java -Xlint:unchecked */ package com.palani.tests; // import FileHandlerLib; import com.palani.utils.*; import com.thoughtworks.selenium.*; import junit.framework.*; import java.util.regex.Pattern; import java.io.*; import java.util.*; import java.text.DateFormat; import java.text.SimpleDateFormat; public class GetAllStockQuotes extends SeleneseTestCase { private Selenium selenium; private FileHandlerLib fhNew = new FileHandlerLib(); // @Before public void setUp() throws Exception { selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "http://www.nseindia.com/"); selenium.start(); } // @Test public void testGetAllStockQuotes() throws Exception { // Variables String sScripsFile; String sQuotesFile; String sUrlPart; String sCurrentDate; String sQuote; String sQuoteValue; String sOutput; ArrayList aData = new ArrayList(); // Initialization // sCurrentDate = "20100101" ; sCurrentDate = fhNew.getDateTime(); sQuotesFile = "D:\\Stocks\\"+sCurrentDate+"_stocks.txt"; fhNew.DeleteFile (sQuotesFile); sScripsFile = "D:\\Stocks\\StockScrips.txt"; sUrlPart="/marketinfo/companyinfo/companysearch.jsp?cons="; aData = fhNew.ReadFileToArray (sScripsFile); Object[] elements = aData.toArray(); System.out.println ("SCRIPs File: " + sScripsFile); System.out.println ("Quotes File: " + sQuotesFile); selenium.open("/content/equities/cmquote.htm"); Thread.sleep(2000); for(int iIndex=0; iIndex < elements.length ; iIndex++) { sQuote=(String)elements[iIndex]; sQuote=sQuote.trim(); sQuoteValue = "0"; System.out.println("Quote:"+elements[iIndex]+ " ,index: " + iIndex); if (!(sQuote.equals("") ) ) { if (selenium.isElementPresent("companyname")) { selenium.type("companyname", sQuote); } else { selenium.type("company", sQuote); } selenium.click("submit1"); Thread.sleep(2000); for (int second = 0;; second++) { if (second >= 150) System.out.println("timeout"); try { if (selenium.isElementPresent("//div[@id='PI4']/b")) { sQuoteValue = selenium.getText("//div[@id='PI4']/b"); System.out.println ("Quote Value: " + sQuoteValue); sOutput=sQuote.trim()+","+sQuoteValue.trim(); fhNew.FileWrite (sQuotesFile,sOutput); break; } // end if } catch (Exception e) { System.out.println("Selenium Run: " + e.getMessage() + "\n"); e.printStackTrace(); } Thread.sleep(1000); } } // End If } // end for loop } // @After public void tearDown() { selenium.stop(); } // To run Selenium Testcase using JUnit public static Test suite() { return new TestSuite(GetAllStockQuotes.class); } // To run Selenium Testcase public static void main(String args[]) { junit.textui.TestRunner.run(suite()); } }

Sunday, September 27, 2009

Extract info from Logs

One of my projects used to update set of log files for each action and scheduled actions. Exceptions are logged in those log files. Log file size is maintained upto 5 MB. We are unable to get the proper logs, if scripts are running more than 15 minutes. Entire suite runs almost 75 hours continuously.

Many times, we were unable to re-look at the exceptions in the logs for particular test case failed time. I thought to develop a vbscript to capture the exceptions from log file for frequent intervals and then write into another text file. It can be used for manual testing too. Here I made two things. First is, script has to parse the log file for the given string. Second is, script should not update the log information, which is already available. I meant, the same information should not be added multiple times.

Code to take only unique info It returns the information as Array. Array size is determined in run-time.


'-------------------------------------------------------------------------
' Method : TrimArrayToExtract
' Author : T. Palani Selvam
' Purpose : Remove the array elements based on given info (sItemToCheck).
' Parameters: arrInput - Array String, Contains logging message.
' sItemToCheck - String, to check the element match. Last element in the text file
' Returns : String - Array. Returns remaining elements from the given array.
' Caller : - Nil
' Calls : - Nil
'-------------------------------------------------------------------------
Function TrimArrayToExtract (arrInput, sItemToCheck)
Dim iArrItem
Dim sTemp
Dim arrOutput()

iIndex=0
If (IsNull(sItemToCheck) Or IsEmpty(sItemToCheck) Or (Trim(sItemToCheck)= "")) Then
TrimArrayToExtract=arrInput
Exit Function
Else
If (IsArray(arrInput)) Then
'If (Not (IsNull(arrInput) Or IsEmpty(arrInput)) And (UBound(arrInput)> 1)) Then
If (Not (IsNull(arrInput) Or IsEmpty(arrInput) Or (UBound(arrInput)=0)) ) Then
'WScript.Echo "ArrInput : " & arrInput
For iArrItem=0 to UBound(arrInput) ''-1
ReDim Preserve arrOutput(iIndex)
sTemp=arrInput(iArrItem)
If (sTemp=sItemToCheck) Then
iIndex=0
Erase arrOutput
Else
arrOutput(iIndex)=sTemp
iIndex=iIndex+1
End If

Next
End If
End If
End If

TrimArrayToExtract=arrOutput

End Function


Code for Extracting the information from Log file It returns the information in Array.

'--------------------------------------
' Method : ExtractInfoFromLog
' Author : T. Palani Selvam
' Purpose : To extract the lines from a log file based on given info.
' Parameters: sFileName - String, contains the log filename with full path.
' sInfo2Extract - String, Info to search.
' Returns : Array of String
' Caller : - Nil
' Calls : - Nil
'--------------------------------------
Function ExtractInfoFromLog (sFileName, sInfo2Extract)

Dim objFSO, objTextFile, sLine
Dim iPos
Dim arrExtract()
Dim iLinesToDo, iArrIndex, iLimit

Const ForReading=1
Const NoOfLines=10


iArrIndex=0
iLinesToDo=0
iLimit=1

Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(sFileName) Then

Set objTextFile = objFSO.OpenTextFile(sFileName, ForReading)

Do while Not objTextFile.AtEndOfStream
sLine = objTextFile.ReadLine
'Wscript.Echo sLine
If (iLinesToDo > 0) Then
arrExtract(iArrIndex)=sLine
iLinesToDo=iLinesToDo-1
iArrIndex=iArrIndex+1
Else

iLinesToDo=0
iPos=InStr(sLine,sInfo2Extract)
'WScript.Echo("iPos " & CStr(iPos))
If (iPos>0) Then
'WScript.Echo("Entered into If loop to extract from line: " & sLine)

'' iLimit = UBound (arrExtract) + NoOfLines
iLimit = iLimit + NoOfLines
ReDim Preserve arrExtract(iLimit)

arrExtract(iArrIndex)=sLine
iLinesToDo=NoOfLines-1
iArrIndex=iArrIndex+1

Else
iLinesToDo=0

End If
End If

Loop

End If

objTextFile.Close

Set objTextFile = Nothing
Set objFSO = Nothing

ExtractInfoFromLog=arrExtract
End Function

Note: Few user-defined functions might be used.

Sunday, September 20, 2009

Is KeyWord Driven Framework enough?

Recently I heard the term Key-Word Driven Framework from many testing people. Even people are showing interest to know about it and to implement it. Sometimes people are saying unknowingly as Keyboard Driven Framework.

Few months back, I have implemented Keyword Driven framework in one of our projects. We are using Silktest and data files are kept in XML format. The other automation team members also impressed with this kind of implementation. I found this article Automated Testing Institute - Building A Keyword Driver Script In 4 Steps useful to the professionals, who wants to implement KeyWord Driven framework.

After that the expectation goes to implement KeyWord Driven Framework to all automation projects. I am not against to Keyword Driven Framework. It can be used for many projects. But it is not the only one solution for all our automation issues or dependencies. For example, chart automation. For charts, verification will be different and It is difficult to generalize. May be Flex charts can be used if tools are able to identify all parts of charts. One more is unlimited Keywords. Assume that one project contains more than 500 keywords and the automation guys should know the functionality for all those words. It is definitely issue, if number of keywords increased beyond the limit. Currently I'm thinking the scenarios, where KeyWord or Table Driven Automation frameworks can not be used or should be avoided. Below I have listed the cases.

  1. More Context based Menus
    The menu items are shown based on the screen and object.

  2. Multiple Application interactions in single project

  3. Total Keywords beyond 200
    Testers should memorize all keywords. It is similar to remember Differential Calculus and Integral Calculus functions. One should remember keywords for action and verification for all set of objects.

  4. Many hierarchies for Object identification.
    It can be solved if testing tool supports X-path for object identification.

  5. Complex data.
    One of my projects required minimum 40 string data to create a report and it is just a first step for any test case. Also the data may change in the future. More than 1000 cases required like that. I can generalize the inputs data and it is difficult to maintain and modify the data.


To know the automation framework concepts, you can go through following links.

Test Automation White Papers
My Thoughts about Automation
What is an Automation Framework - from Dhanasekar's blog
Wikipedia - Test Automation
Wikipedia - KeyWord Driven Testing

Sunday, July 19, 2009

Verifying Email notifications

For long time, I was looking a solution to automate the verification of email contents. It required to verify for few user accounts, attachments like Excel, PowerPoint and PDF docs. We have few critical features, which required to verify email contents and attachments. Silktest does not have any built-in functions for this activity. However I have to find a solution. The solution should supports IE6 and IE7 browsers and Windows 2000, Windows XP and Vista OS. I had four choices in mind. They are,

  1. Using a command line utility
  2. Using MS Office Outlook COM interface
  3. Using Collaboration Data Objects (CDO) Interface with Outlook Express
  4. Worst case - Automate any email client with UI

Automate any email client with UI
This option was last one. Because I do not want to automate with User Interface. We can build the solution in couple of weeks effort. The issue is the changes with that client. I have to look on support for different Operating Systems such as Windows XP and Vista.

Using Collaboration Data Objects (CDO) with Outlook Express
In my first company, I have used CDO with Visual Basic. See my previous post - Checking Mail Notification. I got a surprise, while I was searching information for CDO Help. Microsoft has stopped the updates on Outlook Express. Earlier Internet Explorer Intallation was bundled with Outlook Express.

Using MS Office Outlook COM interface
I am familiar with VB script. I have used Outlook COM interface [CreateObject("Outlook.Application")] earlier. The issue is, the particular user account mailboxes should be opened, while executing VB Script. Also I thought the license and installation costs.

Using a command line utility
I have searched many times and found a utility. GetMail is a command line utility and it is working in all windows OS. It is available at GETMAIL for Windows It is a cheapest and best utility to fit for my requirements.

Different Cmdline switches of GetMail
Getmail has different switches for various purposes. You can opt appropriate switches as per your requirement.
 

GetMail v1.33: WinNT console utility to download a mailbox's mail.
syntax:
Getmail -u <user> -pw <password> -s <server> [optional switches (see below)]
Getmail -install [ see install details below ]
Getmail -profile [-delete | "<default>"] [profile1] [profileN] [-q]
Getmail -h [-q]
Getmail -forceextract filename

-install <server> <userid> <password> [<delete> [<xtract> [<try> [<port> [<profile>]]]]]
: set's POP3 server, login, password, whether to delete or not (Yes/No),
whether to automatically extract base64/7bit/UU encoded files or not (Yes/No),
number of tries and port for profile
(<delete> <xtract> <try> and <port> may be replaced by '-').

-u <userid> : Specify userid on remote pop3 host
-pw <password>: Specify password for userid on remote mail host
-s <server> : Specify mail server (pop3) to contact
-nodelete : Do not delete messages after downloading (default)
-delete : Delete messages after downloading
-noxtract : Do not extract base64/7bit/UU files after downloading (default)
-xtract [defname]: Extract base64/7bit/UU encoded files after downloading messages
defname is an optional default filename for the extracted file
-domainstamp : Prepend sender's domain name to extracted attachments
-headersonly : Download only the headers of the message
-port <port> : port to be used on the server, defaults to POP3 (110)
-p <profile> : send with SMTP server, user and port defined in <profile>.
-q : supresses *all* output.
-n <n> : Only get 'n' messages
-m <n> : Only get message # n
-b <n> : Retrieve messages beginning from # n
-plain : Extract text/plain segments too (usually ignored)
-h : displays this help.
-try <n times>: how many attempts to access mail. from '1' to 'INFINITE'
-ti <n> : Set timeout to 'n' seconds.
-forceextract fn: Attempt to extract any encoded messages in 'fn'

Installing GetMail
You need to follow the belows steps to install it. Assume that getmail.exe is stored under D:\tools.
  1. First open a command prompt.
  2. Go to D:\tools folder.
  3. Install it by executing below commmand
    Getmail -install mailserver script1@auto.com wrongpwd
    Here mailserver means the mail Server name or IP address

Verifying GetMail
To verify the GetMail installation, you can use following steps.
  1. Goto folder D:\tools
  2. Execute the following command for any user.
    For example, D:\tools\getmail.exe -u script1 -pw TestPassword -s mailserver
  3. Check any error exists on command prompt.
  4. Check on that folder, whether all the mails are downloaded or not. You can see mails like msg1.txt,msg2.txt,..etc

4Test code - To Verify the GetMail
 

[ ] sMailCommand = "{gsToolsDir}\getmail.exe -u {sUser} -pw {sPass} -s {sServer} {sAdditionalSwitch}"
[ ] Print ("Mail Command: {sMailCommand}")
[+] // if (bDeleteAfterReceive)
[ ] // sMailCommand = "{gsToolsDir}getmail.exe -u {sUser} -pw {sPass} -s {sServer} -delete"
[+] // else
[ ] // sMailCommand = "{gsToolsDir}getmail.exe -u {sUser} -pw {sPass} -s {sServer} -nodelete"
[ ] // Checking any errors on command line output
[+] if( 0 != SYS_Execute( sMailCommand, lsGetmailOut ) )
[ ] ListPrint( lsGetmailOut )
[ ] LogError ( "FAIL. Unable to receive the mail." )
[ ] return FALSE
[ ]

Sunday, September 28, 2008

Children objects has negative co-ordinates in Browserchild

Last year, one web based product has been revamped with our own reporting modules. Lot of javascripts used for this reporting. Silktest is able to identify the HtmlTable and HtmlColumn objects properly. But the co-ordinates are shown wrong. Each click action is done in different point instead of expected point. Only X-Axis position got changed. See the RECT info below.

BrowserChild (Parent) rect: {195, 175, 827, 538}
Htmltable rect: {-77, 323, 818, 574}


It is varying for different kind of reports. Testcases need to do left-mouse click and right-mouse clicks. I have set few variables for position changes. I have written the code like below. In the Runtime, XAxis changes (ixGridInc) are calculated dynamically. I have given the code below:

4Test code - To set the Table position dynamically


[-] void SetGridTablePosChanges (Window wTable)
[ ] // To set xAxis and YAxis increments (changes)
[ ] // Position changes.
[ ] Window wParent
[ ] Boolean bxGetPos = FALSE
[ ] String sWinTag, sMainFrameTag
[ ]
[ ] RECT rtTblCell = wTable.GetRect (TRUE)
[ ] Print ("table rect: {rtTblCell}")
[ ]
[-] if (ixGridInc == -1)
[ ] Print ("Grid xAxis increment is going to set.")
[ ] ixGridPos = rtTblCell.xPos
[ ] // iyGridPos = rtTblCell.yPos
[ ] bxGetPos = TRUE
[-] else if (ixGridPos != rtTblCell.xPos)
[ ] bxGetPos = TRUE
[ ] ixGridPos = rtTblCell.xPos
[ ] // iyGridPos = rtTblCell.yPos
[-] else
[ ] Print ("Already Grid xAxis increment is available.")
[ ]
[-] if (bxGetPos)
[ ]
[ ] sMainFrameTag = WindowTag (wTable)
[ ] sWinTag = GetField (sMainFrameTag,"[BrowserChild]",3)
[ ] Print ("Whole Table tag: {sMainFrameTag}")
[ ] Print ("Parent tag: {sWinTag}")
[-] if (MatchStr ("*[6]*",sWinTag) || MatchStr ("*mainFram*",sWinTag))
[ ] wParent = MyReportPage
[ ] RECT rtTblCell2 = wParent.GetRect (TRUE)
[ ] Print ("Parent rect: {rtTblCell2}")
[ ]
[-] if ((rtTblCell.xPos < (rtTblCell2.xPos + XAXIS_TABLE_DIFF)) )
[ ] ixGridInc = rtTblCell2.xPos - (rtTblCell.xPos) + XAXIS_TABLE_DIFF
[ ] Print ("X Axis changed Position: {ixGridInc}")
[-] else
[ ] Print ("Parent{wParent} is not expected one.")

Tuesday, September 16, 2008

Automating Windows/Unix/Linux Server calls by w3Sockets

Earlier I have written a post Expect-Automating Command line tools for Expect utility. Now we can access any server machines by using VBScript. Dimac Development has implemented a COM interface to connect through Telnet and made as freeware. You need to download w3Sockets Dll and register it using SocketReg.exe included in a zip file. It is similar to expect utility. You can verify each command and can change the execution flow based on console output. It is much useful for automated testing as well as server administration. Below I have given a sample code to start windows services.

w3Sockets Reference
w3Sockets - Download Page

To start servers on Windows/Unix/Linux Systems



'To start servers on Windows/Unix/Linux server
Dim w3sock

Set w3sock = CreateObject("socket.tcp")
With w3sock
.timeout = 5000
.DoTelnetEmulation = True
.TelnetEmulation = "TTY"
.Host = "myserver:23"
.Open
.WaitFor "login:"
WScript.Echo .Buffer
.SendLine "myloginid"
.WaitFor "password:"
.SendLine "Password12"
.WaitFor ">"
.SendLine "net start ""MyServer Manager"""
.WaitFor ">"
WScript.Echo .Buffer
.SendLine "net start ""MYDB Repository"""
.WaitFor ">"
WScript.Echo .Buffer
.Close
End With
Set w3sock = Nothing

Saturday, August 30, 2008

Converting Bitmap to GIF/JPG image

Earlier I have written a post about Automation Basics - Capturing Failures . Almost all the GUI testing tools are providing built-in functions to take the snapshot of screen. Snapshot can be taken for given screen co-ordinates or entire object.

Mostly these snapshots are stored as bitmap (*.bmp) files. Bitmap files are occupying more hard-disk space. It is difficult to maintain all the snapshots for each build in release-wise. IrfanView is a windows graphic viewer and it is a freeware utility. It has many command-line options for image related actions. You can just copy the executable file to another machine and can open or use immediately.

Syntax to Convert one image to another image format:
/convert=filename - convert input file to 'filename' and close IrfanView

Below I have given the way to implement in Silktest. This can be done for any testing tool.



[ ] //convert the image
[ ] SYS_Execute ("D:\autostuff\i_view32.exe {sBmpImage} /silent /convert={sGifImage}")

Friday, July 25, 2008

Silktest - TestPlan solutions

TestPlan is one of the good features in Silktest. You can query to execute certain testcases from Testplan. Also you can mark only failures from the silktest results. Below I have given the two test plan issues and solutions for them.

1. How to pass Dollar ($) sign in TestPlan?
TestPlan is using $ symbol to represent the variables. Silktest will through the error, if any testdata contains dollar ($) character explicitly.
Solution:
Replace symbol $ by {Chr(36)}


2. Running Main() from TestPlan
Few weeks back, I wanted to run the Main() function from Testplan. It is very old suite ( 10 years old). I thought, Silktest does not have any provision to call Main () function. I put the query into Borland forum and I got the answer.
Solution:
We have to represent the Main() as testcase. We should not change the hierarchy/indentation for script and testcase statements. See the sample plan below.



[-] SilkTest Issues
[ ] Developer: Palani Selvam
[ ] script: silkIssues.t
[ ] testcase: main()
[ ]



By this way, we can run the functions too..


[-] SilkTest Issues
[ ] Developer: Palani Selvam
[ ] script: silkIssues.t
[ ] // testcase: main()
[ ] testcase: MyTestCalls5 ()


Tuesday, June 17, 2008

Silktest - Click HTML objects using JavaScript

I was facing a problem, to click a HtmlImage or HtmlCheckbox, which are non-visible objects in the web page. The scrollbars are not native scrollbars. Silktest is unable to click those objects.

I was reading through SilkTest help 'JavaScript: running with ExecMethod' and went through a Knowledge base article. They helped me to solve this problem. The "ExecMethod()" function runs a JavaScript method or property on an object within a webpage. This function can be used to simulate a mouse click on the form element. Following 4test statement, will simulate a mouse click on the Image object.

wImage.ExecMethod("click()")

Borland - SilkTest's KB Article: http://support.borland.com/kbshow.php?q=20434

Monday, June 16, 2008

4Test - Getting IP address

In automation, sometimes we need to find the tricks to achieve it. Like that I have done to find the IP address of a machine. You can see the following code snippet.

Silktest code - To find IP address of a system

[+] public String GetIpAddress(String sMachineName) [ ] //To get IP Address for the particular machine in Network [ ] List of String lsOutput [ ] String sCommand [ ] String sTemp, sItem [ ] String sResult = NULL [ ] Boolean bResult = FALSE [ ] Integer iPos1, iPos2 [ ] [ ] sCommand = "ping -a {sMachineName}" [ ] Sys_Execute (sCommand,lsOutput) [ ] [ ] //ListPrint (lsOutput) [-] for each sItem in lsOutput [-] if (MatchStr("*pinging*", sItem)) [ ] bResult = TRUE [ ] break [ ] [-] if (bResult) [ ] iPos1 = StrPos ("[", sItem) [ ] iPos2 = StrPos ("]", sItem) [-] if ((iPos1 > 0) && (iPos2 > 0)) [ ] sResult = SubStr(sItem,iPos1+1, iPos2-iPos1-1) [ ] Print ("Found IP Address: {sResult}") [ ] return sResult

Tuesday, June 10, 2008

Silktest - Compilation Warning

We have one silktest suite, which was developed by using lower version of Silktest. Three years back, We ported that suite to Silktest 6.5. After that no changes are done in the script. While compiling the script in Silktest 7.1 and Silktest 2006, I was getting following warnings. Since it is working fine and Nobody tried to solve this warnings.

d:\scripts\myaut\includes\elementprops.inc(713) *** Warning: Function SelectExistingFormula is not defined for window ElementProperties.Formulas

I searched Silktest Help to see the compilation warning. No documentation about that. I searched in Google and got following results from different release notes.

silk8.0 (SilkTest 2006) ReleaseNotes
When using AutoComplete, the member list occasionally may reveal methods that are not valid for the 4Test class. The compiler will not catch these usage problems, but at Runtime the following exception will be raised when the script is played back:

*** Error: Function <invalid method> is not defined for <window class>.

silk2006 R2 ReleaseNotes
The MoveMouse() method is not defined for the Menu and MenuItem classes.

But None of them are useful. Then I tried each warning and corrected now.

Friday, June 6, 2008

Unable to load IE (IE7) extension

Sometimes Silktest2006R2 is throwing following error.

*** Error: Unable to load extensions: Enabled extension(s) for iexplore.exe#7 not installed: ActiveX, Accessibility

But Internet Explorer7 exists on that system and earlier Silktest was working fine with IE7. Even restarting Silktest will not be helpful. I didn't try restarting machine.

Problem Cause:
Browser might be running for a long time. Silktest Agent initialization used to fail.

Solution:

  1. Verify your default browser.
  2. Create a new Silktest project and try to enable extension for IE7. Assume that successfully IE7 extension is set for the new project. Now open your old project and try to identify any browser object. IE7 extension will be enabled automatically.

Hope that it will be a useful tips.

Wednesday, May 28, 2008

QTP - Tooltip verification in Browser

In Silktest, I have done tooltip verification by using Javascript. Post Silktest - Tooltip verification in Browser

How will you verify tooltip in Quick Test Professional (QTP)? Dmitry Motevich clearly explained it in his blog. He is using FireEvent("onmouseover") to simulate mouse placing over the link and picking the value from Windows Class. I hope that we can use outerhtml to get the tooltip value from ALT attribute.

Dmitry Motevich's Post : How to capture ToolTip by QTP

Tuesday, May 27, 2008

Silktest - Record Class

Yesterday I was going through Silktest Knowledge base in Borland support. Silktest has a feature "Record Class" for custom controls. This feature can list out external methods (public). It is an informative article.

Below quote is from Borland Support - Silktest KnowledgeBase .

Recording Class will let the built-in methods that any object has, be available to use in 4Test. These will be held in your include file in the form of a Winclass.

It can also be used if you are testing a component in SilkTest that is seen as a CustomWin, then you can Record Class against it.

Alternatively, it can be used on objects that are being recognised correctly by SilkTest but which may have their own built-in methods (only public methods) which would be more appropriate to your needs. If this is the case, then record class will be suitable for you to make these methods (as well as properties) available to be used.

Tuesday, May 13, 2008

Silktest - Unable to start Internet Explorer

Most of the silktest engineers would have faced this problem. I have got the same problem couple of times and rectified. Thats why, I thought to put into blog.

Sometimes, we may get like below, while trying to enable extensions for browser.

---------------------------
Extension Settings
---------------------------
SilkTest detected a Client/Server application.
The required Extension has been enabled.
---------------------------

Problem Description
Few Silktest DLLs might have corrupted for that profile (Say network userid). Thats why it is throwing that error.

Solution
In that same machine, login as other user and run the same scripts.
If it works fine, delete your primary user profile -> restart the machine-> login as the same primary user. Then the scripts will work.
If it doesn't work, you have to check your Browser. Try to reinstall IE and run the scripts. Otherwise repair IE.

For IE7, You may need to reinstall Silktest again.

Thursday, March 6, 2008

Silktest - Mouse Coordinates Off

Every Silktest automation engineer should have faced this problem. Generally this error is raised if the object co-ordinates are bit higher than total size of the monitor. Sometimes, silktest is not able to scroll down to click particular objects. This problem may occur due to Resolution Change or dual monitor setup.

In this situation, You can do following things and use the better one.

1. Clear the following options from Options->Agent Options.


  • Verify that windows are exposed

  • Verify that coordinates passed to a method are inside the window


OR Set by coding . Set agent option like this -> Agent.SetOption (OPT_VERIFY_COORD, FALSE)

2. Try to use ScrollIntoView() or setFocus().

3. DoClick () method if that particular object has support.

4. Write a function to click particular object, which is outside of the monitor co-ordinates.