Skip to main content

Posts

Create DSN using VB Script in ODBC

    'Create the Filesystem Object     Const SystemFolder= 1     Set oFso = CreateObject("Scripting.FileSystemObject")     Set SysFolder =oFso.GetSpecialFolder(SystemFolder)     SysFolderPath= SysFolder.Path     'Set the Driver details     DriverPath = SysFolderPath & "\sqora32.dll"     DriverName = "Oracle in Oraclient11g_home4"     'get the required details     DataSourceName = "Sample Source Name"     DatabaseName = "DB Name"     sDescription = "Odbc Desc " & DatabaseName        tnsNames = "Tns Names"     userId  = "User name"             'Create Shell Object     Set WshShell = CreateObject("WScript.Shell")     'Set the Key in the register of DSN ...

Working with BLOB or CLOB Objects in QTP

The below Code will Insert the CLOB or BLOB objects in  Oracle DB using QTP. Sample Code: 'CLOB or BLOB file Path strClobFileName = "C:\Jay\SampleInputs\BLOBorCLOB.txt" 'Connection String strOracleConnectionString =  "Driver= {Microsoft ODBC for Oracle}; " &_                   "ConnectString=(DESCRIPTION=" &_                   "(ADDRESS=(PROTOCOL=TCP)" &_                   "(HOST=hostName) (PORT=1234))" &_                   "(CONNECT_DATA=(SERVICE_NAME=ABCD)));uid=userName; pwd=Password;" 'Create Required Objects Set objCon = CreateObject("Adodb.Connection") Set objRs = CreateObject("Adodb.Recordset") Set objCom = CreateObj...

Getting Record Count Using ADODB Connection in QTP

When you get the Record Count as  -1 Change the CursorLocation to 3 or 2 or 1(mostly 3 ll work) Sample Code:  strConnectionString =  "Driver= {Microsoft ODBC for Oracle}; " &_                   "ConnectString=(DESCRIPTION=" &_                   "(ADDRESS=(PROTOCOL=TCP)" &_                   "(HOST=hostName) (PORT=1234))" &_                   "(CONNECT_DATA=(SERVICE_NAME=ABCD)));uid=userName; pwd=Password;" strQuery = "Select * From Table" Set objCon = CreateObject("Adodb.Connection") objCon.CursorLocation = 3 Set objRs = CreateObject("Adodb.Recordset")  objCon.Open strConnectionString Set objRs = objCon.Exe...

HP Unified Functional Testing(UFT) 11.5

HP has launched  the latest version of QuickTest Professional (QTP). This new version of QTP is called HP Unified Functional Testing (UFT) 11.5 . Below is the sneak preview of some of the important new features that will be available in UFT 11.5 1) What is UFT 11.5? The new version of HP QTP is being called HP Unified Functional Testing 11.5 (UFT 11.5). UFT 11.5 is actually a combination of HP QTP (for testing GUI) and HP Service Test (for testing API). 2) Brand New Modern IDE This point has been discussed so many times at many forums. QTP’s IDE lacked the punch when compared to many modern IDE’s like Eclipse, Microsoft Visual Studio etc. It lacked many must have features that were there in many IDEs available in the market. With UFT 11.5, HP will be introducing a brand new modern IDE, which will a) have a new IDE aligned with modern dev IDEs (like Eclipse). b) have many new features such as script editing, coding, MDI, checkpoints, auto completion etc Image...

PDF Automation in QTP

                                                                            The most challenging issue with PDFs is that it could be of any kind, not just a tabular data; it could have plain text, images or even forms to fill up. So this makes a tester’s life a bit difficult, never mind, we will definitely find an easy of do it… Although there are already some better approaches we have to deal with PDF documents but I found many of us are facing so many difficulties using this. There are lots of queries coming at QTP forums asking for an easy way of doing it with PDFs. keeping those in my mind I started c...

Keep your windows machine Unlock while QTP Running.

Below are the Few ways to  Keep your windows machine Unlock: Way 1: Install the Caffeine 1.4 software on machine where u run the scripts.  =========================================================================== Way 2: Create a .vbs file with the below code and run the script using task scheduler Const DELAY_MINUTES = 10 Wscript.Sleep DELAY_MINUTES * 60000 Do    CreateObject(“Wscript.Shell”).SendKeys “+”    Wscript.Sleep DELAY_MINUTES * 60000 Loop ===========================================================================  Way 3: Create a .vbs file with the below code and run the script Const micVoid = 0 Const micByte = 26 Const micLong = 3 Const KEYEVENTF_KEYUP = &H2 Set Extern = CreateObject("Mercury.ExternObj") extern.Declare micVoid, "keybd_event", "user32", "keybd_event", micByte, micbyte, miclong, micLong Extern.Declare micVoid, "Sleep", "kernel32", "Sleep", micLon...

Read Outlook mail attachment and Body using Vb Script or QTP

Set olApp = CreateObject("Outlook.Application") Set olns = olApp.GetNameSpace("MAPI") Set ObjFolder = olns.GetDefaultFolder(6) j = 0 For each item1 in ObjFolder.Items        iattachCnt = item1.Attachments.Count     Print "Attachments Count: " & iattachCnt     For i = 1 to iattachCnt         Print "FileName :    " & item1.Attachments(i).FileName         Print "Display Name:   " & item1.Attachments(i).DisplayName         Print "Size: " & item1.Attachments(i).Size     Next     Print " Body : " & item1.body     Print "--------------------------------------Mail Num - " & j & " -----------------------------------------------"     j = j+1    Next