Friday, May 29, 2009

Connection string in QTP?

connection string is a string that specifies information about a data source and the means of connecting to it. It is passed in code to an underlying driver or provider in order to initiate the connection.

Connections are built by supplying an underlying driver or provider with a connection string, which is a way of addressing a specific database or server and instance as well as user authentication credentials (for example, Server=sql_box;Database=Common;User ID=uid;Pwd=password;). Once a connection has been built it can be opened and closed at will, and properties (such as the command time-out length, or transaction, if one exists) can be set. The Connection String is composed of a set of key/value pairs as dictated by the data access interface and data provider being used.

Client Side and Server Side Applications

Client side scripting languages are Javascript, VbScript, PHP…etc
Client side scripting languages are useful to validate the inputs or user actions from user side or client side.
Client side scripting is good because it won’t send the unwanted input’s to server for validation. From front-end it self it validate the user inputs and restricts the user activities and guides him

Server side Scripting languages are
Perl, JSP, ASP, PHP.etc
Server side Scripting languages are to validate the inputs at server side.

These scripting languages provide security for the application. And also provides dynamic nature to web or client server application

Thursday, May 28, 2009

Whats the difference between HTTP and HTTPS?

http is hyper text transfer protocol which is responsible for transmitting and receiving information across the Internet where as https is secure http, which is used exchanging confidential information with a server, which needs to be secured in order to prevent unauthorized access.

HTTP is Hyper Text Transport Protocol and is transmitted over the wire via PORT 80(TCP). You normally use HTTP when you are browsing the web, it's not secure, and so someone can eavesdrop on the conversation between your computer and the web server. HTTP can support the client asking for a particular file to be sent only if it has been updated after a certain date and time. This would be used if the client has already retrieved a copy of a file by that name from that server, but wants to check to see if it has been updated since then. The server responds either with the updated file, with a message to say the file has not been changed, or with a message that the file no longer exists.

HTTPS (Hypertext Transfer Protocol over Secure Socket Layer or HTTP over SSL) is a Web protocol developed by Netscape and built into its browser that encrypts and decrypts user page requests as well as the pages that are returned by the Web server. HTTPS is really just the use of Netscape's Secure Socket Layer (SSL) as a sub layer under its regular HTTP application layering. (HTTPS uses port 443 instead of HTTP port 80 in its interactions with the lower layer, TCP/IP.) SSL uses a 40-bit key size for the RC4 stream encryption algorithm, new-age browsers use 128-bit key size which is more secure than the former, it is considered an adequate degree of encryption for commercial exchange. HTTPS is normally used in login pages, shopping/commercial sites.

How it Work
Https is not a separate protocol, but refers to the combination of a normal HTTP interaction over an encrypted Secure Sockets Layer (SSL) or Transport Layer Security (TLS) transport mechanism. This ensures reasonable protection from eavesdroppers and (provided it is implemented properly and the top level certification authorities do their job properly) man-in-the-middle attacks.

The default TCP port of an https: URL is 443 (for unsecured HTTP, the default is 80). To prepare a web-server for accepting https connections the administrator must create a public key certificate for the web-server. These certificates can be created for Linux based servers with tools such as Open SSL's ssl or SuSE's gensslcert. This certificate must be signed by a certificate authority of one form or another, who certifies that the certificate holder is who they say they are. Web browsers are generally distributed with the signing certificates of major certificate authorities, so that they can verify certificates signed by them.

When does Test Automation Makes Sense

1.When there is a repetitive task
2.When you want to do load test an application
3.API based testing
4.Human errors will be minimized
6.Number of resources will be reduced
7.Consistency in test results

Tuesday, May 26, 2009

Connect to Oracle DataBase using QTP

'Reference: Microsoft ActiveX Data Objects 2.7 library

'Dim cnn As ADODB.Connection
Set cnn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.RecordSet")

' Open a connection by referencing the ODBC driver in sql server
' cnn.ConnectionString = "driver={SQL Server};&server=MySqlServer;uid=MyUserName;pwd=MyPassword;database=pubs"

' Open a Connection using an ODBC for oracle
cnn.ConnectionString = "DRIVER={Microsoft ODBC for Oracle};DSN=real;UID=gopi;PWD=orcl;"
cnn.ConnectionTimeout = 30

' Find out if the attempt to connect worked.
If cnn.State = adStateOpen Then ' or cnn.State=1
MsgBox "connected to database"
MsgBox "connectin failed.."
End If

'execute sql query
rs.Open "SELECT * FROM promotion.t_p_promo_master WHERE f_promo_id = 60082", cnn

' Create a Recordset by executing an SQL statement.
' Set rs = cnn.Execute("Select * From authors")
'Remember that the returned Recordset object from connection.execute is always a read-only,
'forward-only cursor. If you need a Recordset object with more functionality, you should
'first create a Recordset object with the desired property settings and then use the
'Recordset object's Open method to execute the query and return the desired cursor type.

' Send a Delete statement to the database.
'cnn.Execute ("Delete From authors Where au_id = '011-01-0111'")

' Find out how many rows were affected by the Delete.
'Set rs = cnn.Execute("Select @@rowcount")
' Display the first field in the recordset.
'MsgBox rs(0) & " rows deleted"
'in above the command passed to the data source is a Delete statement. Because no rows are returned, you do not need to explicitly use a Recordset object. How many rows were deleted? You can use the recordsAffected parameter to find out.

'Running stored prcedure
' Create a recordset by running a stored procedure.
' Set rs = cnn.Execute("Exec byroyalty 50")

Do While Not rs.EOF
'copy each field
'Worksheets("Sheet1").Range("A3").End(xlDown).Offset(1, 0) = rs.Fields(0)

'display each field in the record set
For Each Field In rs.Fields
MsgBox Field


' Close the connection.

TestCases on Physical Objects like Pen,Book or Chair etc

Test cases on different objects generally asking are ::Pen, Book,Chair .
In general when we are writing a test case for objects like above, we should consider the objects parameters like
• Look and feel
• Performance
• Usability
• Rigidity
Look and feel means external appearance like outer case must be attractive. Look and feel parameters are, Color, Height, Width, Design Material used for making it, .etc
If you come for performance the important parameters are, Durability, Continuous perfromence...Etc.
Usability: How easy to use that thin Accessibility
Rigidity How strong it is How it is working in abnormal conditions For example if you want to write test cases for a pen Then first start with look and feel.
If you com for software enabled objects Notepad, Yahoo login, For above objects we should check Different menu options are working properly Functionality of buttons, Memory capacities, Look and feel, Speed of operation…etc

Friday, May 22, 2009

Retrieve the nth highest salary from emp table?

SELECT * FROM emp e1 WHERE &N = (SELECT COUNT(DISTINCT (e2.salary)) FROM emp e2 WHERE e2.salary >= e1.salary)


select max(sal) FROM emp where not in(select top n sal from emp)order by sal desc;
N -> Nth highest salary of the month

Reterieving the Top2 salaries from the employee table:
Select * from EMP e where 2>= (select count (*) from EMP e where sal>e.sal) order by desc sal

Thursday, May 21, 2009

Dynamic arrays in QTP?

You can use the Dim statement to declare an array with empty parentheses to declare a dynamic array. You use the Preserve keyword to preserve the data in an existing array when you change the size of the last dimension

Dim a() ' Allocates nothing.we can't declare array as a(2) and resize it to a(4)
ReDim preserve a(0)
a(0) = 0
ReDim preserve a(1)
a(1) = 1
ReDim preserve a(2)
a(2) = 2
ReDim preserve a(3)
a(3) = 3
ReDim preserve a(4) ' to preserve the contents of the array as the resizing takes place.
a(4)= 4
For each ite in a
msgbox ite ' o/p : 0 1 2 3 4

Arrays in QTP

Dim a(3) ' Allocates the fixed storage space. can't be changed dynamically when array size fixed.
a(0) = 0
a(1) = 1
a(2) = 2
a(3) = 3
'a(4)= 4 'subscript out of range error
For each ite in a
msgbox ite ' o/p : 0 1 2 3
Erase a ' Each element is reinitialized and Free memory used by array.

Retrieve the nth highest salrary from an employee table?

Which environments does QTP support?

Windows,Web,Visual Basic : Default Add-ins
NET, Java/J2EE, SAP, Siebel, Oracle, PeopleSoft, , ActiveX, Terminal emulators and Web services.

What is meant by Priority and severity?

Priority means “Importance of the defect w.r.t customer requirement”.And also it indicates how fast theDeveloper should act on it.

Severity means “Seriousness of the defect w.r.t functionality”.How it affects the Testing.

1 - Urgent
2 - High
3 - Medium
4 - Low

Returned for closure

What are the file extensions available in QTP?

.vbs or .qfl :::: for function libraries
.xml or .ini :::: for Environment Variables
.mtr and .tsr :::: for PerAction and Shared Repositories
.mts ::: Script Extensions
.mst ::: ActionTemplate (in dat folder .provides the Header for comments)

How many ways we can parameterize data in QTP?

Test or Action Parameters
Environment Variables
Random Numbers
DataTable Parameters

What is the Diff between Image check-point and Bit map Check point

Image checkpoints enable you to check the properties of a Web image.We dont have Image checkpoint directly available.Navigation is : StandardCheckpoint -> click on image -> edit the check point properties like index, ALT Tag, URL of the image.

You can check an area of a Web page or application as a bitmap using Bitmap Checkpoint....checkpoint-> Bitmap Checkpoint

Bitmap check points checks the image Comparing bit by bit and also you can check the whole image or part of the image.

Main components of Quality Center Tool

Quality Center is a Test Management tool from hp(previously Mercury) which can be opened or accessed using Internet Explorer Web Browser only.It has 4 important components from the all of its components which Tester will have to work with.In this Tool we can write the test cases(in Test Plan tab) and execute the test cases(in Test Lab) and report the mismatches(in Defects tab).
2.Test Plan
3.Test Lab

Difference Between KeywordView and Expert View

The changes that we make in Keyword view will be reflected to Expert View and vice-versa is also very much possible.....

KeywordView will be useful for those who doesn't have the knowledge of VB Scripting and want to generate the VB statements.

Wednesday, May 13, 2009

Difference Between InvokeApplication and SystemUtil.Run

SystemUtil.Run can open the Desktop applications or System Applications without need to specify the full path for system applications.Other thatn this It can open any application provided the full path of the application. It can open non-executable file and executable files.
This will be generated with Recording option while the application is selected from Start Menu।
object.Run file, [params], [dir], [op], [mode]
SystemUtil.Run "iexplore.exe","" ,,,,
We can also close the process by using CloseProcessByName method.

The InvokeApplication statement is supported primarily for backward compatibility. .It can open executable files only.
invokeapplication "C:\Program Files\Internet Explorer\iexplore.exe"
invokeapplication "\Program Files\Internet Explorer\iexplore.exe","C:"

3...alternatively we can also use the following..
Set objshell = createobject("") "notepad.exe"

Tuesday, May 12, 2009

Difference between Client/Server and Web Testing

The following list of testings are performed specifically on Client/Server Applications.

1.Installation Testing.
You will need to aware of clients and servers and their locations in the test scenario.
They may be New Installation,Upgrade.
2.Testing related to LAN, Centralized hardware and software.

The following list of testings are performed specifically on Web Applications.

1.Compatibility Testing(Browser and OS)
2.Load Testing

More to ::
Web systems are one type of client/server. The client is the browser, the server is whatever is on the back end (database, proxy, mirror, etc). This differs from so-called “traditional” client/server in a few ways but both systems are a type of client/server. There is a certain client that connects via some protocol with a server (or set of servers).

Also understand that in a strict difference based on how the question is worded, “testing a Web server” specifically is simply testing the functionality and performance of the Web server itself. (For example, I might test if HTTP Keep-Alives are enabled and if that works. Or I might test if the logging feature is working. Or I might test certain filters, like ISAPI. Or I might test some general characteristics such as the load the server can take.) In the case of “client server testing”, as you have worded it, you might be doing the same general things to some other type of server, such as a database server. Also note that you can be testing the server directly, in some cases, and other times you can be testing it via the interaction of a client.

You can also test connectivity in both. (Anytime you have a client and a server there has to be connectivity between them or the system would be less than useful so far as I can see.) In the Web you are looking at HTTP protocols and perhaps FTP depending upon your site and if your server is configured for FTP connections as well as general TCP/IP concerns. In a “traditional” client/server you may be looking at sockets, Telnet, NNTP, etc.