Friday, 30 December 2011

Effective Software Testing

In this article am going to explain what is Effective Software Testing. Effective software testing can be measured  if the goal and purpose of the testing is clearly defined. Some of the typical Testing goals are:
01.Testing an application in each phase of the Development cycle and ensure that the defects are eliminated at the earliest.
02.Testing to ensure that the defects are not creep through the final cycle of the application.
03.Testing to ensure the reliability of the application.
04.Testing to ensure that the application meets the customer's requirement.

The effectiveness of the testing can be measured with the degree of the success in achieving the above mentioned goals.

Steps to Effective Software Testing:
Several factors influence the effectiveness of Software Testing Effort, which ultimately determine the success of the Project.
 Coverage:
 The testing process and the test cases should cover
·         All the scenarios that can occur when using the software application
·        Each business requirement that was defined for the project
·       Specific levels of testing should cover every line of code written for the application
There are various levels of testing which focus on different aspects of the software application. The often-quoted V model best explains this: 
The various levels of testing illustrated above are:
     ·         Unit Testing
·         Integration Testing
·         System Testing
·         User Acceptance Testing
The goal of each testing level is slightly different thereby ensuring the overall project reliability.
 Each Level of testing should provide adequate test coverage. 
*  Unit testing should ensure each and every line of code is tested
*  Integration Testing should ensure the components can be integrated and all the interfaces of each component are working correctly
*  System Testing should cover all the “paths”/scenarios possible when using the system.
The system testing is done in an environment that is similar to the production environment i.e. the environment where the product will be finally deployed.
There are various types of System Testing possible which test the various aspects of the software application.

Test Planning and Process:
To ensure effective Testing Proper Test Planning is important 
An Effective Testing Process will comprise of the following steps:
·         Test Strategy and Planning
·         Review Test Strategy to ensure its aligned with the Project Goals
·         Design/Write Test Cases
·         Review Test Cases to ensure proper Test Coverage
·         Execute Test Cases
·         Capture Test Results
·         Track Defects
·         Capture Relevant Metrics
·         Analyze
Having followed the above steps for various levels of testing the product is rolled.

It is not uncommon to see various “bugs”/Defects even after the product is released to production. An effective Testing Strategy and Process helps to minimize or eliminate these defects. The extent to which it eliminates these post-production defects (Design Defects/Coding Defects/etc) is a good measure of the effectiveness of the Testing Strategy and Process.
The success of the project and the reliability of the software application depend a lot on the effectiveness of the testing effort. 

Sunday, 13 November 2011

Unit Testing


This articles give the details about Unit Testing. Unit Testing represents the validation of the individual units of the source code works as expected. In programming point of view a Unit can be function, procedure or an individual program etc.,

Unit testing is normally done by the Developers and not by the end users.

Usage Of Unit Testing:

The main purpose of the Unit testing is to isolate/separate part of the applications source code and make sure that the each unit is doing the expected task. Unit testing provides bottom up testing approach.In this we are making sure that the each part of the source code is working as expected then will be integrated with other modules. In this way we can eliminate the issues at earlier stage.

It provides a sort of the living documentation of the system.Developers looking to learn what functionality is provided by a Unit and also provides an idea to that how to use the specific units. It gives a basic understanding of an API.Unit test cases embody characteristics that are critical to the success of the unit. These characteristics can indicate appropriate/inappropriate use of a unit as well as negative behaviors that are to be trapped by the unit. A unit test case, in and of itself, documents these critical characteristics, although many software development environments do not rely solely upon code to document the product in development.

Unit testing facilitates the change.It means that it allows the developer to refactor the code at later date and also make sure that the module is still working as expected. The test cases for the  unit testing can be written and also code change can be done easily.

When software is developed using a test-driven approach, the unit test may take the place of formal design. Each unit test can be seen as a design element specifying classes, methods, and observable behavior.

Unit testing provides an option to separate the interface from implementation. Because some classes may have references to other classes, testing a class can frequently spill over into testing another class. A common example of this is classes that depend on adatabase: in order to test the class, the tester often writes code that interacts with the database. This is a mistake, because a unit test should usually not go outside of its own class boundary, and especially should not cross such process/network boundaries because this can introduce unacceptable performance problems to the unit test-suite. Crossing such unit boundaries turns unit tests into integration tests, and when test cases fail, makes it less clear which component is causing the failure. See also Fakes, mocks and integration tests.

Instead, the software developer should create an abstract interface around the database queries, and then implement that interface with their own mock object. By abstracting this necessary attachment from the code (temporarily reducing the net effective coupling), the independent unit can be more thoroughly tested than may have been previously achieved. This results in a higher quality unit that is also more maintainable.

Limitations:
Like other testing types, Unit testing has its limitations.Testing can't be expected to catch every error in the program.We may have n number of ways to evaluate a unit. So, by using unit testing we can't execute all possible ways of executing a particular unit.So, we can simply tell that Unit testing will not be used to catch the errors caused due to integration.Unit testing should be done in conjunction with other testing activities. Like other testing, Unit testing can show the presence of the errors not the absence of the errors.

Saturday, 15 October 2011

Debugging In QTP

This article explains the procedure to debug the scripts in QTP. Every Automation Engineers should be strong in debugging. Then only we can fix the script issues in a fast manner and complete the scripts successfully.
Here comes the steps involved in debugging.
01. Debugging Configuration: Navigate to Tools> Options > Run tab and make sure that the option "Normal" is enabled. If this options is disabled we can come to know that the Microsoft Script Debugger is not installed. We need to install the script debugger to enable this option.


02.Using Breakpoints: Breakpoints are inserted into script to switch the script from normal mode to debugging mode. We can insert the break point for the selected step by pressing F9 or right click on the step and select "Insert/Remove Breakpoin.." from the context menu. So, the script execution will be stopped on the selected line.
Assume that we have 4 lines of code and inserted the breakpoint on 6th line.So, the script execution will be stopped at 4th line.
Note: One Red Dot will be appeared on the left side of the selected line once the break point is inserted.


03. Enabling the Debug Viewer: Debug viewer is used to watch the values of the variables during execution. So, we should enable the debug viewer.Debug viewer can be enabled by selecting the option View>Debug Viewer.


04. Assume that we have the following code.
          01. Dim a,b
          02. a="This is the debugging code"
          03. b=Left(x,4)
          04. MsgBox b  'Assume that the break point is inserted here.


05.Working with Watch expression tab in Debug Viewer: In this tab we can add the variables a,b in left columns and can see the contents of the variables in right column of each variable. As per above example we can see "This is the debugging code" and "This" for the variables a and b respectively and also length of a,Mid of a also displayed. We can also change the values of each variables by double clicking on it.


06. Working with Variables tab in Debug Viewer: We can see the name and values of all variables that are currently visible in the local scope.As per the above example we can see "This is the debugging code" and "This" for the variables a and b respectively.


07. Working with Command Tab in Debug Viewer: This tab is used to execute the VBScript statements interactively. Select the tab and then type b "changed from command" and press Enter key.. Now navigate to Variables tab and can the value for b as "changed from command".

Friday, 14 October 2011

QTP Short Cut Keys

This article gives the short cut keys details.

File Menu

New > Test CTRL + N
New > Business Component CTRL + SHIFT + N
New > Scripted Component ALT + SHIFT + N
New > Application Area CTRL +Alt + N
Open > Test CTRL + O
Open > Business Component CTRL + SHIFT + O
Open > Application Area CTRL + ALT + O
Save CTRL + S
Export Test to Zip File CTRL + ALT + S
Import Test from Zip File CTRL + ALT + I
Print CTRL + P

Edit Menu

Cut CTRL + X (EV only)
Copy CTRL + C
Paste CTRL + V
Delete DEL
Undo CTRL + Z (EV only)
Redo CTRL + Y (EV only)
Rename Action F2
Find CTRL + F (EV only)
Replace CTRL + H (EV only)
Go To CTRL + G (EV only)
Bookmarks CTRL + B (EV only)
Complete Word CTRL + Space (EV only)
Argument Info CTRL + SHIFT + SPACE (EV only)
Apply “With” To Script CTRL + W (EV only)
Remove “With” Statements CTRL + SHIFT + W (EV only)

Insert Menu

Checkpoint > StandardCheckpoint F12
Output Value > Standard Output Value CTRL + F12
Step > Step Generator F7
New Step F8 OR INS (KV only)
New Step After Block SHIFT + F8 (KV only)
Key: KV = Keyword View
EV = Expert View


Test/Component/Application Area Menu

Record F3
Run F5
Stop F4
Analog Recording CTRL + SHIFT + F4
Low Level Recording CTRL + SHIFT + F3
Step Menu
Object Properties CTRL + ENTER
Value Configuration Options CTRL + F11 on an input value
(KV only)
Output Options CTRL + F11 on an output value
(KV only)

Debug Menu

Pause PAUSE
Step Into F11
Step Over F10
Step Out SHIFT + F11
Insert/Remove Breakpoint F9
Clear All Breakpoints CTRL + SHIFT + F9

Data Table Options

Edit > Cut CTRL + X
Edit > Copy CTRL + C
Edit > Paste CTRL + V
Edit > Clear > Contents CTRL + DEL
Edit > Insert CTRL + I
Edit > Delete CTRL + K
Edit > Fill Right CTRL + R
Edit > Fill Down CTRL + D
Edit > Find CTRL + F
Edit > Replace CTRL + H
Data > Recalc F9
Insert Multi-line Value CTRL + F2 while editing cell
Activate next/previous sheet CTRL + PAGEUP/CTRL + PAGEDOWN

General Options

View Keyword View/Expert View CTRL + TAB
Open context menu for step or Data Table cell SHIFT + F10
or Application key ( )
Expand all branches * [on numeric keypad] (KV only)
Expand branch + [on numeric keypad] (KV only)
Collapse branch - [on numeric keypad] (KV only)
 

Thursday, 13 October 2011

Synchronization in QTP

Synchronization is the process of matching the speed of the AUT and QTP inorder to get the proper execution of results.As part of the script execution QTP give the instructions step by step with the same speed. Sometimes AUT may respond quickly. Sometimes AUT may take time to respond. In such kind of situations we may not proper result. To resolve these type of issues, we can use synchronization.

Synchronization can be done by using any one of  the following methods.

01. Using Wait method:By using this we can make the script to wait for n-number of seconds before moving to next step. But this is not most useful method. Assume that we have given the waiting time as 20 seconds and the AUT is responding in 5 seconds. But the execution will be resumed after 20 seconds only.Wait method is useful to capture the screenshots when the script is waiting for the desired number of time. Wait method doesn't requrie any references.It's a VBScript function.So, can be used globally.

Syntax:Wait(time in seconds).

02. Inserting Synchronization points: Make sure that QTP is in recording mode.Keep the cursor in the desired location and navigate to Insert menu> Synchronization point>select the object> OK> select property name and value as True>Enter time in milli seconds and click ok> Stop recording.
 
Syntax: Object.WaitProperty "property name","value",time in milli seconds

03. Increasing QTP default time wait:We can change the QTP synchronization time out by navigating File> Settings> Run tab > Increase the synchronization time out.The same time setting is applicable for all steps in the script. But the main advantage is the script will move to next step as soon as the current step is over. It'll not wait for the maximum amount of time configured.

04. Sync method: This method can be used with web based applications only. This method waits for the browser to complete the current operation.
Syntax: Browser("aaa").Page("bbb").Sync
Appropriate Methods selection:

01.Suppose in our test one or more statements only are taking more time for execution then selecting “Inserting synchronization method” is better.
02. Suppose in our test more statements are taking more time for execution then selecting “increasing tool time out” .
03. Above two are local features but wait statement is Vbscript feature, even though some drawbacks are there in using wait statement, it is better to use wait statement in functions.

Wednesday, 12 October 2011

How to close all browsers in QTP?

This is very basic task to be done by the automation test engineer before starting the script execution.It's always better to kill/close
all related applications to avoid the unexpected behavior of QTP.
For example we can take a web based application.Assume that there are
n-number of windows has been opened for the same application. In such kind of scenarios, it's always better to close all windows and start from scratch.
 To achieve this we can use the QTP browser property "CreationTime".CreationTime indicates the order in which the browsers are opened.

Assume that we opened 5 browsers at 1.10,1.12,1.13,1.14 and 1.15.So, we will have the creation times as 0,1,2,3 and 4 for each browsers.The browsers can be closed by using the creation time.

Code Snippet:

01.While Browser("CreationTime:=0).Exist
02.Browser("CreationTime:=0)
03.Eend

Details of the above snippet:

01. Checks whether the first opened browser exists or not
02. Closes the first opened browser
03. Loop end

We can also close the browsers based on the mask.Assume that we opened n-number of Google sites.All browsers will have the URL as "Google.com"This is called mask. We can use the following code snippet to close the browsers based on the mask.

Dim Url, CreationTime,Mask
Mask="Google.com"
CreationTime="0"
While Browser("CreationTime:="&CreationTime).Exist
Url=Browser("CreationTime:="&CreationTime).GetROProperty("Url")
'check whether Url contains the mask
If InStr(Url,Mask)>0 Then
'Close the current browser
Browser("CreationTime:="&CreationTime).close
Else
CreationTime=CreationTime+1
End If
Wend

Using the above code snippet we can close the browsers dynamically by mask.

Saturday, 24 September 2011

Descriptive Programming In QTP

Assume that we want to perform some operation on the objects which are not present in the object repository.In such kind of situation we can use descriptive programming.

There are two ways to write descriptive programs.
01. By giving the description in the form of string arguments
02. By creating the properties collection object for description

01.By giving the description in the form of string arguments:

This is the most commonly used method.We can directly describe an object in the form of property:=value pairs instead of describing the object name.

The general syntax for this type is TestObject("PropertyName:= PropertyName", "...","PropertyValue:= PropertyValue"). Where TestObject could be WebEdit, WinEdit etc.

Consider the following code. 

<input type = "textbox" name = "txtName" -->
<input type = "radio" name = "txtName" -->

So,the descriptive code for the above samples will be, Browser("aaa").Page("bbb").WebEdit("Name:="txtName","htmi tag:=INPUT").set "quicktestprofessional"
  
Browser("aaa").Page("bbb").WebRadioGroup("Name:="txtName","htmi tag:=INPUT").set "quicktestprofessional"

We can also distinguish the above two object by using their index. 

Browser("aaa").Page("bbb").WebEdit("Name:="txtName","htmi tag:=INPUT","Index:=0").set "quicktestprofessional"  ---> Represent the webedit object.
  
Browser("aaa").Page("bbb").WebRadioGroup("Name:="txtName","htmi tag:=INPUT","Index:=1").set "quicktestprofessional" --. Represents the radio button object.

We can determine the property,value pairs by using object spy.

* Navigate Tools > Object Spy
* Once selected select the "Test Object Properties" button
* Spy on the desired object
* From the properties list not down the property values to be used in test.

02. By creating the properties collection object for description

Properties collection also does the same as the property and value pairs. The only difference is it collects all properties of a particular object in an instance of that object.So, the object can be identified by that instance of the object instead of string arguments.

In this method first we need to create the empty description as follows.
Set oDesc = Description.Create

We need to use the properties name, value and regular expressing for an object.The syntax will be oDesc(html tag).value ="INPUT".

When we use a property name for the first time the property is added to the collection and when you use it again the property is modified. By default each property that is defined is a regular expression. 

Consider the following example,
obj_Desc(“html tag”).value= “INPUT”
obj_Desc(“name”).value= “txt.*”.

This would mean an object with html tag as INPUT and name starting with txt. Now actually that “.*” was considered as regular expression. So, if you want the property “name” not to be recognized as a regular expression then you need to set the “regularexpression” property as FALSE.

oDesc(“html tag”).value= “INPUT”
oDescc(“name”).value= “txt.*”
oDesc(“name”).regularexpression= “txt.*”

This is how we create a description. Now below is the way we can use it. Browser(“aaa”).Page(“bbb”).WebEdit(obj_Desc).set “quicktestprofessional”

Assume that we have more than one element in the same page.We can use the index property to differentiate the elements.Assume that we have 2 text boxes on the same page.In that case we can use the index property as follows.

Representing 1st text box:
oDesc("html tag").value ="INPUT"
oDesc("name").value ="txt"
oDesc("index").value ="0" 

Representing 2nd text box:
oDesc("html tag").value ="INPUT"
oDesc("name").value ="txt"
oDesc("index").value ="1" 

We can also use this method to identify the child objects on the same page.Assume that we have n-number of check boxes on the same screen.By using the collection properties we can loop through the n-number of objects. 

Set oCheckBox = Description.Create
oCheckBox("html tag").value ="INPUT"
oCheckBox("type").value ="checkbox"
Dim sCheckBox,aCheckBoxes
Set aCheckBoxes= Browser("aaa").Page("bbb").ChildObjects(oCheckBox)

'Loop through the checkboxes
For each sCheckBox in aCheckBoxes
 sCheckBox.set "ON"
Next

The above code will check all the check boxes present on the page. To get all the child objects we need to specify an object description.

When and Where to use Descriptive programming?

Below are some of the situations when Descriptive Programming can be considered useful:

1. One place where DP can be of significant importance is when you are creating functions in an external file. You can use these function in various actions directly , eliminating the need of adding object(s) in object repository for each action[If you are using per action object repository]

2. The objects in the application are dynamic in nature and need special handling to identify the object. The best example would be of clicking a link which changes according to the user of the application, Ex. “Logout <>”.

3. When object repository is getting huge due to the no. of objects being added. If the size of Object repository increases too much then it decreases the performance of QTP while recognizing a object. [For QTP8.2 and below Mercury recommends that OR size should not be greater than 1.5MB]

4. When you don’t want to use object repository at all. Well the first question would be why not Object repository? Consider the following scenario which would help understand why not Object repository
Scenario 1:
Suppose we have a web application that has not been developed yet.Now QTP for recording the script and adding the objects to repository needs the application to be up, that would mean waiting for the application to be deployed before we can start of with making QTP scripts. But if we know the descriptions of the objects that will be created then we can still start off with the script writing for testing
Scenario 2: Suppose an application has 3 navigation buttons on each and every page. Let the buttons be “Cancel”, “Back” and “Next”. Now recording action on these buttons would add 3 objects per page in the repository. For a 10 page flow this would mean 30 objects which could have been represented just by using 3 objects. So instead of adding these 30 objects to the repository we can just write 3 descriptions for the object and use it on any page.

5. Modification to a test case is needed but the Object repository for the same is Read only or in shared mode i.e. changes may affect other scripts as well.
6. When you want to take action on similar type of object i.e. suppose we have 20 textboxes on the page and there names are in the form txt_1, txt_2, txt_3 and so on. Now adding all 20 the Object repository would not be a good programming approach.

Wednesday, 21 September 2011

Recovery Scenarios In QTP

We may come across some unexpected errors or exceptions during our test case execution. Consider the following scenario. Assume that after every step of the execution, we need to print the result.So, we need to call the printer from our script. Assume that the printer is out of paper.Obviously we will get the  message "Printer Out of Paper" pop up. This is an unexpected behavior results in test cases failure. So, we should have a mechanism to handle these type of unexpected behaviors.To handle these type of unexpected behaviors we have recovery scenarios in QTP.

We can use "On Error Resume Next"  or "if step" in our script if we know the exact place in which the exception occurs every time based on the scenario.But sometimes we can't handle the above mentioned scenario directly in test cases. Because we don't know that the time taken by network  to respond when the printer is out of paper. By that time the script could have crossed the step which handles the unexpected behavior. So, our test case will fail. In such conditions,it's always better to use recovery scenarios.

The main important to remember when using the recovery scenarios are as follows.

Trigger Event: Trigger the event which causes the script execution interruption.For example, we can say that the pop up which displays the printer out of paper message.

Recovery Option: The operations to be performed to enable QTP to continue the script execution.As per our example, we need to clock on "OK" button in the pop up window which causes the script interruption.

Post Recovery Operation: The operation which represents the actions to be performed after recovery. It means that from which step script execution to be started. For example, we can restart the test execution from beginning or skip the step which causes interruption.

Recovery scenarios will be stored with the file extension ".rs".A recovery scenario file is a logical collection of recovery scenarios, grouped according to your own specific requirements. By default, QTP checks for recovery triggers when an error is returned during the run session. You can use the Recovery object's method to force QTP to check for triggers after a specific step in the run session. 
For the complete list of recovery scenarios go to QTP Documentation > Quick Test Advanced References > Quick Test Automation > Recovery Object.

Monday, 19 September 2011

Smart Identification In QTP

Sometimes the mandatory properties of an object can be changed during run time. So, QTP will enable to the Smart Identification mechanism to identify such kind of objects.

We can configure a set of properties in smart identification dialog box to identify the objects whose properties are changed during run time. Those properties are called as Base filter properties and Optional filter properties.QTP will automatically enable the smart identification mechanism if the selected object is unable to identify.

QTP uses Base Filter Properties and Optional Filter Properties to identify the objects. Base filter properties are the properties which can't be changed until the essence of the object is changed. Assume that a web link is changed from tag A is changed to some other tag Ex: B. So, we can't call both objects are same

Assistive properties are the properties which will be used by QTP if the mandatory properties are not enough to identify the objects. These properties will not be changed on a regular basis. QTP may use ordinal identifier to identify the objects if the base filter and assistive are not enough to identify the objects.

We can get more details about the smart identification from QTP help by reading the following topics.

  1. About Configuring Smart Identification
  2. Understanding the Smart Identification Process
  3. Reviewing Smart Identification Information in the Test Results
  4. Walking Through a Smart Identification Example
  5. Step-by-Step Instructions for Configuring a Smart Identification Definition

Thursday, 15 September 2011

Tips to become a good software tester

In this article am trying to give some tips for the software test engineers to be at their best.


01. Test engineers should be involved from the requirement phase of the project. They should understand the requirement of all modules in the project.
02. Based on the understanding of the module, the Test Engineer should implement some process.The same process should be followed by all the resources in the ream. If we do so, we can filter most of the issues at initial phase itself.
03. The test engineers can create some template to follow.They should force all resources in the team to follow the same template.
04. If there are any changes in the requirement the same should be updated in the testing document. It's always better to keep the back up of the document based on the old requirement. It'll not be useful if the requirement is changed. Still we can keep it.
05.Once the requirement is finalized divide the project into chunks. It'll be helpful to know which module have more priority than other module.
06. Once the project is divided into chunks, identify the impacted areas. It means that the issue in one module may impact the behavior of other module.So, those type of modules should be given high priority.
07. Then prepare test scenarios for each module first.Then we can write the test scenarios for the impacted areas.
08. Do the peer review as soon as the test scenarios are ready.It'll be helpful to clarify if there is any doubt. Then we can use the standard template to write the test cases.
09. Test cases should clearly describe the action to be done. Number of steps should be less as well as descriptive.Based on the functionality we can give the priority of the test cases as High,Medium, Low.
10.Once the test cases are ready we can match the cases with requirement to make sure that all modules has been covered.


11. The most important thing is identify the module which has the complex code with the help of developer.We have to give more attention to the specific modules.

Tuesday, 13 September 2011

Tips To Write Quality Test Cases

This article gives some basic ideas to write the complete test cases.
Before writing the test cases the tester should know the complete functionality of the module. Then only we can develop both positive and negative test cases.We can divide the test case relation as Test Scenario > Test Case > Test Steps.
Test Scenario: It comes directly from the requirements or userstory. It represents the list of test cases and often their sequences.
Test Case: It consists of the list of test steps need to be performed. And may linked to environmental situations, link to bugs etc.
Test Step: It represents the action to be performed and the expected result from the application.
So, as a tester, we need to make sure that the quality test cases are in place to test against the application and deliver it with high quality.
I am trying to give some of the tips to write quality test cases here. 


01. We need have one complete template to create the test cases. We can have template in the form of excel spread sheet or some customized tool.


02. Test cases should be descriptive and specific. The title of the test case should be short , concise and   descriptive. Test case should clearly define the purpose and scope of the operations.
03.Test cases should be reusable in many scenarios.


04.We should create both positive and negative test cases. So, it’s important to remember the order of test  cases. Positive test cases should cover the expected behavior of the application. In turn negative test cases should cover the un expected behavior of the application. So,it is always better to keep the relationship between the positive and negative test cases.


05.Test cases should be atomic in nature. Assume that the test case is too long and doing too much of dependency checks. It’ll be a nightmare for a tester to all dependency check each and every time and also reducing the tester’s motivation and vigilance.


06.We need to refactor the test cases. It means that we need to re write or update the test cases whenever there is a change in functionality. It should be strictly followed by all testers to make sure that the test cases are always matching or covering all functionalities in the project.


07.As a tester, we should always have the test data for the complex as well as easy test cases. The test data should be attached in the form of binary data along with the test cases.


08. We need to make sure that all required configurations are in place before executing the test cases. We can have a list of checklist to make sure that the required configurations are in place.


09.It’s always better to have the review with the peers as well as product analyst. It’ll help in big time to make sure that we are not missing anything.

Saturday, 3 September 2011

Expert View in QTP

This article explains the details about the expert view in QTP.
Creating new steps in a Test using Expert view.We can insert new step into QTP by anyone of the following ways.
01.Use "STEP GENERATOR"
02.Enter steps manually in expert view
03.Record steps on the AUT
04.Use the ACTIVE SCREEN
05.Enter the steps directly
Using Step Generator:Step Generator can be accessed through Insert> Step> Step Generator from the menu.Steps are organized according to three categories.Test Objects,Utility objects,Functions.To define a new step we need to complete Object or Library,Operation and Arguments fields.We can also insert the additional steps by selecting INSERT ANOTHER STEP checkbox and clicking on OK button.
Manual Entry of Steps:Steps can also be added directly to tests and components with the expert view.Expert view also provides Statement completion,Auto expand VBScript syntax,Content-sensitive help.
By Using Statement completion feature presents options for finishing the VBScript file.The feature useful in the following contexts.
01. When you type a class followed by a parenthesis.QTP displays the test  objects in the object repository  for that class.
02.When you type a object followed by a dot,QTP displays the child objects and methods for that objects.
03.When a method is typed QTP displays the arguments for that method.
Expanding VBScript Syntax:The AUTO EXPAND VBSCRIPT SYNTAX feature returns VBScript statements that match characters you typed.You trigger the feature by typing some initial characters and then pressing the space key.QTP looks for VBScript statements that match the initial characters you typed.If only one statement fits the criteria, that statement is entered automatically. If multiple options exist, a dialog is opened in which you select your choice.If the VBScript statement has a closing keyword as well as an opening keyword (e.g., FOR…NEXT) the closing keyword will also be entered automatically into the script.
Launching Context-Sensitive Help:QTP’s online help is context-sensitive. This means that the help page displayed will differ depending on where the cursor is.You can use context-sensitive help to retrieve the description of any object, method, or statement in your script.To open context-sensitive online help, place the cursor on the desired item and select HELP>QUICK TEST PROFESSIONAL HELP from the menu or type F1. The QUICK TEST PROFESSIONAL HELP window opens to a page describing the item you elected.
With Statement:The VBScript WITH statement allows you to perform a series of operations on the same object.By using the WITH statement, you can group related steps together to make the script easier to read.To convert a script so that sequential steps related to the same object are grouped together using a WITH statement, select EDIT>APPLY “WITH” TO SCRIPT from the menu.To return the script to its previous format, select EDIT>REMOVE “WITH” STATEMENTS  from the menu.
Basic Debugging:Once you have created the script for your test or component, you will need to debug it to ensure that it is free of errors.QTP provides debug features to help you perform each of the following:
Find syntax errors.Execute a script from a desired step,Add breakpoints,Execute single steps.
Finding Syntax Errors: QTP will check your script for syntax errors whenever you switch from the Expert View to the Keyword View. The SYNTAX ERRORS window opens, displaying the following information for each error found in your script:Action Name,Line,Description.To navigate directly to an error in your script, select the error and click GO TO ERROR.
Executing Steps from a desired step:The RUN FROM STEP option allows you to execute a QTP script starting from any step in the script.To use this option, place the cursor at the desired starting step and select TEST>RUN FROM STEP.Note: You will need to manually navigate the AUT to the state expected by the step in your script.
Adding Breakpoint:Breakpoints allow you to suspend a run session at a pre-determined place in the script in order to inspect the run-time state of your application.To set a breakpoint, place the cursor on the desired step and select DEBUG>INSERT/REMOVE BREAKPOINT. The breakpoint symbol is displayed in the left margin of the script.To remove the breakpoint, place the cursor on the step and select DEBUG>INSERT/REMOVE BREAKPOINT again.When you are done debugging, you can clear all breakpoints from a script by selecting DEBUG>CLEAR ALL  BREAKPOINTs.
Executing Single Steps:The step commands in the DEBUG menu allow you to execute a single step of a script. These commands are available once a run session has been paused.The commands are Step Into,Step Over,Step Out.

Friday, 2 September 2011

SQL Statements

This article explains the various statements available in SQL.


Data Retrival: SELECT
This statement is used to retrieve the data from the database.
Data Manipulation Language[DML]:INSERT, UPDATE, DELETE, MERGE
This statement is used to enter the new data,update the existing data, deleting the existing data and merging the data in the selected table of a database.So, these statements are called as Data Manipulation Language.
Data Definition Language[DDL]: CREATE,ALTER,DROP,RENAME, TRUNCATE
Sets up the database and removes the data from database.So, these commands are collectively known as Data Definition Language.
Transition Control: COMMIT,ROLLBACK, SAVEPOINT
These statements are used to manage the the changes made by DML statements.Changes to the data can
be grouped together into logical transactions.
Data Control Language [DCL]: GRANT,REVOKE

Gives or removes access rights to both the Oracle database and the structures within it. Collectively known as data control language.












Best Practices In Automation Testing

This article talks about many interesting things like what's the Case for Automated Testing, Why Automate the Testing Process?, Using Testing Effectively, Reducing Testing Costs, Replicating testing across different platforms, Greater Application Coverage, Results Reporting, Understanding the Testing Process, Typical Testing Steps, Identifying Tests Requiring Automation, Task Automation and Test Set-Up and Who Should Be Testing?.


The Case for Automated Testing
Today, rigorous application testing is a critical part of virtually all software development projects. As more organizations develop mission – critical systems to support their business activities, the need is greatly increased for testing methods that support business objectives. It is necessary to ensure that these systems are reliable, built according to specification and have the ability to support business processes. Many internal and external factors are forcing organizations to ensure a high level of software quality and reliability.

Why Automate the Testing Process?
In the past, most software tests were performed using manual methods. This required a large staff of test personnel to perform expensive and time-consuming manual test procedures. Owing to the size and complexity of today’s advanced software applications, manual testing is no longer a viable option for most testing situations.

Using Testing Effectively
By definition, testing is a repetitive activity. The methods that are employed to carry out testing (manual or automated) remain repetitious throughout the development life cycle. Automation of testing processes allows machines to complete the tedious, repetitive work while human personnel perform other tasks. Automation eliminates the required “think time” or “read time” necessary for the manual interpretation of when or where to click the mouse. An automated test executes the next operation in the test hierarchy at machine speed, allowing test to be completed many times faster than the fastest individual. Automated test also perform load/stress testing very effectively.

Reducing Testing Costs
The cost of performing manual testing is prohibitive when compared to automated methods. The reason is that computers can execute instructions many times faster and with fewer errors than individuals. Many automated testing tools can replicate the activity of a large number of users (and their associated transactions) using a single computer. Therefore, load/stress testing using automated methods requires only a fraction of the computer hardware that would be necessary to complete a manual test.

Replicating testing across different platforms
Automation allows the testing organization to perform consistent and repeatable test. When applications need to be deployed across different hardware or software platforms, standard or benchmark tests can be created and repeated on target platforms to ensure that new platforms operate consistently.

Greater Application Coverage
The productivity gains delivered by automated testing allow and encourage organization to test more often and more completely. Greater application test coverage also reduces the risk if exposing users to malfunctioning or non-compliant software.

Results Reporting
Full-featured automated testing systems also produce convenient test reporting and analysis. These reports provide a standardized measure of test status and results, thus allowing more accurate interpretation of testing outcomes. Manual methods require the user to self-document test procedures and test results.

Understanding the Testing Process
The introduction of automated testing into the business environment involves far more than buying and installing an automated testing tool.
Typical Testing Steps: Most software testing projects can be divided into general steps

Test Planning: This step determines like ‘which’ and ‘when’.
Test Design: This step determines how the tests should be built the level of quality.
Test Environment Preparation: Technical environment is established during this step.
Test Construction: At this step, test scripts are generated and test cases are developed.
Test Execution: This step is where the test scripts are executed according to the test plans.
Test evaluation: After the test is executed, the test results are compared to the expected results and evaluations can be made about the quality of an application.
Identifying Tests Requiring Automation
Most, but not all, types of tests can be automated. Certain types of tests like user comprehension tests test that run only once and tests that require constant human intervention are usually not worth the investment incurred to automate. The following are examples of criteria that can be used to identify tests that are prime candidates for automation.

High path frequency – Automated testing can be used to verify the performance of application paths that are used with a high degree of frequency when the software is running in full production. Examples include: creating customer records.

Critical Business Processes – Mission-critical processes are prime candidates for automated testing. Examples include: financial month-end closings, production planning, sales order entry and other core activities. Any application with a high –degree of risk associated with a failure is a good candidate for test automation.

Repetitive Testing – If a testing procedure can be reused many times, it is also a prime candidate for automation

Applications with a Long Life Span – If an application is planned to be in production for a long period of time, the greater the benefits are from automation.

Task Automation and Test Set-Up
In performing software testing, there are many tasks that need to be performed before or after the actual test. For example, if a test needs to be executed to create sales orders against current inventory, goods need to be in inventory. The tasks associated with placing items in inventory can be automated so that the test can run repeatedly. Additionally, highly repetitive tasks not associated with testing can be automated utilizing the same approach.

Who Should Be Testing?
There is no clear consensus in the testing community about which group within an organization should be responsible for performing the testing function. It depends on the situation prevailing in the organization.

 
Back To Top