Silktest is always clicking top-left most point of HtmlText object. For example, Assume that my text object is MyApp.MainFrame.Apply
MyApp.MainFrame.Apply.Click () is equal to MyApp.MainFrame.Apply.Click (1,1,1)
Advanced web technologies are always becoming challenges for Automation. Our enterprise web applications have HtmlText object for navigating purpose. We changed all images to text to support localization. These text objects look like HtmlImages or HtmlPushButtons. Actually those are HtmlText objects.
My problem was, sometimes the click will not happen properly. We cannot use DoClick method for HtmlText objects. I had two tricks to solve this problem. One is Clicking on center of that object or blindly hardcode co-ordinates.
In first way, MyApp.MainFrame.Apply.ClickCenter ()
- Here I have extended the click function.
In the second way, MyApp.MainFrame.Apply.Click (1,6,3)
Friday, April 4, 2008
Handling HTMLText objects in SilkTest
Thursday, April 3, 2008
Unable to run VBS in Windows XP
Last Year my machine was formatted and windows XP (SP2) was installed. Recently I tried to run few Visual basic scripts (VBS). An error message thrown and unable to run any VB script.
Then I searched and came to know that I need to install Windows Script 5.6 for Windows XP. After installing it, I am able to run the scripts in my PC. Also few links from search results are invalid. Now Windows Script 5.7 is available. Below I have given the links to download script engines. Hope that It will be useful...
Wednesday, April 2, 2008
VisualTest - Using Excel Application
Our Automation suite results were in text files. I wanted to create the excel file as results file. You can get to know more about Results Reporting. I used Excel VBA for this. It has simplified my task to prepare the compiled results for entire execution.
Similarly I will write, how to do the same thing by using VB script later....
Code: To check Excel availability in the system
'--------------------------------------
' Method : IsExcelAvailable
' Author : T.Palani Selvam
' Purpose : Checks whether excel application is available or not.
' Parameters: - Nil
' Returns : Returns integer, whether true or false.
' Caller :
' Calls :
'--------------------------------
Function IsExcelAvailable() As Integer
Dim objExcelApp As Variant
ON LOCAL ERROR GOTO Errhandler
IsExcelAvailable = False
objExcelApp = OleCreateObject("Excel.Application")
Sleep 0.5
OleReleaseObject(objExcelApp)
IsExcelAvailable = True
Exit Function
ErrHandler:
'LogWrite("[Failed At] " + ERF(0)+ "("+ str(ERL) +") : "+ ERROR$ + " .Error Number: " + str(Err),1) 'Actual location.
'Logwrite("[Trapped At] "+ ERF(1)+ "("+ str(ERL(1))+ ")",1) 'Trapped location.
Logwrite("Excel Application is not available.", 2)
End Function
Code: To Read Excel data
'---------------------------------------
' Method : ReadExcelCells
' Author : T.Palani Selvam
' Purpose : Read the content from given Excel file
' and checks result automatically, while completing a test case.
' Parameters: - Nil -
' Returns : - Nil -
' Caller :
' Calls :
'
'--------------------------------------
Function ReadExcelCells(sExcelFile as String, sWorkBook as String,sWorkSheet as String,sArrFields() As String) As Integer
DIM objExcelApp As Variant,objExcel As Variant, objCurrentCell As Variant
DIM objWorkBook As Variant,objWorkSheet As Variant
Dim iRows As Integer, iCols As Integer
Dim iRowStatus As Integer, iColStatus As Integer
Dim iRowIndex As integer, iColIndex As integer, iIndex As Integer
Dim sCellValue As String, sValue as String
ReadExcelCells = False
objExcel = OleGetObject (sExcelFile)
objExcelApp = OleDispatch (objExcel,"Application")
'objExcelApp = OleCreateObject ("Excel.Application")
objWorkBook = OleDispatch (objExcelApp,"Workbooks", sWorkBook)
'objWorkBook = OleDispatch (objExcelApp,"Workbooks")
'OleDispatch(objWorkBook,"Add",sWorkBook)
objWorkSheet= OleDispatch (objWorkBook,"Sheets", sWorkSheet)
iIndex = 1
Do While Not (iRowStatus)
objCurrentCell= OleDispatch (objWorkSheet, "Cells", iIndex, 1)
sValue = OleGetProperty (objCurrentCell, "Value")
If (Len(Trim(sValue)) = 0 ) Then
iRowStatus = True
End IF
iIndex = iIndex + 1
Loop
iRows = iIndex - 2 'Rows Count
print "No of rows.." + str(iRows)
iIndex = 1
Do While Not (iColStatus)
objCurrentCell= OleDispatch (objWorkSheet, "Cells", 1, iIndex)
sValue = OleGetProperty (objCurrentCell, "Value")
If (Len(Trim(sValue)) = 0 ) Then
iColStatus = True
End IF
iIndex = iIndex + 1
Loop
iCols = iIndex - 2 'Rows Count
print "No of Columns.." + str(iCols)
ReDim sArrFields(iCols - 1,1) As String
For iIndex=1 To iCols
objCurrentCell= OleDispatch (objWorkSheet, "Cells", 1, iIndex)
sValue = OleGetProperty (objCurrentCell, "Value")
sArrFields(iIndex-1, 0) = sValue
Next iIndex
For iRowIndex = 2 To iRows
For iColIndex = 1 To iCols
objCurrentCell= OleDispatch (objWorkSheet, "Cells", iRowIndex, iColIndex)
sValue = OleGetProperty (objCurrentCell, "Value")
sArrFields(iColIndex-1, 1) = sValue
Next iColIndex
For iIndex = LBOUND(sArrFields,1) TO UBOUND(sArrFields,1)
Print "Field (Name,Value): " + sArrFields(iIndex, 0),sArrFields(iIndex, 1)
'Print "Field Value: " + sArrFields(iIndex, 1)
Next iIndex
Next iRowIndex
OleReleaseObject (objWorkSheet)
OleReleaseObject (objWorkBook)
OleReleaseObject (objExcelApp)
OleReleaseObject (objExcel)
ReadExcelCells = True
End Function
Code: To set Test Results by different colors
'-------------------------------------------------------------------------
' Method : setResultXLDetails
' Author : T.Palani Selvam
' Purpose : Set the standard format for the given Cell Object.
' Parameters: sDetails - String, contains information to be written into Excel cell object
' lRow - Long, contains row number
' lCol - long, contains Column number
' iFontType As Integer
' iFontColor As Integer
' Returns : -Nil
' Caller :
' Calls :
'-------------------------------------------------------------------------
'Default values will be given iFontType =0, iFontColor =0
Sub setResultXLDetails(sDetails As String, lRow As Long, lCol As Long,iFontType As Integer, iFontColor As Integer)
Dim objCell As Variant, objFont As Variant
If Not IsNull(gObjWorkBook) Then
objCell = OleDispatch(gObjWorkSheet,"Cells",lRow,lCol)
objFont = OleDispatch(objCell, "Font")
Select Case iFontType
Case 1
OleSetProperty(objFont,"Bold",True)
Case 2
OleSetProperty(objFont,"Italic",True)
Case 3
OleSetProperty(objFont,"Bold",True)
OleSetProperty(objFont,"Italic",True)
Case Else
End Select
Select Case iFontColor
Case Is < 1
Case Is < 26
OleSetProperty(objFont,"ColorIndex",iFontColor)
Case Else
End Select
OleSetProperty(objCell,"Value", sDetails)
OleReleaseObject(objFont)
OleReleaseObject(objCell)
End IF
End Sub
Code: To set value into given cell
'-------------------------------------------------------------------------
' Method : setResultDetails
' Author : T.Palani Selvam
' Purpose : Set the standard format for the given Cell Object.
' Parameters: sDetails - String, contains information to be written into Excel cell object
' lRow - Long, contains row number
' lCol - long, contains Column number
' Returns : -Nil
' Caller :
' Calls :
'-------------------------------------------------------------------------
Sub setResultDetails(sDetails As String, lRow As Long, lCol As Long)
Dim objCell As Variant
If Not IsNull(gObjWorkBook) Then
objCell = OleDispatch(gObjWorkSheet,"Cells",lRow,lCol)
OleSetProperty(objCell,"Value", sDetails)
OleReleaseObject(objCell)
End IF
End Sub
Tuesday, April 1, 2008
SilkTest - Convert .jou to results file
Journal (*.jou) file is created, While SilkTest scripts are running. Results are stored temporarily in this. Journal file is converted to a .res file, when the script finishes running.
You re-run that particular script/plan/suite file for a testcase and then stopped manually within 5-10 minutes. In the results file, You can see the results for previous run Or select the previous results. There you can see the results of previous execution.
Remove the jou file, if SilkTest reports the error "Could not open results file."
Monday, March 31, 2008
Security Testing - CSS or XSS
The Cross Site Scripting (also known as XSS or CSS) is one of the most common Security Testing in web applications. Recently It was implemented in our application. We certified our AUT for CSS.
Generally hackers try to embed malicious script into a vulnerable dynamic web applications. This malicious script is executed and hacker can steal the data. The use of XSS might compromise private information, manipulate or steal cookies, create requests that can be mistaken for those of a valid user, or execute malicious code on the end-user systems.
To avoid cross site scripting vulnerabilities, the application should use encoded HTML content and it should not allow any URL or data, which contains <script and %3C%2Fscript.
In web so many tools are available to test this. I used a freeware called Webscarab. Also you can go through following links to know more about XSS.
Cross Site Scripting Definition - Wiki
Cross site Scripting FAQ
Sample Videos from Microsoft
Saturday, March 29, 2008
Special characters recognition
Any automation tool used to have few special characters to be masked to identify them. Silktest also not supports few characters in tag. You can't give following chars directly into tag.
"
[
]
{
&
*
/
?
|
Silktest is using those chars for different purpose. What can you do is, you can create a function to create correct tag for any string.
Friday, March 28, 2008
CSS - Style Sheets
Web page design or development is an interesting task. It should be more interest, if it is done for yourself. I learn HTML ten years back. At that time, Tag and Element were new to me. I started my web page at htmlplanet. I did not know much about CSS. I tried to learn CSS from W3Schools. It helped me for the blog. I used CSS to put my code and it is showing nicely in a box.
CSS stands for Cascading Style Sheets. By using CSS, we can extend the HTML Tags. It can reduce the inconsistency.Style sheets are expanding the ability to improve the appearance of web pages. Element by element,you can define the way you want things to look in a style sheet. Your paragraphs will all take on the formatting you associate with the P element in your style sheet. If you want to define more than one look for an element, you can create classes of an element and assign the classes to the elements when you define them in the pages.
Advantages:
- Easy maintenance
- Making changes to the layout
- Pages load faster
- Consistency
- Saves time
Disadvantages:
Browsers have varying levels of compliance with Style Sheets. This means that some Style Sheet features are supported and some are not.
Wednesday, March 26, 2008
Test Management and Motivation
Test Management is talked by few people and rarely. Also we are thinking test planning and test execution as test management. Nowadays Motivation is also one of the serious concerns in test management. It is not only by better package and better environment too. I read a Test Team Management document and it has given different direction. Sara Rees explained well in Test Team Management
Few words from Sara Rees:
Whilst the professional pessimist is a trait to be nurtured in our test analysts, it does have its down side. Testers can easily slide into total pessimism about the project as a whole.
From a project perspective, this approach can lead to valuable data generated by
testing becoming blanketed under a wave of negativity, and dismissed accordingly.
From a test team perspective, the difficulty becomes one of motivation. How do you
keep people committed and energetic about the task in hand when they already
believe it will fail?
Quote1:
One of the keys to this is to evidence progress. During team meetings ask
each member for their rating (on a scale of 1-10) on the quality of the
application. In the early days, the rating may be rather low, but you will be able
to demonstrate an improvement over time. If rampant negativity breaks out,
remind them of how things have changed.
Quote2:
The next major influencing factor is you! Your team must see that despite
deadlines, you continue to champion the quality issues.
I also like to put Jeff Nyman comments here. Jeff is a moderator in SQAforums and is a great testing management guru. You can read the Original post.
Question: How would you motivate the team members in scenarios where there is no much work to be assigned to them (basically during a lean period)?
Jeff Nyman:
what I've done in the past with my teams is encourage them -- during projects -- to keep track of things they would like to during the "lean times." Usually during projects ("the time of pain") you'll hear things like "Ah, if only I had time to restructure this test data!" Or: "If I had a tool that did this for me, my life would be a lot easier." During projects you feel the pain but you often can't do much to alleviate it. So I motivate people by saying "Keep track of those things. Write them down. When this project ends, lets look at working on that."
Then when those lean times are upon us I set up internal projects (internal to the test team, that is) and anyone who has made a good case for their project is given the go-ahead to work on that. I've had success with this approach because it gets people to focus on things that can practically help the team and/or that have caused them demonstrable stress in the past. Further, they are often motivated because, after all, they are the ones that brought up how they would like a solution.
And, of course, this lets them add to their skill-set. Note that this can include just learning things in general, even if there's no clear application for it yet. I had one tester, for example, express interest in open source automation even though, in our environment at the time, there was no need for it. I had him start investigating Ruby and the WATiR test framework. (As it turns out, we didn't use WATiR, but the tester did use Ruby scripts to monitor server logs and pull out information.) I had another person who was interested in learning if we could apply "planguage"-based requirements so I showed them the resource site of Tim Gilb and had them do some research. (It turns out we couldn't use "planguage" but the tester learned a lot about how to think about requirements.)
So what I try to do is encourage the team to keep track of things they would like to learn or like to do. That provides the necessary internal motivation rather than trying to impose motivation externally. Sometimes what people want to do is just for personal improvement and that's fine. Other times they don't so much need to learn something as apply what they already know. For example, maybe one tester wants to restructure our test data using a new schema. Maybe another wants to refactor our SilkTest automated test library. Maybe yet another wants to set up a forum-board knowledge base. Maybe another wants to set up a library of useful database queries.
Silktest - Click Vs DoClick
Silktest has two different click methods. DoClick method is available for browser objects. Below I have given a comparison between Click and DoClick.
Click Method
Click means, silktest is doing physical mouse click. This method can be used for any type of object.
DoClick Method
DoClick means, silktest simulates browser click (DOM Click) and you cannot see physically. It will be worked only for few of web-based objects. It is not available for all objects.
Upto Silktest7.5
DoClick supported classes are HtmlLink class, HtmlImage, and HtmlPushButton for Internet Explorer DOM only. For Netscape 6, the DoClick method works only for menus and controls on the Netscape Navigator 6 toolbar.
Silktest2006R2
DoClick method available classes are HtmlCheckBox, HtmlColumn, HtmlHeading, HtmlImage, HtmlLink class, HtmlMarquee, HtmlPushButton, HtmlRadioButton, HtmlText, and HtmlTextField. The API click functionality is changed and an option is given for Compatibility.
Tuesday, March 25, 2008
Documentation testing
Recently I have done a review for installation and user guides. I came to know few basic issues. Document testing is very important for user guide and installation guides. It can bring few more values to customers. Generally testers are not interested to test the documents. You will change your mindset if you read David's article - Justification for Documentation Testing.
Documentation testing is nothing but testing concerned with the accuracy of documentation. Documentation meets its goal when it provides enough and necessary information to end users or customers. Below I have given a famous technical writer Richard Lippincott's comment.
Quote 1:In recent years, usability has been recognized as an important
issue in documentation quality, and methodologies
have been developed to test and improve the user’s
speed, readability, and ability to find information.
Quote 2:
The documentation testing process can be considered the
test for the accuracy portion of the usability model.
It would fall under the key practice of quality assurance
activities as defined by Hackos in the Information
Process Maturity Model.
Testing Computer Software (ISBN: 0471358460) book talks about testing user manuals. It says that the effective documentation should have following benefits:
- Improves Usability
- Lowers customer support costs
- Improves reliability
- Increases Maintainability
- Improves Installability
- Enhances salability
- Reduces liability