Wednesday, October 6, 2010

How to Connect QC Using QTP

  • When working with automation testing scripts using Quality centre and QTP, need to established the connection
  • Make sure that QC Add-in installed into local system in ‘Quality Centre connectivity Add-in”
Quality Centre:
Quality Center is a data portal for collecting and storing data relevant into a manual testing process, Automation Scripts and business components

Invoke the QTP Application and click File-Quality Center Connection

  • Provide the Server URL, Username, and Password, Domain and Project Information and User can able to retrieve/Access the Data portal from quality Centre















Open the Scripts/function library and data files from QC:

  •         If Click Open -> Quality Centre Test Plan, it will populated all the folder structure in Quality centre














Save all the scripts/function in QC:

  • Select the Stored the file location
  • Entered File Name
  • If you require to save Active Screen files into QC
  • Finally click ‘Save’ button

Tuesday, October 5, 2010

Check and Create the Folder in Local System

Public Function CreateFolder()
   Environment.Value("OutSideViwerAutoFolderPath") = "C:\COPEPerlAutomationExecution"
   Set fs = CreateObject("Scripting.FileSystemObject")
   If fs.FolderExists(Environment.Value("OutSideViwerAutoFolderPath")) = False Then
     fs.CreateFolder (Environment.Value("OutSideViwerAutoFolderPath") )
   else
     Msgbox "Folder Exists"
   End if
  End Function

Read the Value from the Notepad

Call ReadNotepad(oBjmyfile,oBjFileLocation,Trn,oBjAmtDate)
Public Function ReadNotepad(oBjmyfile,oBjFileLocation,Trn,oBjAmtDate)
                                    Const ForReading = 1, ForWriting = 2
                                    myfile = "!!" & Space(1) & "REF" & Space(1) & oBjmyfile
                                    Set FSOj = CreateObject("Scripting.FileSystemObject")
                                    Set oFRead = FSOj.OpenTextFile(oBjFileLocation,ForReading,True)
                                    Do until oFRead.AtEndOfStream
                                    oFRd = oFRead.Readline()
                                    MyValue1 = strcomp(oFRd,myfile,0)
                                    If Myvalue1 = 0  Then
                                                Do until oFRead.AtEndOfStream
                                                mysubfileread = oFRead.Readline()
                                                            If left(mysubfileread,4) = ":20:"  Then
                                                                        values = split(mysubfileread,":")
                                                                        Trn=values(2)
                                                                        For i=0 to 5
                                                                                    Secondvalue = oFRead.ReadLine()
                                                                                    trimSecondvalue = trim(Secondvalue)
                                                                        If left(trimSecondvalue,5) = ":32A:"  Then
                                                                                    values1 = split(trimSecondvalue,":")
                                                                                    oBjAmtDate=values1(2)      
                                                                        Exit do
                                                                        End If
                                                                        elseIf left(trimSecondvalue,5) = ":32B:"  Then
                                                                                    values2 = split(trimSecondvalue,":")
                                                                                    oBjAmtDate=values2(2)      
                                                                        Exit do
                                                                        End If
                                                                        Next
                                                                        Exit do
                                                                        Exit do
                                                            End if
                                                Loop                                                                                                                            
                                    End If
                                    Loop
End Function

Find the Notepad File in Specific Folder Location

Public Function FindNotepad()
   oBjFolderLocation =  "C:\COPEPerlAutomationExecution"
   oBjFile Name = "SubfileName.txt"
   oBjFileLocationOutSideTestData = Environment.Value("OutSideViwerAutoFolderPath") & "\" & "OutSiderViewerSubfileName.txt"
 Msgbox oBjFileLocationOutSideTestData
   Set FSOj = CreateObject("Scripting.FileSystemObject")
   If (FSOj.FileExists(oBjFileLocationOutSideTestData) = True) Then
    Msgbox "Hi"
  Set oFRead = FSOj.OpenTextFile(oBjFileLocation,ForReading,True)
  Do until oFRead.AtEndOfStream
  oFRd = oFRead.Readline()
  Msgbox oFRd
  loop
  MyValue1 = strcomp(oFRd,myfile,0)
  If Myvalue1 = 0  Then
  Do until oFRead.AtEndOfStream
  mysubfileread = oFRead.Readline()
  End if
    End If
End Function