Thursday, 24 February 2011

Create Global Dictionary object with VB Script

Set WshShell =CreateObject("WScript.Shell")
WshShell.RegWrite "HKCU\Software\Mercury Interactive\QuickTest Professional\MicTest\ReservedObjects\GlobalDictionary\ProgID", "Scripting.Dictionary","REG_SZ"
Set WshShell = Nothing

working with web application Automation security alerts

While we are working with web application automation most of the times we got frustrated because of security pop windows ….

Here is the solution for disable all the security setting and enable it after your test completion
public WshShell
set obj=new Web_Settings
set WshShell=CreateObject("wscript.shell")
obj.Disablesettings()
msgbox "Disable"
'obj.Enablesettings()
msgbox "enabled"

class Web_Settings

Function Disablesettings()
'Disabling File Download – Information Bar
input=0
SettingCode="2200"
KeyPath="HKCU\Software\Microsoft\Windows\CurrentVersion\Internet
Settings\Zones"
for i=0 to 4
WshShell.RegWrite keyPath& "\" & Cint(i) & "\"&
SettingCode,input,"REG_DWORD"
next
'end Disabling File Download – Information Bar

'Disabling Active X Control  – Java Script Prompt
Settingcode="1400"
'KeyPath=”HKCU\Software\Microsoft\Windows\CurrentVersion\Interne
t Settings\Zones”
for i=0 to 4
WshShell.RegWrite keyPath& "\" & Cint(i) & "\"&
SettingCode,input,"REG_DWORD"
next
'end Disabling Active X Control  – Java Script Prompt

'Disabling Security Information  -Secure and Non secure item
Settingcode="1609"
for i=0 to 4
WshShell.RegWrite keyPath& "\" & Cint(i) & "\"&
SettingCode,input,"REG_DWORD"
next
'END Disabling Security Information  -Secure and Non secure item

'Disable Security pop-up Secure Connection
WshShell.RegWrite
"HKCU\software\microsoft\windows\CurrentVersion\Internet
Settings\WarnOnPost","no","REG_SZ"
'End Disable Security pop-up Secure Connection

'Disable Security pop-up Certificate Warning
WshShell.RegWrite
"HKCU\software\microsoft\windows\CurrentVersion\Internet
Settings\","no","REG_SZ"
'End Disable Security pop-up Certificate Warning

'Disable Security pop-up Redirection pop-up
WshShell.RegWrite
"HKCU\software\microsoft\windows\CurrentVersion\Internet
Settings\WarnOnPostRedirect","no","REG_SZ"
'END Disable Security pop-up Redirection pop-up

'Disabling Popup Blocker
popupkeyPath="HKCU\software\microsoft\internet explorer\New
windows\popupmgr"
Wshshell.regwrite popupkeyPath,"no","REG_SZ"
'Diable There is a problem with this website's security certificate
popupkeyPath="HKCU\SOFTWARE\Microsoft\Internet
Explorer\Main\FeatureControl\iexplore.exe"
Wshshell.regwrite popupkeyPath,1,"REG_DWORD"



'************** END *****************************************
End function

Function Enablesettings()
'Enabling File Download – Information Bar
input=3
SettingCode="2200"
KeyPath="HKCU\Software\Microsoft\Windows\CurrentVersion\Internet
Settings\Zones"
for i=0 to 4
WshShell.RegWrite keyPath& "\" & Cint(i) & "\"&
SettingCode,input,"REG_DWORD"
next
'end Enabling File Download – Information Bar

'Enabling Active X Control  – Java Script Prompt
Settingcode="1400"
'KeyPath=”HKCU\Software\Microsoft\Windows\CurrentVersion\Interne
t Settings\Zones”
for i=0 to 4
WshShell.RegWrite keyPath& "\" & Cint(i) & "\"&
SettingCode,input,"REG_DWORD"
next
'end Enabling Active X Control  – Java Script Prompt

'Enabling Security Information  -Secure and Non secure item
Settingcode="1609"
for i=0 to 4
WshShell.RegWrite keyPath& "\" & Cint(i) & "\"&
SettingCode,input,"REG_DWORD"
next
'END Enabling Security Information  -Secure and Non secure item

'Enable Security pop-up Secure Connection
WshShell.RegWrite
"HKCU\software\microsoft\windows\CurrentVersion\Internet
Settings\WarnOnPost","yes","REG_SZ"
'End Enable Security pop-up Secure Connection

'Enable Security pop-up Certificate Warning
WshShell.RegWrite
"HKCU\software\microsoft\windows\CurrentVersion\Internet
Settings\","yes","REG_SZ"
'End Enable Security pop-up Certificate Warning

'Enable Security pop-up Redirection pop-up
WshShell.RegWrite
"HKCU\software\microsoft\windows\CurrentVersion\Internet
Settings\WarnOnPostRedirect","yes","REG_SZ"
'END Enable Security pop-up Redirection pop-up

'Enabling Popup Blocker
popupkeyPath="HKCU\software\microsoft\internet explorer\New
windows\popupmgr"
Wshshell.regwrite popupkeyPath,"yes","REG_SZ"
''Enable There is a problem with this website's security certificate
popupkeyPath="HKCU\SOFTWARE\Microsoft\Internet
Explorer\Main\FeatureControl\iexplore.exe"
Wshshell.regwrite popupkeyPath,0,"REG_DWORD"
'************** END *****************************************
End function
End class

Wednesday, 23 February 2011

Convert word document to EXCEL

set fso=createobject("word.application")
set wfile=fso.documents.open("D:\test.doc")
str= wfile.content
a=split(str,Chr(13))
set obj=createobject("excel.application")
obj.displayalerts=false
obj.visible=true
set wb=obj.workbooks.add()
set ws=wb.worksheets(1)
for i=0 to ubound(a)-1
j=i+1
ws.cells(j,1)=a(i)
next
wb.saveas("D:\test.xlsx")
set wfile=nothing
set fs0=nothing
set obj=nothing

CONVERT TEXT FILE TO EXCEL

set fso=createobject("scripting.filesystemobject")
set wfile=fso.opentextfile("D:\test.txt")

set obj=createobject("excel.application")
obj.displayalerts=false
obj.visible=true
set wb=obj.workbooks.add()
set ws=wb.worksheets(1)
x=1
do until wfile.AtEndofstream
ws.cells(x,1)=wfile.readline
x=x+1
loop

wb.saveas("D:\test.xlsx")

MOBILE Application Automation

MOBILE Application –Automation Testing
Mobile application automation testing is the upcoming application domain with market leader in
software test automation HP QuickTest Professional partner with cutting-edge, innovative
companies Jamo Solutions, extending its functional testing capabilities to mobile application on
all commonly used operating systems and platforms.
Mobile application automation by QTP and M-eux
The M-eux Test tool integrates the HP QTP scripting environment onto the mobile device.
1.
The Add-in translates the commands to the Device Manager.
2.
scripting environment.
The Device Manager is the gateway between the Agent on the mobile device and the
3.
it passes the execution & recording results of the mobile device to the PC.
It passes the test commands initiated by QTP on the PC to the mobile device and viceversa
4.
The Agent is a program that is running on the device. The Agent will execute the test command
and will in case of recording, capture the action of the mobile device. The Agent contains the
GUI recognition functionality. Special care that the memory and CPU footprint of the Agent is
very low so that the Agent does not influence the good working of the device when replaying a
test script.
In M-eux test, the mobile device is connected to the device manager using a USB/WIFI
connection. During recording or replay of the script, the mobile devices need to be connected to
the Device Manager.
With this architecture M-eux Test extends the QTP scripting test environment onto mobile
devices and gives guaranteed Quality of Assurance (QA).
Supported features of QTP by M-eux Test.
M-eux test extends the QTP environment for mobile devices, resulting in support of following
features:
An execution report is generated which indicates success or failure.
Document prepared by- V Prashanth
• Recording from real actual device or emulator
• Replay on real actual device or emulator
• Support for object repository
• Recognition of standard GUI elements and the HTML elements in the mobile browser
• GUI learn functionality
• GUI class mapping functionality for customized objects
• Extended support for VM-based languages like .Net
• Support for active screen technology
• Bitmap Verification
Meux – Automation Tool for Mobile Devices
Meux tool by Jamo Solutions available at
http://www.jamosolutions.com/documents/downloadproduct.php is an add-in to QTP that records and
plays back automation scripts on a mobile application just as it would on a regular desktop application. A
pre requisite of having the Meux agent installed on the device and the QTP Add In installed on QTP
machine is required. Both of these are available as a part of the installation package. The Meux Device
Manager acts as the bridge between the add in and the agent. The installation and set up would require
some extra technical expertise with port numbers being used by the agent clashing with the the port
numbers already in use on the machine.
After the initial hiccups of setting up, I was highly thrilled to try out the application and see how useful it
can be in my mobile automation tasks. Currently it supports only Windows Mobile, Blackberry RIM OS
and Android OS with the limitations on the versions of the same. Recording on mobile application is
almost as simple as on a desktop application. However the details and the excellence of the same can be
debated upon. Meux tool does not support any customization of the Mobile OS which is very common
on all the Windows Mobile Devices by HTC. As a workaround many function calls have been provided.
But I am pretty concerned with the re usability of scripts across same OS on different devices or
different version of the OS. With my concentration mainly on browser testing, I wasn’t highly impressed
with the same.
The tool does not support many of the native functions on the mobile browser which are found on the
regular browser. The browser and page objects have very limited number of native inbuilt
functioanilities and much is left to the discretion of the coder. For instance, the GetChildObjects method
found on a regular browser is absent on the mobile browsers inbuilt functionalities. This pretty much
defeats the purpose of descriptive programming. To verify the presence of certain web object, you
would have to get an array collection of all the objects on the page and then parse through each of them
to find what you are looking for. This is not the most effective way of working on a highly dynamic page
with high number of objects. Also, the object spy does not work on the mobile browser.
The analysis of the tool can be summarized through the following SWOT analysis of the same.
Document prepared by- V Prashanth
Strengths :
• Works as a bridge in between QTP Automation Tool and Mobile Device
• Records and Plays back automation scripts on mobile devices
Weaknesses:
• Does not support many important native functionalities of the web browser
• Does not support any customizations on the OS
• Object Spy does not work
Opportunities:
• Can re run same script across multiple devices with the same OS
• Can replace manual QA
Threats:
• Supports limited versions of the OS
• No agent for iPhones as yet
• Can behave highly unexpected at times
Having tried this, for the time being I would still continue using our current options viz. DeviceAnywhere
and Perfecto Mobile from Nexperience. Perfecto Mobile provides automation scripting across various
devices and platforms with a high level of re usability. But having said that, I am going to keep a keen
eye on the development progress of Meux with heavy interest considering its excellent potential.
Another thing that I would like point out here is the excellent support from the Meux team especially by
Jacques Wouters. In spite of being on different sides of the Atlantic and having a disastrous time
difference, the support team made sure they were available when we needed it.
Quick Test Professional
Jamo Solutions did not create its own scripting tool. Instead, the product M-eux Test extends existing
well known tools so that the QA-engineer can re-use his experience and is not locked into a specific
environment.
Quick Test Professional (QTP) is a world leading test environment developed by HP. QTP is an
advanced, automated testing software for building functional and regression test suites. The test script
is key word driven. The tool captures, verifies and replays user interactions automatically for PC based
applications. It's execution reports helps the testers quickly identify and report on application defects,
while providing advanced functionality for tester collaboration. M-eux Test integrates fully into
QuickTest professional so that the tester can use the above described functionality for testing mobile
applications.
Document prepared by- V Prashanth
Best practice and additional information on QTP can be found
M-eux integrates completely into QuickTest Professional. The object repository is used to store the UI
elements of the mobile application. Statements can be recorded or programmed. Objects can be be
highlighted in the Remote Device Screen window and verification points can be created against the
attributes of the UI element or against the bitmap of the UI elements. Also the activte screen
functionalty of QuickTest professional is supported.
The following figure is a snapshot of the object repository containing ui elements definitions of an
Android device.
The script in key word view looks like is illustrated by following figure:
here.
Document prepared by- V Prashanth
Tool architecture
The architecture for mobile application testing is shown in the following figure.
The agent is a program that is running on the mobile device or inside the emulator. The agent executes
the test command and will in case of recording, capture the action on the mobile device. The agent
contains
CPU footprint of the agent is very low so that the Agent does not influence the good working of the
device when replaying a test script.
the GUI recognition functionality. Jamo Solutions did take special care that the memory and
Document prepared by- V Prashanth
The agent is not communicating directly with QuickTest Professional. The communication is routed
through the device manager program. Both QuickTest Professional and the device manager program are
running on the PC.
The device that runs the agent is connected to the PC using either WIFI or USB connection.
Overview license mechanism of M-eux Test
Jamo Solutions offers different license formulas. These are:
• A seat license locked to the PC
• A site license is a network based license whereby PC’s connected to a central license server
program, can run M-eux test. The customer can define the number of licenses needed.
Overview standard/professional edition of M-eux Test
M-eux can be purchased in two editions: a standard edition and the professional edition.
The standard edition contains all functionality to create, maintain and execute the automated test
script.
The professional edition contains al functionality of the standard edition and includes also the Wan
connector for remote execution of test cases, the test case scheduler and access to all scripting
environments.
M-eux Test editions:
Document prepared by- V Prashanth
Document prepared by- V Prashanth