Sunday, June 26, 2011

Swap two numbers

Swap two numbers without using any other parameter
a=10
b=20
a=a+b
b=a-b
a=a-b
msgbox a&" "&b

Swap two numbers using some extra parameter
a=10
b=20
temp=a
a=b
b=temp
msgbox a&" "&b

Different Test Case design techniques

1. BVAs
2. ECPs
3. Decision tables
4. State Transition graphs\Cause -Effect graphs
5. Error guessing etc...

Examples for High Severity and Low priority and Low Severity and High Priority

High Severity and Low Priority
a. Any out of scope items
b. Network problems which are intermittent

Low Severity and High Priority
a. Spell mistakes in company names or logos
b. Copyright content used in the application

How to check a value exists in a weblist using QTP

noItems=browser("name:=Web*.*").page("title:=Web*.*").weblist("name:=depart").GetROProperty("items count")
flag=false
For i=1 to noItems
If lcase(browser("name:=Web*.*").page("title:=Web*.*").weblist("name:=depart").GetItem(i))="uday" then
flag=true
end if
Next

If flag=true Then
msgbox "Exists"
else
msgbox "Not Exists"
End If

What is the difference between Smoke testing and Sanity testing

Smoke Testing:

A smoke test is a series of test cases that are run prior to commencing with full-scale testing of an application. The idea is to test the high-level features of the application to ensure that the essential features work. If they do not work, there is no need to continue testing details of the application, so the testing team will refuse to do any additional testing until all smoke test cases pass. This puts pressure on the development team to ensure that the testing team does not waste valuable testing time with code that is not ready to be tested.
Smoke testing can be done for testing the stability of any interim build.

Sanity Testing:

Once a new build is obtained with minor revisions, instead of doing a through regression, sanity is performed so as to ascertain the build has indeed rectified the issues and no further issue has been introduced by the fixes. Its generally a subset of regression testing and a group of test cases are executed that are related with the changes made to the app.
Generally, when multiple cycles of testing are executed, sanity testing may be done during the later cycles after through regression cycles.

Saturday, June 25, 2011

What are limitations of Virtual Objects in QTP



  1. QuickTest does not support virtual objects for analog or low-level recording.
  2. The Web page or application window must be the same size and in the same position when recording and running tests s as it was when you defined the virtual object.
  3. You cannot insert any type of checkpoint on a virtual object.
  4. The virtual object should not overlap other virtual objects in your application or Web page.
  5. You can define virtual objects only for objects on which you can click or double-click and which record a Click or DblClick step. Otherwise, the virtual object is ignored.

Friday, June 24, 2011

Difference between Stored Procedure, Trigger and Functions

Difference between Stored Procedure and Trigger:

A stored procedure is a group of Transact-SQL statements that is compiled one time, and then can be executed many times. This increases performance when the stored procedure is executed because the Transact-SQL statements do not have to be recompiled.

A trigger is a special type of stored procedure that is not called directly by a user. When the trigger is created, it is defined to execute when a specific type of data modification is made against a specific table or column.

A CREATE PROCEDURE or CREATE TRIGGER statement cannot span batches. This means that a stored procedure or trigger is always created in a single batch and compiled into an execution plan.



Difference between a function and a stored procedure:

1. Functions can be used in a select statement where as procedures cannot

2. Functions takes only input parameters, where as Procedure takes both input and output parameters.

3. Functions cannot return values of type text, ntext, image & timestamps where as procedures can.

4. Functions can be used as user defined datatypes in create table but procedures cannot
Eg:-create table (name varchar(10),salary getsal(name))

Difference between truncate and delete in SQL Server

1. Truncate is DDL command
1. Delete is a DML command
2.
Truncate operation cannot be rolled back.
2. Delete operation can be rolled back.
3. By using Truncate operation, it deletes everything and reconstructs the table structure (schema). We can’t retain the values.
3. By using Delete we can retain the deleted values.
4. We cannot use where clause in truncate.
4. Where clause can be used with Delete.
5. By using Truncate operation, all the identities will be deleted
5. By using Delete identities cannot be deleted.

6. The syntax for truncating a table is: truncate table tablename.
6. The syntax for deleting rows from a table is: delete from table or delete from table where condition
7. Truncate table is faster and uses fewer system and transaction log resources than Delete.
7. The Delete statement removes rows one at a time and records an entry in the transaction log for each deleted row.
8. Because Truncate table is not logged, it cannot activate a trigger.
8. It can activate a trigger.




Sunday, June 12, 2011

QTP Script to execute a SQL Query

Dim recordsetObj,commandObj
Dim connectionStr,queryStr

Set commandObj=createobject("ADODB.command")
Set recordsetObj=createobject("ADODB.recordset")
connectionStr="driver=sql server;server=papdsr05;database=test;uid=sa;pwd=sa"
queryStr="select * from employee"

commandObj.activeconnection=connectionStr
commandObj.commandtext=queryStr
Set recordsetObj=commandObj.execute
while not recordsetObj.EOF
empname=recordsetObj.fields("EmpName").value
recordsetObj.movenext
wend
'commandObj.close
recordsetObj.close