Saturday, 10 August 2013

How to Connect to a Database in QTP

Const adOpenStatic = 3
Const adLockOptimistic = 3 Const adUseClient = 3 Set objConnection = CreateObject("ADODB.Connection") Set objRecordset = CreateObject("ADODB.Recordset") objConnection.Open "DRIVER={Microsoft ODBC for Oracle};UID=;PWD=" objRecordset.CursorLocation = adUseClient objRecordset.CursorType = adopenstatic objRecordset.LockType = adlockoptimistic ObjRecordset.Source = "select field1,field2 from testTable" ObjRecordset.ActiveConnection = ObjConnection ObjRecordset.Open 'This will execute your Query If ObjRecordset.recordcount>0 Then    Field1 = ObjRecordset("Field1").Value    Field2 = ObjRecordset("Field2").Value End If

How to Search String

Functions retrieves all the instances of the searched string and returns the number of instances detected, also a reference array will give you ‘additional information about the locations of the searched string. This is done using Instr and Chr function.
Public Function InStrAll( _
ByVal nStart, ByVal sString1, ByVal sString2, _
ByVal nCompare, ByRef arrRes)
Dim nBookMark, nFound, nCount
Dim i
nCount = 0 : nBookMark = nStart
Do
‘— searching the position found.
nFound = InStr(nBookMark, sString1, sString2, nCompare)
If nFound > 0 Then
nCount = nCount + 1
‘— resizing the array with preserve to store new location
ReDim Preserve arrRes(nCount – 1)
arrRes(nCount – 1) = nFound
‘— setting the next start point to search
nBookMark = nFound + 1
End If
Loop While nFound > 0
InStrAll = nCount
End Function

What is Load Testing

  • Load Testing is creation of a simulated load on a real computer system by using virtual users who submit work as real users would do at real client workstations and thus testing the systems ability to support such workload.
    Load testing is the measure of an entire Web application’s ability to sustain a number of simultaneous users and transactions, while maintaining adequate response times. It is the only way to accurately test the end-to-end performance of a Web site prior to going live.
    Two common methods for implementing this load testing process are manual and automated testing. Manual testing would involve
    • Coordination of the operations of users
    • Measure response times
    • Repeat tests in a consistent way
    • Compare results
    Testing of critical web applications during its development and before its deployment should include functional testing to confirm to the specifications, performance testing to check if it offers an acceptable response time and load testing to see what hardware or software configuration will be required to provide acceptable response time and handle the load that will created by the real users of the system
    Why is load testing important ?
    Load Testing increases the uptime for critical web applications by helping you spot the bottlenecks in the system under large user stress scenarios before they happen in a production environment
    When should load testing be done?
    Load testing should be done when the probable cost of the load test is likely less than the cost of a failed application deployment. Thus a load testing is accomplished by stressing the real application under simulated load provided by virtual users.
    Load testing generally refers to the practice of modeling the expected usage of a software program by simulating multiple users accessing the program’s services concurrently. As such, this testing is most relevant for multi-user systems. When the load placed on the system is raised beyond normal usage patterns, in order to test the system’s response at unusually high or peak loads, it is known as Stress testing. The load is usually so great that error conditions are the expected result.

What is Processes

Process is kind of program or task carried out by your PC. For e.g.
$ ls -lR
ls command or a request to list files in a directory and all subdirectory in your current directory – It is a
process. Process defined as:
“A process is program (command given by user) to perform specific Job. In Linux when you start
process, it gives a number to process (called PID or process-id), PID starts from 0 to 65535.”

What is Shell Script

Shells are interactive. It means shell accept command from you (via keyboard) and execute
them. But if you use command one by one (sequence of ‘n’ number of commands) , the you can store this sequence of command to text file and tell the shell to execute this text file instead of entering the commands. This is know as shell script.
Shell script defined as:
“Shell Script is series of command written in plain text file. Shell script is just like batch file is MS-DOS but have more power than the MS-DOS batch file.”