Thursday, February 4, 2010

My Rajgad trek

Hmm...Finally something to cheer about after long QTP blogs and here I am writing my first travel blog. First of all let me thank all 5 great trekkers who accompanied me and kept my morale high troughout our journey ;).
We had an exciting last weekend wher we spent the whole night chilling out ...literally. It was around 12 degrees but the wind flow gave you an hint about what chilling out meant. We left Pune at 6 (We were supposed to leave at 3:30 but who cares about punctuality in India...thanks to my fellow members) crossed the 12 km stretch on NH4 towards Satara with 4 stops last being at new McDonalds outlet. It was almost dark when we reached the base of Rajgad so decided to have some food. We started around 9 pm and made our way to the top from the 'CHOR DARWAJA'. It was the brightest full moon night and we had some interesting photo shoots during our journey. One of our trekker was about to leave his baggage at base after 10 mins of walking (or I should say was eager to come along without luggage) so we had no other option to carry it on other shoulders. At about 12:30 we had reached the temple on top and then were scavenging for a place to sleep. Finally got one behind the temple had our fire place lit up and we were fast asleep in our bags. Morning sun was extremely beautiful from the fort top and we clicked in heaps. We then started climbing the BAALEKILLA early(9 am is early) in the morning reached the top at about 10AM and enjoyed the beauty of Western Ghats from the top. Visited MACCHI on our way down and came back to the temple for our lunch. Then we started our looong journey down hill as few of our trekkers were afraid of heights. Kicked bikes and zoomed off to Pune with again break at McD. It was fun altogether.

Tuesday, November 10, 2009

Conencting to open internet explorer instance

We come across this situation many times wherein we need to connect to some application already invoked by some other part of code. Simple goggling gives examples about invoking an application but there are very few examples which explains connecting to already open application. Here is small snippet which enables user to connects to existing IE.
Dim objInstances, objIE, strURL
strURL = ""
Set objInstances = CreateObject("Shell.Application").windows
If objInstances.Count > 0 Then ' To make sure we have IE instance open.
For Each objIE In objInstances
Dim sName
sName = UCASE(objIE.FullName)
If Right(sName, 12) = "IEXPLORE.EXE" Then ' Searching for internet explorer
objIE.Navigate strURL ' Navigate to intended URL
Exit For
End if
Next
Else
wscript.echo "No explorer windows are open."
End if


Sometimes there are simple solutions to complex problems, isn't it ?

Friday, August 28, 2009

Testing WebServices using QTP

It is tricky but extremely simple to test web services using QuickTest. I was given this task of creating a framework for testing a particular set of Use Cases which had to be done using services as no UI was available. I started with using the Web Services wizard to pass input parameters and get the output data sets or values. Later I found that the same could not be extended as the Object Repository holds the Webservice name with wsdl path and port name. This forced me think differently to make every parameter configurable.Let's first know few points:

1) SOAP : SOAP, which stands for Simple Object Access Protocol, is defined by the SOAP standard available at http://www.w3.org/TR/SOAP. The SOAP protocol defines the format of standard XML messages that are used to communicate among systems. Because the message format is standardized and based on the XML standard, SOAP can be used to communicate among multiple computer architectures, languages, and operating systems. SOAP enables a new class of applications called Web services, which expose services in a standard way so that application developers can create new applications by putting together services from many different sources on the Web.There are four main areas covered by the SOAP specification: a required SOAP Envelope format that defines what the envelope that surrounds the XML content of a SOAP message must look like; an optional set of encoding rules that defines how language types are mapped to XML in a SOAP message (since this is defined in section 5 of the specification, it is referred to as "section 5 encoding"); an optional RPC format that defines how function calls are expressed in SOAP messages; and an HTTP binding that defines how SOAP messages may be exchanged through HTTP.

2) WSDL: WSDL stands for Web Service Description Language. In order to successfully call a Web service you will need to know how to get to the service, what operations the service supports, what parameters the service expects, and what the service returns. WSDL provides all of this information in an XML document that can be read or machine-processed.
The next necessary steps to call this SOAP method using the high-level SOAP API are:create a SOAPClient objectinitialize the SOAPClient object with the WSDL fileand call the method
Below is a snippet for same:
Set oSOAPClient = CreateObject("MSSOAP.SoapClient")

oSOAPClient.mssoapinit wsdl_path, service_name, port_name

oSOAPClient.Methodname param1, param2, return_param1

Above snippet might give error while running on windows 2003 of ActiveX component. To correct it download the SOAP Tool kit from msdn version 3.0 and install it and following change to first line of script:

Set oSOAPClient = CreateObject("MSSOAP.SoapClient30")


Reply back to me if you need any clarifications or updates.

Tuesday, August 18, 2009

Recursive search in vbscript.

It was this particular thing in vbscript which was lurring me from many days. I had written a small script for downloading Test Cases from Quality Center to Excel. QC 9.5 provides this as in built functionality but we had some old systems where in we had to pull all existing cases in Excel. The code was ready and I found that it needed exact path from QC logical folder structure to find all cases within it. There was a dire need to search within the given path to find all sub folders and test cases within them.

There was another requirement to replace one particular string from many script files stored on a server where quality center was installed. I had to replace all scripts which get saved on qc file system which had a particular string present in it. All test cases of type QUICK_TEST get saved with Script.mts file holding the actual textual part of script.

Here is a snippet to find particular file type (e.g.: Here i have searched for .mts file type as it was our requirement) within given folder and it searches in all sub folders present in it:

strDir = "D:\rohan\test"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objDir = objFSO.GetFolder(strDir)RecursiveFunc (objDir)

Sub RecursiveFunc(Dir_Passed)
For Each Item_File In Dir_Passed.Files
If LCase(Right(CStr(Item_File.Name), 3)) = "mts" Then
wscript.Echo Dir_Passed & "\" & Item_File.Name
End If
Next

For Each Item_Fldr In Dir_Passed.SubFolders
'wscript.Echo Item_Fldr.Name & " recursed"
RecursiveFunc (Item_Fldr)
Next
End Sub

Wednesday, May 20, 2009

QTP issue 'Sheet already in use'.

I came up with this unique issue wherein i was receiving this 'Sheet already in use error popup when i was trying to execute my QTP scripts. The QTP scripts were upgraded from 9.2 to 10.0 wherein we had lost the association between External Reusable Actions and the main script which used to call those reusable actions. The Default.xls did not loose Data Tables for the called Reusable actions. We could not help but delete those additional sheets from Default.xls and only then the scripts started running fine. Now even today i still doubt about the upgrade issues we have faced during upgrading QTP from 9.2 to 10.0. I can list atleast 10 issues here and still many to foloow i guess.
But sometimes i feel it was good that we had issues... I get paid for resolving it :)

Tuesday, May 12, 2009

Disabling the security popup for specified hostnames or IPs.

It happens many times that we get a security pop up and we haven't handled it some of our automated QTP scripts which invoke exe files on those remote locations.
Following steps would help eliminating the issue once for all:
1) Click Start, Run and type INETCPL.CPL
2) Select the Security tab, Trusted sites
3) Click Sites button Add the IP address or hostname of the remote computer to the list(You can also add the network shares to the Local Intranet zone.)
4) Uncheck Require server verification (https:) for all sites in this zone and click Close
5) Click OK, OK and close the dialog

The methodology works only for Windows.

Monday, April 27, 2009

Create or Delete Service

I know this is old now but still thought of posting it once here as it is required by most of the developers across the globe and newbies find it difficult sometimes to find it.
To create a Service follow the following steps:
1) Go to Start -> Run and type cmd in the Open: line. Click OK.
2) Type: sc create
3) Reboot the system

To Delete a Service follow the following steps:
1) Go to Start -> Run and type cmd in the Open: line. Click OK.
2) Type: sc delete
3) Reboot the system

If you are interested in deleting the service from registry you need to follow the following steps:
1) Go to Start -> Run and type regedit in the Open: line. Click OK.
2) Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
3) Scroll down the left pane, locate the service name, right click it and select Delete.
4) Reboot the system
The procedure works for Windows Xp as well as NT.