Skip to main content

Posts

Featured Post

WebDriver setup with Eclipse IDE for Java

Recent posts

Convert JSON to XML using QTP/UFT/VBScript

Sample Code : Dim strPage,strJSON,objIE strPage = "C:\Jay\JLoader.html" Set objIE = CreateObject("InternetExplorer.Application") objIE.Visible = True objIE.Navigate2 strPage While objIE.Busy : Wend strJSON = "{""FirstName"":""Jay"", ""LastName"":""Krishna""}" Set objWin = objIE.document.parentWindow objWin.execScript "var jsonStr2XML = function(strJSON) { return json2xml(JSON.parse(strJSON));};" Msgbox  oWin.jsonStr2XML(strJSON) objIE.Quit

In Detail:
Converting The most popular data interchange format JSON(JavaScript Object Notation) to XML using QTP/UFT.
Parsing JSON in UFT could be a challenge so we will use JavaScript in UFT to make it perfect.
SO We need :              Java Script API  - To Convert JSON to XML                         JavaScript Files : http://goessner.net/download/prj/jsonxml/json2xml.js http://goessner.net/download/prj/jsonxml/xml2json.js
             JSON parser …

Jenkins Integration with HP QTP/UFT & HP QC/ALM

Over – View:
üHP QTP/UFT should be integrated with HP QC/ALM. üJenkins should be configured. üInstall Jenkins HP Application Automation ToolsPlugin üCreate a Build & Run
How to Configure HP Application Automation ToolsPlugin:
§Goto Jenkins Home Page navigate to “Manage Jenkins” -> “Manage Plugins” §Search for HP Application Automation Toolsplugin and install. §Restart the Jenkins with adding “restart” as URL parameter like “http://servername:8080/restart” §Now Goto Jenkins - > Mange Jenkins - > Manage System

§Fill the HP QC/ALM Details and Save. §Now Navigate back To Jenkins Home page and Click on New Item. §Select type as Freestyle project andenter the Build Name. §Fill the required details and select Build Triggers  as  Build periodically and specify the schedule. §Select Add Build Step as “Execute HP functional tests from HP ALM” §Select ALM Server which we have configured and fill the HP ALM Details. 
§Select Post-build Actions as “Editable Email Notification” for automatic mail. W…

Intro to CI (Continuous integration) - Jenkins

                                 Continuous integration is a process to integrate development work and Testing to identify the development errors as early as possible to achieve rapid application delivery throughout the software application lifecycle.
 The Jenkins Over-View: Jenkins is one open source tool to perform continuous integration. The basic functionality of Jenkins is to execute a predefined list of steps based on a certain trigger. For example the trigger might be a time based trigger or conditional trigger or etc.
                             Builds can be started by various means, including being triggered by commit in a version control system, by scheduling via a cron-like  mechanism, by building when other builds have completed, and by requesting a specific build URL.
Eg - execute build every 30 minutes.
The basic list of steps: perform a software build with Apache Maven or Gradle Run a shell scriptArchive the build resultAfterwards start the integration…

Send Mail uisng Outlook with Vb Script or QTP/UFT

strToaddress ="Jayakrishna@sample.com;Jayakrishna2@sample.com"
strSubject ="Sample-Subject"
strBody ="Sample-Body"
strAttachPath ="C:\Dump\Sample.txt"

SendMailFromOutlook strToaddress,strSubject,strBody,strAttachPath

Function SendMailFromOutlook(strToaddress,strSubject,strBody,strAttachPath)
Dim objOut, Objmail
Set objOut =CreateObject("Outlook.Application")
Set Objmail = objOut.CreateItem(0)

With Objmail
        .To= strToaddress
        .Subject = strSubject
        .Body = strBody
If strAttachPath <>""Then
            .Attachments.Add(strAttachPath)
EndIf
        .Save
        .Send
EndWith

'Clear the memory
Set objOut =Nothing
Set Objmail =Nothing
EndFunction

Note : Mail will be sent from your Local Configured Outlook.

ZipFiles/Folders Using VB Script in QTP/UFT

Sample:
 strmyFolderPath = "C:\Jay\Sample"
strZipFilePath  = "C:\Jay\MySampleFile.Zip"
Call  ZipMyFolder( strmyFolderPath, strZipFilePath )


Function ZipMyFolder( strmyFolderPath, strZipFilePath )
Dim intSkipped, intSrcItems
Dim objApp, objFolder, objFSO, objItem, objTxt
Dim strSkipped

Const ForWriting =2

    intSkipped =0

' Make sure the path ends with a backslash
IfRight( strmyFolderPath, 1)<>"\"Then
        strmyFolderPath = strmyFolderPath &"\"
EndIf

' Use custom error handling
OnErrorResumeNext

' Create an empty ZIP file
Set objFSO =CreateObject("Scripting.FileSystemObject")
Set objTxt = objFSO.OpenTextFile( strZipFilePath, ForWriting, True)
    objTxt.Write"PK"&Chr(5)&Chr(6)&String(18, Chr(0))
    objTxt.Close
Set objTxt =Nothing

' Abort on errors
IfErrThen
        ZipMyFolder =Array(Err.Number, Err.Source, Err.Description)
Err.Clear
OnErrorGoto0
ExitFunction
EndIf

' Create a Shell object
Set objApp …