Monday, July 22, 2013

VB Script to Automate Internet Explorer without using any tool

In this post i will describe you how vb script can be used for automating internet explorer without using any tool.
The below mentioned text will open internet explorer and then google page put some text in the Text box.

Steps to follow:

Step 1:Open the notepad file

Step 2:Copy the below mentioned code and save the file with the .vbs extension.

Option Explicit

strText = "My VB Script"  'Enter some sample  Text over here.


Dim objLink , ie , WshShell , colLinks
Dim i , intDay , intOff , intcount , btn, strText, j
Dim strUser , strPwd , hwnd, Wnd, oShell, objImage, objImages , strOut

Sub WaitForLoad(obj)
   Do While ie.Busy
   Loop
 
   Do While obj.readyState <> 4
   Loop
   wscript.sleep(100)
End Sub

'Create ie and shell object
Set ie = WScript.CreateObject("InternetExplorer.Application")

Set WshShell = WScript.CreateObject("WScript.Shell")

'set the ie properties whichever you want that your internet explorer should contain.
ie.ToolBar = 1
ie.StatusBar = 1
ie.Width = 1500
ie.Height = 999
ie.Left = 0
ie.Top = 0
ie.Visible = 1

With ie
hwnd = .hwnd
      .Navigate "http://google.com"  'Enter URL  here that you want to work on.
End With

Set oShell = CreateObject("Shell.Application")
For Each Wnd In oShell.Windows
        If hwnd = Wnd.hwnd Then Set ie = Wnd
Next

'wait until the page has loaded before continuing

WaitForLoad(ie)

'Enter the user details

ie.Document.getElementByID("gbqfq").Value = strText 'Inspect it by using any inspect tool that you have.
WaitForLoad(ie)

Monday, July 15, 2013

VB Script || QC Code || QTP || Upload an attachment file and Send attachment file in mail from test plan automatically.

Below is the code that i used for sending mail from Quality Centre to the recipient list.The attachment is sent from Test Plan.

FilePath = ""    'File Path where your file is located.

Call UpLoadAttachmentToQC(FilePath)        ' Call the function to upload the attachment

Function UpLoadAttachmentToQC(FilePath)

Set ObjCurrentTest = QCUtil.CurrentTest.Attachments 'Creating QC Util Object with attachment

Set ObjAttch = ObjCurrentTest.AddItem(Null)    'Object for Current Test Set

ObjAttch.FileName = FilePath        'Attaching the File in the Object

ObjAttch.Type = 1  

ObjAttch.Post    'Post your Attachment to the QC

ObjAttch.Refresh   'Refresh the Object



Set attachFact = QCUtil.CurrentTest.Attachments 

'Here i have created attachment factory object which is associated with QC and it will fetch all the attachment from the current Test Plan and store it in attachList array of element.

Set attachList = attachFact.NewList("")          
ReDim Preserve AttachmentList(attachList.Count - 1)



  Dim i
  i = LBound(AttachmentList)


'Running loop for each attachment and uploading them from QC to an array.


   For Each theAttachment In attachList
         AttachmentList(i) = theAttachment.ServerFileName
          i = i + 1
  Next

Dim fName


  For Each fName In AttachmentList
      MsgBox "The AttachmentList element is: " & fName
  Next


Mailto = "abc@domainname"

'Use the send mail method of Quality Centre to sent mail to the concerned authorities with Attachment list array.


QCUtil.QCConnection.SendMail Mailto,,,,AttachmentList


End Function

Thursday, July 4, 2013

Excel QC Addin || Download And install

Most of the times i heard from tester how to use Excel Addin for QC integration. I have listed down the simple steps that would be easily help you to download and install excel addin which is really beneficial.

Step1: Download Excel Addin from the link mentioned below.
Download QC Addin for ALM

Step2: Install the addin on the machine which have QC configured with server link and make sure that any open excel is closed.

Step3:After Successful installation verify the Addin ribbon at the top of the Toolbar.

Step4:It Should show the option "Export to Quality Center"

Step5:Clicking on it wizard must open up successfully.

Step6: Congratulation you have installed the addin perfectly.

The Addin is used only to export the following components from Excel to QC.
  • Requirements
  • Defects
  • Test

If you still encounter any Problem....then let me know i would be happy to assist you.

HP Service Test Integration with ALM



Service Test integrates with ALM, the HP centralized quality solution. ALM helps you maintain a project of all kinds of tests (such as tests, components, business process tests, manual tests, tests created using other HP products,and so on) that cover all aspects of your application’s functionality. Each test or component in your project is designed to fulfill a specified testing requirement of your application. To meet the goals of a project, you organize the tests in your project in unique groups.
ALM provides an intuitive and efficient method for scheduling and running tests or components, collecting results, analyzing the results, and managing test and component versions. It also features a system for tracking defects,enabling you to monitor defects closely from initial detection until
resolution.
At its most basic level, integrating Service Test with ALM enables you to store and access tests, components, and resource files in an ALM project, when Service Test is connected to ALM.
Service Test integrates with Service Test Management, ALM’s extension for storing and managing application components, such as Web services.Service Test Management is an extension of ALM and it provides an efficient method for storing and retrieving application components.