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
Monday, March 31, 2008
Security Testing - CSS or XSS
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
Monday, March 24, 2008
Class Mapping in Winrunner
Class Mapping concept is explained in Custom Objects . Winrunner (WR) also provides class mapping. The Class Mapping enables you to map a custom class to a Standard class.
You can map the classes by two ways.
- By using Winrunner editor. Use GUI Map editor from Tools Menu.
- By setting dynamically through TSL (Test Script language) code. See following code snippet.
Code:
#-------------------------------------------------------------------------
# Method : WindowsCustomTextbox
# Author : T.Palani Selvam
# Purpose : It directs the execution according to actions in text box & mapping with given class.
# Parameters:
# sCtrlName - contains name of that control.
# sAction - contains type of the action should be happened.
# sData - contains data to be checked or played in controls.
# sCustomClass - contains class name to be mapped.
# Returns : Integer - returns int value (TRUE = 1 or non-Zero, FALSE = 0)
# Caller :
# Calls : - Nil -
#Logical expressions are assigned the value 1 if true, and 0 if false - From TSL Reference.
#-------------------------------------------------------------------------
public function WindowsCustomTextbox(in sCtrlName,in sAction,in sData, in sCustomClass) {
auto sResult;
auto sMappedClass;
auto sLocation;
get_class_map(sCustomClass , sMappedClass); #Get mapped Class name.
#Verify thr control name type.
sLocation = IdentifyType(sCtrlName);
if (sLocation != "") {
sCtrlName = "{class: edit,MSW_class: " & sCustomClass & ",location: " & sLocation & " }";
}
if (sMappedClass != "edit") {
set_class_map(sCustomClass , "edit"); #Mapping.
sResult = WindowsTextbox(sCtrlName,sAction,sData);
unset_class_map(sCustomClass); #released mapping.
}else {
sResult = WindowsTextbox(sCtrlName,sAction,sData);
}
return sResult;
} #end of function WindowsCustomTextbox
Sunday, March 23, 2008
Class Mapping in QuickTestPro
Class Mapping concept is explained in Custom Objects . QuickTest Professional (QTP) also provides class mapping. The Object Mapping enables you to map an object of an unidentified or custom class to a Standard Windows class.
You can do by Object Identification dialog box from tools menu. For more information, you can refer help for Mapping User-Defined Test Object Classes.
Saturday, March 22, 2008
Class Mapping in Silktest
Class Mapping is explained in Custom Objects . Silk test also provides class mapping. Class mapping only works for objects that are created with standard classes but are given non-standard names. You can achieve class mapping by two ways.
1. One is by using silktest editor. Go to Options->Class Map. Then set choose custom and standard classes.
2. Another option is by 4test coding. You can use Agent option OPT_CLASS_MAP. The class mapping table for custom objects, with each entry in the list in the form "custom_class = standard_class".
Friday, March 21, 2008
Silktest - Run script in different browsers
SilkTest has options set feature. It is used to save the required silktest settings. I have used batch file to run the script for different browsers. It is easy to run your scripts, without any settings manually.
Below batch file is run for My_IE6DOM.opt (option set). You can try for suite instead of script-wise.
IE6DOM.bat
rem ******************************************************
rem Used to run the scripts for different option sets
rem *******************************************************
rem * Setting path to SilkTest application *
set APP_SILK="c:\Program Files\Segue\SilkTest\partner.exe"
rem * Setting path to Silk source *
set SRC_SILK=C:\Automation\AUT\Silk
rem * Setting SilkTest options file*
set SRC_OPTIONS=%SRC_SILK%\..\My_IE6DOM.opt
rem *****************************************
rem * Running Security test suite *
rem *****************************************
rem * Running Security Options test script *
%APP_SILK% -q -opt %SRC_OPTIONS% -r %SRC_SILK%\scripts\security.t
Class Mapping in VisualTest
Already Class Mapping is explained in Custom Objects . Visual test also provides class mapping. VisualTest coding is similar to Visual Basic. But both are not same and used for different purposes. Below code is to treat any given custom class as Button class.
Code snippet:
'--------------------------------------
' Method : WindowsCustomButtonClick
' Author : T.Palani Selvam
' Purpose : Clicks the given Button element.
' Parameters: sButton - String, Contains name of control
' sBtnValue - String, Contains value of control
' sCustomClass - String, contains custom class name.
' Returns : Integer
' Caller : WindowsHandleClick(sContext, sForm, sElement ,sElementValue , sElementType)
' Calls : - Nil -
'-------------------------------------------
Function WindowsCustomButtonClick(sButton As String, sBtnValue As String, sCustomClass As String) As Integer
WButtonSetClass(sCustomClass)
WindowsCustomButtonClick = WindowsButtonClick(sButton, sBtnValue)
wResetClasses()
End Function
'---------------------------------------
' Method : WindowsButtonClick
' Author : T.Palani Selvam
' Purpose : Clicks the given Button element.
' Parameters: sButton - String, Contains name of control
' sBtnValue - String, Contains value of control
' Returns : Integer.
' Caller : WindowsHandleClick(sContext, sForm, sElement ,sElementValue , sElementType)
' Calls : - Nil -
---------------------------------------
Function WindowsButtonClick(sButton As String, sBtnValue As String) As Integer
WindowsButtonClick = False
If (WButtonExists(sButton)) Then
WButtonClick(sButton)
LogWrite("Successfully clicked button " + sButton, 1)
WindowsButtonClick = True
Else
LogWrite("Failure to Click Button " + sButton,1)
End If
End Function
Thursday, March 20, 2008
QTP - Getting INPUT objects
I wrote a qtp (Quicktest Professional) code for listing INPUT element's objects. Descriptive Programming is a feature in QTP. It is used to handle dynamic objects. I will write later about Descriptive Programming. Here below function returns particular type of objects in a web page.
Function:
'Calling function to list editboxes
Set ObjEditAll = ListAllWebObjects (Browser("My APP").Page("First Form"),"text")
Function ListAllWebObjects (ObjContainer,sControlType)
' Getting all type of INPUT objects
Dim MyDescription,objEditBoxes,NoOfChildObjs,Counter,strReport
Dim sTemp, objEdit
'Initialization
'ListAllWebObjects = Nothing
Set MyDescription = Description.Create()
MyDescription("html tag").Value = "INPUT"
MyDescription("type").Value = sControlType
Set objEditBoxes = ObjContainer.ChildObjects(MyDescription)
NoOfChildObjs = objEditBoxes.Count
strReport = ObjContainer.ToString() & " contains the following child object(s):"
For Counter=0 to NoOfChildObjs-1
strReport = strReport & vbNewLine & objEditBoxes.Item(i).ToString()
set objEdit = objEditBoxes(Counter)
sTemp = objEdit.GetROProperty ("name")
Reporter.ReportEvent micDone, objEdit.ToString() & " - name property", sTemp
sTemp = objEdit.GetROProperty ("class")
'sTemp = objEdit.object.ClassName
Reporter.ReportEvent micDone, objEdit.ToString() & " - class property", sTemp
sTemp = objEdit.GetROProperty ("index")
Reporter.ReportEvent micDone, objEdit.ToString() & " - index property", sTemp
sTemp = objEdit.GetROProperty ("location")
Reporter.ReportEvent micDone, objEdit.ToString() & " - location property", sTemp
sTemp = objEdit.GetROProperty ("html id")
Reporter.ReportEvent micDone, objEdit.ToString() & " - html id property", sTemp
sTemp = objEdit.GetROProperty ("innerhtml")
Reporter.ReportEvent micDone, objEdit.ToString() & " - innerhtml property", sTemp
sTemp = objEdit.GetROProperty ("outerhtml")
Reporter.ReportEvent micDone, objEdit.ToString() & " - outerhtml property", sTemp
sTemp = objEdit.GetROProperty ("innertext")
Reporter.ReportEvent micDone, objEdit.ToString() & " - innertext property", sTemp
sTemp = objEdit.GetROProperty ("outertext")
Reporter.ReportEvent micDone, objEdit.ToString() & " - outertext property", sTemp
Next
set ListAllWebObjects = objEditBoxes
Reporter.ReportEvent micDone, ObjContainer.ToString() & " child objects", strReport
End Function
Wednesday, March 19, 2008
FireFox Vs Internet Explorer
I have used different browsers such as Netscape, Opera, Internet Explorer, Firefox and few more. Earlier I used netscape and Internet Explorer regularly. But now I am using often Firefox and Internet explorer. It helps me to do browser compatibility testing.
In 2005, I started to use FireFox browser and it has many advantages while comparing with Internet explorer. Now Most of the sites are supporting Firefox also. I like the features such as tabbed browsing, popup blocker and download manager. These features are not upto the mark in IE. Opera browser already has similar to tabbed browsing. Opera is not popular as Firefox. Current IE7 is not fast as Firefox and also having security issues. Firefox has greater ease of use and more personalization options. It has improved performance and security features.
I am comfortable with firefox than IE. I heard that IE version 8 and FF version 3 are going to be released soon. Searched net for comparison. Got two interesting pages. Some old Comparison around 2004. Recent comparison is available here
Tuesday, March 18, 2008
MS XML Parser by Visual Basic
I love to use XML Parser. It is very easy to do by Visual basic. You can get the equivalent visual test code here - Visual Test - MS XML Parser. I'm thinking to use it in Quick Test Professional (QTP). Below code snippets are simple and easy to use.
Case1: To load any XML content
'-----------------------------------------
' Method : XMLParserLoadXML
' Author : T.Palani Selvam
' Purpose : Creates XML Parsing object according to the given XML String.
' Parameters: sXML - String, contains data in XML Format.
' Returns : Returns a Object, which contains XML Parsing object.
' Caller : - Nil
' Calls : - Nil -
'------------------------------------------
Function XMLParserLoadXML(sXML As String) As Variant
Dim objXML As Variant
XMLParserLoadXML = Null
Set objXML = CreateObject("Microsoft.XMLDOM") 'Declare a Object
objXML.async = False
objXML.loadXML (sXML) 'Load xmlformat String
'OleSetProperty(objXML,"preserveWhiteSpace") = False
If (objXML.parseError <> 0) Then
LogWrite ("Parsing Error in the File :" + sXMLFile)
Exit Function
End If
'Top Node of given file
Set XMLParserLoadXML = objXML.documentElement
End Function
Case2: It parsed the given tag in given content and returns the node.
'-----------------------------------------
' Method : XMLParser
' Author : T.Palani Selvam
' Purpose : Creates XML Parsing object according to the given XML Format File and Element.
' Parameters: sXMLFile - String, contains a file name, which is in XML Format.
' sTag - String, contains element name from which Tag or element based object to be returned.
' Returns : Returns a Object, which contains XML Parsing object.
' Caller : - Nil
' Calls : - Nil -
'-----------------------------------------
Function XMLParser(sXMLFile As String, sTag As String) As Variant
Dim objXML As Variant, objNode As Variant, objTemp As Variant, objRoot As Variant
'Dim varTest As Variant
Dim iIndex As Integer, iTemp As Integer
'Dim objRoot As node
XMLParser = Null
sTag = Trim(sTag)
Set objXML = CreateObject("Microsoft.XMLDOM") 'Declare a Object
objXML.async = False
objXML.Load (sXMLFile) 'Load xmlformat file
If (objXML.parseError <> 0) Then
LogWrite ("Parsing Error in the File :" + sXMLFile)
MsgBox ("Parsing Error in the File :" + sXMLFile)
Exit Function
End If
'Top Node of given file
Set objRoot = objXML.documentElement
'Print "XML File is : " & sXMLFile
'Print objRoot.nodeName & " Name of the node.."
If ((sTag = "") Or (sTag = objRoot.nodeName)) Then
'XMLParser = CVar(objRoot)
Set XMLParser = objRoot
'Set varTest = objRoot
'XMLParser = objRoot
Exit Function
End If
If objRoot.hasChildNodes <> 0 Then
objTemp = objRoot.childNodes
iTemp = objTemp.length
For iIndex = 0 To iTemp - 1
objNode = objTemp.Item(iIndex)
If (UCase(Trim(objNode.nodeName)) = UCase(sTag)) Then
XMLParser = objNode
Exit Function
Else
Set objNode = Nothing
End If
Next iIndex
End If
objTemp = objXML.getElementsByTagName(sTag) 'Search whole file with sTag
iTemp = objTemp.length
If (iTemp > 0) Then
objNode = objTemp.Item(0)
XMLParser = objNode
End If
End Function
Monday, March 17, 2008
Globalization
It is a precess of developing,manufacturing,marketing software products that are intended for worldwide distribution.It is achieved through Internationalization and Localization.
.
Internationalization:
- It is the process of designing an application to adapt to different languages and regions.
- It is often appreviated as I18N or i18n or i18N.Where the number 18 refer to the number of letters omitted.
- •I+n1t2e3r4n5a6t7i8o9n10a11l12i13z14a15t16i17o18+n.
- Build once we can sell anywhere.
- Translation is easy.
- Addition of localization data the same executable can be run worldwide.
- It is the process of adopting software for a specific language or region.
- It is a process of translating software user interface from one language to another.
- It is appreviated as L10n.
- During localization,some references to history or culture are replaced with an equivalentnative reference which ideally doesnot change the meaning of the statement.
VisualTest Support
VisualTest support has been stopped for around 8 years. But Still few companies are using Visual Test. The two active forums are available for Visual test. One is mt_info Yahoogroups and another one is in SQA Forums. Recently that Yahoo groups also closed.
Visual test cost is very less and many users were there. The last version is 6.5 But still few people are using VT. Thats why I thought to put few visual test code snippets. I am planning to put few posts for visual test.
See the one post from a VT user.
Quote:
After a very extensive search i have found this forum,and i suppose it is still active for Visual Test. Right now i knew that Visual Test is obsolete in the market.But i am pushed to use the tool.As i am very new to testing and currently i do not have the tool as well,I'll be getting it by November 1st week.So could any one help me in starting the preparation.If any of you can guide me where to get the Book Visual Test Bible by Thomas R.Arnold it would be really help full.If any one have the copy same and ready for selling i am ready for purchasing it.So please please help needed.
I hope that this will be applicable to Winrunner in the future.....!!!
Friday, March 14, 2008
VisualTest - MS XML Parser
In my first test automation project, I thought to include XML Parser. At that time, XML concept was new and used in many applications. Visual test supports COM DLL calls. I used Microsoft DOM XML parser. XML is a best choice to have the test data.
XML Development Center
XML FAQ
Below I have given the code snippets to parse the XML files.
Code1: To Parse an XML file.
'-----------------------
' Method : XMLParserLoadXML
' Author : T.Palani Selvam
' Purpose : Creates XML Parsing object according to the given XML formatted String, Element .
' Parameters: sXML - String, contains data in XML Format.
' sTag - String, contains element name from which Tag or element based object to be returned.
' Returns : Returns a variant data, which contains XML Parsing object.
' Caller : - Nil
' Calls : - Nil -
'--------------------------------
Function XMLParserLoadXML(sXML As String, sTag As String) As Variant
Dim objXML As Variant, objNode As Variant, objRoot As Variant, objTemp As Variant
Dim iIndex As Integer, iTemp As Integer
XMLParserLoadXML = NULL
sTag = Trim (sTag)
objXML = OleCreateObject ("Microsoft.XMLDOM") 'Declare a Object
OleSetProperty (objXML,"async","False")
OleDispatch (objXML, "loadXML", sXML) 'Load xmlformat String
'OleSetProperty(objXML,"preserveWhiteSpace") = False
If (OleGetProperty(OleDispatch(objXML, "parseError"), "errorCode") <> 0) Then
LogWrite ("Parsing Error in the String :" + sXML, 1)
Exit Function
End If
'Top Node of given file
objRoot = OleDispatch (objXML,"documentElement")
IF ((sTag = "") OR (sTag = OleGetProperty(objRoot, "nodeName"))) Then
XMLParserLoadXML = objRoot
Exit Function
End IF
If OleDispatch (objRoot ,"hasChildNodes") <> 0 Then
objTemp = OleDispatch (objRoot, "ChildNodes")
iTemp = OleGetProperty(objTemp, "Length")
For iIndex = 0 To iTemp -1
objNode= OleDispatch(objTemp, "item",iIndex)
If (Ucase(trim(OleGetProperty(objNode,"nodeName"))) = UCase(sTag)) Then
XMLParserLoadXML = objNode
Exit Function
Else
OleReleaseObject (objNode)
End If
Next iIndex
End IF
objTemp = OleDispatch(objXML,"getElementsByTagName",sTag) 'For test.xml
iTemp=OleGetProperty(objTemp,"Length")
If (iTemp > 0 ) Then
objNode = OleDispatch (objTemp, "item", 0)
XMLParserLoadXML = objNode
End IF
End Function
Code2: It parses the given tag and returns the content.
'-------------------------------------
' Method : XMLParser
' Author : T.Palani Selvam
' Purpose : Creates XML Parsing object according to the given XML Format File and Element,
' which gives starting or root element of that object.
' Parameters: sXMLFile - String, contains a file name, which is in XML Format.
' sTag - String, contains element name from which Tag or element based object to be returned.
' Returns : Returns a variant data, which contains XML Parsing object.
' Caller : RunTestCase()
' Calls : - Nil -
'------------------------------------
Function XMLParser(sXMLFile As String, sTag As String) As Variant
Dim objXML As Variant, objNode As Variant, objRoot As Variant, objTemp As Variant
Dim iIndex As Integer, iTemp As Integer
XMLParser = NULL
sTag = Trim (sTag)
objXML = OleCreateObject ("Microsoft.XMLDOM") 'Declare a Object
OleSetProperty (objXML,"async","False")
OleDispatch (objXML, "load", sXMLFile) 'Load xmlformat file
'OleSetProperty(objXML,"preserveWhiteSpace") = False
If (OleGetProperty(OleDispatch(objXML, "parseError"), "errorCode") <> 0) Then
LogWrite ("Parsing Error in the File : " + sXMLFile, 1)
Exit Function
End If
'Top Node of given file
objRoot = OleDispatch (objXML,"documentElement")
Print OleGetProperty(objRoot, "nodeName") + " Name of the node.."
IF ((sTag = "") OR (sTag = OleGetProperty(objRoot, "nodeName"))) Then
XMLParser = objRoot
Exit Function
End IF
If OleDispatch (objRoot ,"hasChildNodes") <> 0 Then
objTemp = OleDispatch (objRoot, "ChildNodes")
iTemp = OleGetProperty(objTemp, "Length")
For iIndex = 0 To iTemp -1
objNode= OleDispatch(objTemp, "item",iIndex)
If (Ucase(trim(OleGetProperty(objNode,"nodeName"))) = UCase(sTag)) Then
XMLParser = objNode
Exit Function
Else
OleReleaseObject (objNode)
End If
Next iIndex
End IF
objTemp = OleDispatch(objXML,"getElementsByTagName",sTag) 'For xml Format
iTemp=OleGetProperty(objTemp,"Length")
If (iTemp > 0 ) Then
objNode = OleDispatch (objTemp, "item", 0)
XMLParser = objNode
End IF
End Function
Thursday, March 13, 2008
Writing a Problem Report
Many testers are not concentrating the details, while entering a defect. I have seen few guys entering just one line as bug description. Also they are not ready to put the details of the environment. For few scenarios, they can improve it by attaching proper snapshots. As a tester, we should give the right steps to reproduce the issue. Managers should not encourage informal ways like oral communication, email notes, etc.
Cem Kaner has written few articles about Bug Advocacy.
Bug Advocacy: PDF
Bug Advocacy: Video
Also I would like to give two quotes from his famous book.
Book: Testing Computer Software By Cem Kaner, Jack Falk, Hung Quoc Nguyen
ISBN: 0471358460
Quote1:
If your reports are not clear and understandable, bugs won't get fixed. You should spend minimum time needed to describe a problem in a way that maximizes the probability that it will be fixed. The content and tone of your reports affect that probability. The point of writing problem reports is to get bugs fixed.
Quote2:
Nobody likes being told that what did wrong, wrong, wrong. As a tester, that's what you tell people everyday. You can ensure your unpopular by describing problems in a way that tells the programmer you think (s)he is sloppy, stupid or unprofessional.
Wednesday, March 12, 2008
4test - Search and Replace
One project required to replace certain tags at every build. I written this function SearchAndReplaceInFile. This code snippet to search and replace strings in a file.
Code:
[+] public void SearchAndReplaceInFile (STRING sFileInput, STRING sFileOutput, STRING sSearch, STRING sReplace )
HFILE hInFile, hOutFile
STRING sTemp, sLine, sValue
INTEGER iPos1, iPos2
hInFile = FileOpen (sFileInput,FM_READ)
hOutFile = FileOpen (sFileOutput, FM_WRITE)
[-] while (FileReadLine (hInFile, sLine))
sTemp = sLine
[-] if !(Trim(sSearch) == Trim (sReplace))
ReadLine:
iPos1 = StrPos (sSearch,sTemp)
//Print ("Position {sTemp} - {sSearch} : {iPos1}")
[-] if (iPos1 > 0)
sValue = StrTran (sTemp, sSearch, sReplace)
//Print ("got value: {sValue}")
sTemp = sValue
goto ReadLine
FileWriteLine(hOutFile,sTemp)
FileClose (hInFile)
FileClose (hOutFile)
Documenting automated Scripts
Recently a colleague (new to our team) asked me the documentation for our suite. I do not have any document or HELP files. Earlier My team thought about it and one member came with a silktest script to do that. We have to add more features like search, organizing by attributes. That utility did not give the most needed feature. To ease the documentation job, we need to use set of tags and detailed info for them. We are unable to follow this more than a week.
Most of the automated testing tools are not having documenting facility. I am expecting similar to PerlDoc (for Perl scripts) or JavaDoc (for Java). It is the duty of script developer to ensure the adequate comments for particular function or code block. I used to put two or three line comments, While writing the functions.
Generally these kind of tools or utilities, have a parser. It can parse the source code and get the details by the pre-defined tags or keywords. Then It creates the HELP files for each code block or script. The usage will be meaningful if documentation is regularly updated. Now most utilities are creating HTML files and it is easy to navigate and share the information. I was going through J2Se doc comments. JavaDoc is having the flexibility of including HTML tags.
Friday, March 7, 2008
Recursive technique
I am very much interested to include the recursive technique. It is simplifying the code and reduce the number of lines. You can get the definition on Wiki. Below I have given the sample 4test code. This code snippet will get child objects from the given container object.
[+] public LIST OF WINDOW GetChildObjects(Window wContainer, DATACLASS dcObject)
// To get All child objects.
// Used recursive method.
LIST OF WINDOW lwndObjects, lwTemp1, lwTemp2
LIST OF WINDOW lwndChildren = {...}
WINDOW wParent, wChild, wTemp
[+] do
[+] if (wContainer.Exists (10))
lwndChildren = wContainer.GetChildren (TRUE, FALSE)
[+] for each wChild in lwndChildren
[+] if wChild.IsOfClass(dcObject)
ListAppend (lwndObjects,wChild)
[+] else
lwTemp1 = wChild.GetChildren(TRUE, FALSE)
[+] if (ListCount(lwTemp1) > 1)
lwTemp2 = GetChildObjects(wChild,dcObject) //To get particular objects
[+] if (ListCount(lwTemp2) > 0)
ListMerge (lwndObjects, lwTemp2)
[+] else
Print ("Container {[STRING]wContainer} window is not available.")
[+] except
ExceptLog ()
return lwndChildren
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.
Wednesday, March 5, 2008
Getting Link count in Winrunner
I used to write hardcore code for Automation. I had a situation like, the script has to find searched items and it has to click on particular search item. Also I need to test pagination. The search results are dynamic and I need to select the items as well as need to verify the pagination links.
The following TSL snippet finds the number of links and number of rows in a given table.
public aRowCount, aColCount;
public aCell;
public aRow, aCol;
public aTemp;
public aItem, ar, ac;
public alinkcount, alinkrow;
public aout, atext;
public areturn;
# Browser Main Window
win_activate ("Browser Main Window");
# Search Items
set_window ("Search Items", 2);
wait(5);
tbl_get_rows_count("Link No", aRowCount);
tbl_get_cols_count("Link No", aColCount);
report_msg (aRowCount & " is row count");
report_msg (aColCount & " is col count");
alinkrow = 0;
alinkcount =0;
for (arow=1;arow<= aRowCount; arow++) {
web_obj_get_child_item( "Link No", arow, 1, "html_text_link", 0, aout);
report_msg (aout & " -link description");
if (length(aout) !=0 ) {
alinkcount = alinkcount + 1;
#web_tbl_get_cell_data("Link No",arow,aColCount,0,atext,areturn);
web_obj_get_child_item( "Link No", arow, aColCount, "",0 , atext);
report_msg(atext & " text in the cells");
if (length(atext) !=0 ) {
alinkrow = alinkrow + 1;
}
report_msg(alinkcount & " - total no of links in the table.");
report_msg(alinkrow & " - total no of links having full rows.");
}
}
pause(alinkcount & " - total no of links in the table.");
pause(alinkrow & " - total no of links having full rows.");
Tuesday, March 4, 2008
Web Testing & Client server testing
Server process:
Server programs generally receive requests from client programs, execute database retrieval
and updates, manage data integrity and dispatch responses to client requests. The serverprocess acts as a software engine
that manages shared resources such as databases, printers, communication links, or high
powered-processors.It is the backend process of the application.
Client process:
Client programs usually manage the user-interface portion of theapplication, validate data
entered by the user, dispatch requests toserver programs, and sometimes execute business logic.
The client-based process is the front-end of the application.It is the interaction between the user and the rest of the application
system.
In client server testing test engineer are conduct the following testings:-
1.Behaviour testing(GUI TESTING)
2.Input domain testing
3.Error Handling testing
4.Backend testing
In Web testing test engineer are condut the following testings:-
1.Behaviour Testing
2.Static web testing
3.Input domain testing
4.Backend testing
5.Error handling testing
5.Frame Level testing
Difference between Application server and Web server:
Application server | Web server |
Developers can create, test, and execute application components | It is designed to create and deploy Web site, serving up content more so than applications. |
These are typically J2EE-based, running EJBs or other Java components. | It supports JSP,servlets and ASP |
Application servers are designed to create true applications with complex business logic, | Web servers are technology designed to create and deploy Web site serving |
Application Server supports HTTP,TCP/IP and many more protocols. | A Web Server understands and supports only HTTP protocol |
Capturing failures
In the previous post, we have seen the importance of Test Results Reporting. Capturing failures is helpful to debug the failure. Script will try to capture the error message in case of failure. If it is unable to capture the expected message or details, then it will capture the screen shot of particular object or screen. Usually these snapshots are bitmap files. Later I used an utility to convert a bitmap image to GIF image. It helps me to reduce the storage space.
Most of the load testing tools are capturing the objects as images or HTML files. Now Functional tools also providing this feature. Silktest provides the same feature through TrueLog Explorer. It is available from Silktest8.0 I hope that QTP also has same feature in different name.
Monday, March 3, 2008
Test Results Reporting
Results Reporting is very much important as automating functionalities. It will be better, if results are logged with screen shots for failed cases. Most of us, not concentrating much on Results Reporting. It will improve your automation level higher.
Automation Engineers are developing lot of test scripts. How will you check all scripts results? We can't check each testcase by testcase. Summary of test results is so important. Also the compiled results for all results is good to have.
Long back, I studied one article related with Automatic Results processing. That document discussed about extracting some keywords from particular log files and store the results in different format. I have implemented using Excel sheet and it will give result for each testcase(function) as well as compiled result for each scripts. If summary and results are stored into HTML files, we can easily get to know the results.
I agree, however one person need to look the results. Some of the tools are giving summary details after execution. I want to go one step ahead. I need to see all automation results of particular project from one file (HTML or Flat file or XL sheet). It is like maintaining history.
But Results processing is very common for test automation as well as general applications. You can follow like any standard log files format. You can maintain 2-3 log files for single script. One for all the activities of your suite and another one for Just giving Pass or Fail result for each testcase. It will be better, if all the log files are HTML files. At last prepare a single file to show the compiled results for the whole execution. You can publish the results easily.