Thursday, June 4, 2009

Dynamically Creating QTP Test Batch File/Test Suit

Let us consider that our test folders are ready...
now run this code over the main folder that includes all test folders...
It will create .mtb batch file for test...

you can even open the .mtb file with notepad & adjust the sequence of test..

Function TestsToTestSuit(TestDirPath)
filename=TestDirPath & "\ProjectTestSuit.mtb"
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
Set objFolder = fso.GetFolder(TestDirPath)
set colSubfolders = objFolder.Subfolders
Dim myarray()
dim i
i=1
If fso.fileexists(filename) Then
fso.deletefile(filename)
End If
Set file= fso.CreateTextFile(filename, ForAppending, True)
file.Writeline("[Files]")
file.Writeline("NumberOfFiles=" & objFolder.Subfolders.count)

For Each objSubfolder in colSubfolders
ReDim preserve myarray(i)
If (objSubfolder.Name<>"Screenshots") Then
myarray(i)=objSubfolder.Name
file.Writeline("File" & i & "=" & TestDirPath & "\" & objSubfolder.Name & ";1 ")
i=i+1
else
i=i+1
End If
Next
file.close
DirectoryNameToArray=myarray
End Function


i have excluded "screenshots" folder from SVN Test script folder

Wednesday, June 3, 2009

QTP framework for companies, automating the automation

Hi,

I am working as a QA Lead in chandigarh.. I joined QA field 2 years back.
I have 4.5 years of software developement experience in microsoft tech.
I GOT A TEAM OF 4 QA MEMBERS.

6 month ago... my company management asked me to have some sort of automation testing. Initially I took Selenium as it is a open source & easily available.
I created a selenium smoke testing script that runs over the build....

Then I found It is very tedious to work with it.
FINALLY I CHOOSE QTP TRIAL...EXCELLENT ONE...


I GOOGLED ABOUT MAKING A FRAMEWORK.. I PUT MY WHOLE DAY ... AND ALSO AKSED MY COLLEUAGE (MR. SAHIB) TO DO SO...
FINALLY AT THE END OF DAY...ALL WAS IN VAIN..

WHILE TRAVELLING TO MY HOME.. I AGAIN THOUGHT ABOUT IT.. WHAT TO DO..HOW TO DO.... THEN GOT A EXCELLENT IDEA..
EUREKA....

NEXT DAY I TOOK IT INTO HAND...WE STARTED creating a complete QTP testing framework without using any OBJECT REPOSITORY.

Then I decided to have such a script that will move over all the pages of website..
It uses vbscript FULLY. IT IS 90% COMPLETE NOW..

Here is how it works....

Using inputbox() of vbscript...
It asks for main folder name to be created for project...
It asks for login textbox name...
It asks for password textbox name...
It asks for login & password...
It asks for name of login button...
It tells total no. of links on page e.g. 96...
It asks for the link number to start with...
It collects window Page Title & URL in a text file (to check naming conventions)
It finds missing attributes like maxlength,alt,title, tabindex... etc..

Creates folders for each QTP test to be created
It copies a default test settings from a folder to each test automatically..
then creates the tests scripts automatically for all the pages...
grabs screen shots in a directory...
creates data table global sheet & puts column names automatically (does not matter number of controls)....
It fetches values from data table & does entry in all controls in the pages automatically...

fires input validations,mandatory and other,captures screenshots of crashes, page not found, gathers URL

checks spellings
checks W3C XHTML validations conformance
checks W3C CSS conformance
checks W3C WCAG conformance

other so many things.....

finally creates test suite .mtb automatically...


THATS IT...
NOW OUR LIFE IS SAVED & EASY.
DO YOU WANT TO KNOW WHAT WE DO NOWA DAYS?
WE JUST CLICK RUN BUTTON OF QTP AND GET ALL SCRIPTS IN SVN FOLDER AUTOMATICALLY.....
:-)

Friday, May 22, 2009

virtual PC benefit

To reuse/again use the trial version of software
Install microsoft Virtual PC
Install WINXP on it
Install software
Install whatever u need on this
Then Copy it's .vhd file & keep it backedup
when required,Replace .vhd on VPC

Note:For educational purpose only

Thursday, March 12, 2009

Selenium Script for autologin

="">
WhileAutoLogin
store 4 iterations
store 0 x
while storedVars.x<storedVars.iterations
store javascript{selenium.browserbot.baseUrl} URL
open javascript{storedVars.URL}
getEval //alert('{x}: '+${x});alert('storedVars: '+storedVars['x'])
storeEval function(x) {var users=new Array("kent","popup","anilk","String4","",""); return users[x];} getUser
storeEval function(x) {var pass=new Array("industries","123456","123456","123456");return pass[x];} getPass
type //input[contains(@name,'User') or contains(@id,'user') or contains(@id,'UserName') or contains(@id,'log') or contains(@name,'login') or contains(@name,'Log')] javascript{storedVars.getUser(storedVars.x)}
type //input[contains(@type,'password') or contains(@id,'pass') or contains(@name,'pass')] javascript{storedVars.getPass(storedVars.x)}
clickAndWait //input[contains(@type,'submit') or contains(@id,'ogin')]
waitForPageToLoad 3000
getEval storedVars.textPresent=""
storeTextPresent Incorrect Username textPresent
getEval //alert(storedVars.textPresent)
gotoIf storedVars.textPresent skipRecord
waitForPageToLoad 3000
captureEntirePageScreenshot C:\${x}logo.png
label skipRecord
getEval storedVars.x=eval(storedVars.x)+1;
endWhile
getEval alert('Testing finished '+storedVars.x+' iterations')

Tuesday, February 10, 2009

what is SCRUM model

SCRUM:
Scrum is a process of s/w development used with agile software development. Taks are collected in product backlog, out of these sprint backlog is prepared, then sprint executed iterated same again.

SPRINT:
A sprint is a time-boxed period of a list of task.
Each "sprint" has a length of 15-30 days. The set of prioritized features that go into a sprint come from the product "backlog",

Product backlog:
A prioritized list of high level requirements.

Sprint backlog :
A list of tasks to be completed during the sprint.

In SCRUM, there are two roles, Pigs and chickens, based on a joke about a pig and a chicken

Pig: ones committed to the project in the Scrum process. who are:
Product Owner :who represents the stakeholders
ScrumMaster (or Facilitator) :who maintains processes (same as PM)
Team :which includes the developers.

Chickens: who will not work directly but will review, analyse & suggest ideas. who are:
Users
Stakeholders (customers, vendors)
Managers

Meetings:
Daily Scrum: a 15-20 min., standing, at same location , same time,
3 questions asked: what u did yesterday, plan of today, any problem faced

Sprint Planning Meeting:
Select what work is to be done
Evaluate time it will take to do that work
8 hour limit

Sprint Review Meeting:
Review completed and not completed work
Show demo of completed work to the stakeholders
4 hour time limit

Sprint Retrospective:
What went well during the last sprint?
What could be improved in the next sprint?
3 hour time limit