Blog to understand automation concepts in QTP, Selenium Webdriver and Manual Testing concepts

Priniciple of Software Testing and Difference between QC and QA

Basics of Testing

Testing is a quality control activity with objectives as finding defects, gaining confidence on the quality of products and preventing defect. Testing should start as early as possible and should be planned for different phases of software life cycle. Early detection of defects reduces the cost of fixing defects.

Principles of Testing

Below are the principles of testing which should be taken into consideration while performing testing:

  • Testing shows presence of defect but we cannot ensure there are no defects in the system. The reason for this is described in next principle
  • Exhaustive testing is not possible as covering all combination of data and scenario is not feasible as it will take lot of cost and resources & time.
  • Testing Activity should start as soon as possible. This will result in defect fixed with less effort in development and development can more easily accommodate the changes in early phases than latter.
  • So now the question arises, which things to test first. Most of the defects are concentrated to small number of modules, which is defect clustering. So we need to concentrate more on modules more prone to defects.
  • Next test case needs to be updated regularly to avoid pesticide paradox i.e same test cases if executed again and again will not be able to find more defects.
  • Testing should be context sensitive, i.e before considering testing, we should take into consideration the impact and importance area of the application
  • And finally the product delivered and tested should match the client expectation, and is no purpose even if no defect is found, but product does not fulfill client requirement.

    

 Quality Control and Quality Assurance


Last point in the Testing principles mentions the product delivered to the customer should be quality product. To ensure quality of the product, we must follow quality assurance and quality control activities.

Quality Assurance ensures proper quality processes are followed during product development .For example. There are regular audits, inspections, review activities, estimations, testing process standards during the software life cycle to assure the quality of product.

Quality Control is the testing activities in which product quality is compared with expected standards and issue is raised in case of defects or non conformance being encountered.

Some of the most important Quality Factors are Correctness, Reliability, Efficiency, Integrity, Usability, Maintainability, Reusability, and portability.


Examples of Working with WebTable in QTP

HTML normally has many webtable and we can extract a lot of information using webtable methods in QTP. In this post we will discuss various methods by which we can used for webtable object.

Example 1: Validate if a webtable exist

boolExist = Browser(…).page(…).webtable(…).exist

Example 2 : To Find number of rows and columns in a web table

intRowCnt=Browser("Google").Page("title:=.*").WebTable(“name:= TTable").RowCount
For r=1 to intRowCnt
‘’ This will loop through each row and tell count of column in each row.
intColCnt=Browser("Google").Page("title:=.*").WebTable(“name:=TTable").ColumnCount(r) 
MsgBox intColCnt
Next

Example 3: How to get data in a particular cell in the data table

strData= Browser("Google").Page("title:=.*").WebTable(“name:=TTable").GetCellData(r,c)
Where r = row number and c = column number

Example 4: Using childObject method to find objects of a particular type within a webtable

Public Function func_findObjectinaWebTable(strObjType)
Set objDesc=Description.Create
objDesc("micclass").value=strobjType
set objChild=Browser("Google").Page("title:=.*").WebTable(“name:=TTa").ChildObjects(objDesc)
func_findObjectinaWebTable = objChild.count
End Function

Example 5: Using HTML DOM to get count of objects in a webtable

Public Function func_findObjectinaWebTable(strTagName)
set objChild= Browser("Google").Page("title:=.*").WebTable(“name:=TestTable").object.getElementsbyTagName(strTagName)
func_findObjectinaWebTable = objChild.length
End Function

Example 6: Using ChildItemCount and childItem in webtable to extract information

Public Function func_findObjectinaWebTable(strObjType,introw,intCol)
ob0jChildCnt=Browser("Google").Page("title:=.*").WebTable(“name:=TestTable,"index:=0").ChildItemCount(introw,intcol,strobjType)
If objChildCnt >0
Childitem will return object oftype defined in arguments for childitem
Set ChldItm = Browser("Google").Page("title:=.*").WebTable(“name:=TestTable,"index:=0").ChildItem(introw,intcol,strobjType,0)
If (strobjType = "Link" or strobjType ="WebEdit") Then
ChldItm.Click
ElseIf(stobjType = "WebCheckBox") Then
ChldItm.Set "ON"
End If
End Function

Understanding QTP Testing process


Quick Test Professional  testing process consists of following phases:


Pre-conditions before testing:


Before recording in QTP ,Please ensure following :

1. Application on which to record is open after qtp is launched.

2. Add-ins based on application are loaded.

3. Unnecessary instances of Internet Explorer and other applications are closed.

4. Ensure record and run settings are as expected and will record on the AUT.



Recording a session on your application


Click on record button in QTP and perform actions on AUT. QTP records every action performed and each element on which action is performed is stored as object in object repository. QTP displays each step in keyword view as tree and in expert view as vbscript.
For Recording, press F5 OR Click on record button.



Enhancing your test

1. Add Checkpoint to define pass/fail condition in the test.

2. Break lines of Codes into functions and increase reusability of test code.

3. Use data table to parametrize data used in the test.

4. Add regular expressions, output value in the test.

5. Add logic and conditional or loop statements that enables to add checks in the test.



Debugging your test

Debug a test to ensure that it operates smoothly and without interruption.To use debugging features , please install Microsoft script debugger. Use breakpoints to pause a test at breakpoints.


Running your test

On running a test using QTP, We know whether the expected behaviour of application matches the current behavior. A test will show pass/fail based on checkpoint on error handling defined through Code.


Analyzing the test results

Once a test is run, we have to analyse results to understand the behavior of AUT. We can analyse whether checkpoint pass or user defined error handling is passed or not.


Reporting defects

Once defects are found in application , they should be reported to concerned team and the tests should pass in case error/defects are resolved