Monday, 21 October 2013

Descriptive Programming ( without OR)




Desciptive Programming nothing but without using the Object repository we can identify the object and do some operation in object on the applications.


Keywords ->

Acttions are Methods or Attributes or Actions or Activity

Keywords are nothing but whatever Actions are made in that application.

We can change the test case but we should not changes the test script. for

like that we can create a test script.our test script should be

-> Generic
-> reusable
-> performance
-> executable for all scenario


for identify object with out OR, we should have below information

micClass  ( Class name which is identify by object Spy )
Type   (which is identify by object Spy )
html tag  (which is identify by object Spy )
Name  ( which is identify by object Spy )


Web Edit from Google Searach Edit Box ( we can use below code for identify

the Object with out help of OR using descriptive Programmin)


Set obj1= Description.Create()
obj1("micClass").Value="WebEdit"
obj1("Type").Value = "text"


For Web Button

Set obutton = Description.Create()
obutton("micClass").value="WinButton"
obutton("html tag").value="Input"


For Link


Set olink = Description.Create()
olink("micClass").value="Link"
olink("html tag").value="A"


For Image

Set oimage = Description.Create()
oimage("micClass").value="image"
oimage("html tag").value="IMG"


The Test Script for Descriptive Programming, we can use below code for our any relative objects


Applicationmap  "WebEdit","Email","Set","arun"
Applicationmap  "WebEdit","Passwd","Set","arun"
Applicationmap  "WebButton","Sign in","click", " "

Function Applicationmap( ObjectType,ObjectName,Activity,TestValue)
    Set  oBrowser= Browser("name:=.*")
   Set  oPage= Browser("name:=.*").Page("title:=.*")

     Select Case ObjectType

        Case "WebEdit"
           Set oWebEdit = Description.Create()
           oWebEdit("micClass").value="WebEdit"
           oWebEdit("Type").value="text"
           oWebEdit("name").value = testData
           call fnWebEdit(oWebEdit,Activity,TestValue)

       Case "WebButton"

           Set oWebButton = Description.Create()
           oWebButton("micClass").value="WebButton"
           oWebButton("Type").value="Submit"
          call fnWebButton(oWebButton,Activity,TestValue)
 
     End Select
End Function


Function fnWebEdit(oWebEdit,Activity,TestValue)
   Select Case Activity
     Case "Set"
        oBrowser.oPage.WebEdit(oWebEdit).set TestValue
     Case "SetSecure"
        oBrowser.oPage.WebEdit(oWebEdit).SetSecure TestValue
  End Select
End Function

Function fnWebButton(oWebButton,Activity,TestValue)
   Select Case Activity
      Case "click"
        oBrowser.oPage.WebButton(oWebButton).click
  End Select
End Function

Explain:

The above program we can call that for using any WebEdit and WebButton in web application. We can use the both the object with out changing original script.

Saturday, 19 October 2013

Working with Excel Sheet using QTP


Create a below Excel File and saved as name Book1







Use below code for working with Excel using QTP





o_fileName1="c:\Book1.xls"
o_fileName2="c:\Book2.xls"
Set xlObj = Creaeteobject("Excel.Application")   ' Create the object for Excel
Set xlWBObj = xlObj.workbooks.open(o_fileName1)  'Open the Excel
Set xlWSObj = xlObj.Worksheets(1)  'Sheet number in Excel

'Print value present in Excel cell

print xlWSObj.cells(1,1).value  'Print the value present in Cell (1,1) in Excel

'Insert value into the Excel Cell

xlWSObj.cells(3,1).value = "QTP"   ' Insert "QTP" into cell (3,1) in Excel

'Save the Excel File if we want to save in same file

xlWSObj.save   'save changes into same Excel Sheet  .

'Save the Excel in another file

xlWSObj. SaveAs c:\Book2.xls    ' save the changes into defferent Excel
xlWBObj.close
xlObj.application.close

Set xlWBObj = nothing
Set xlObj = nothing








o_fileName1="c:\Book1.xls"

Set xlObj = CreaeteObject("Excel.Application")   ' Create the object for Excel
Set xlWBObj = xlObj.workbooks.open(o_fileName1)  'Open the Excel

Set xlWSObj = xlObj.Worksheets(1)  'Sheet number in Excel

' Find the Perticular String in Excel Sheet

Set cell= xlWSObj.range("A,Z").find("Tamil")  'Find the string "Tamil"  from Col A to Col Z  in Excel Sheet
print cell.Address  ' Print the Address where Tamil Present in Excel   O/P  $A$1  ( i.e Cell (1,1) = "Tamil" )

' Add New Sheet  after find Last Sheet in Excel

Set xlCountWSSheet = xlWBObj.workSheets(xlWBObj.Sheets.Count)  ' Find the last Work Sheet
xlWBObj.worksheets.add(xlCountWSSheet).name="New Sheet"  '
                             ' Sheet number starts from 0. So xlCountWSSheet have the last number of  sheet.

' Add New Sheet  after Sheet  2 in Excel

Set xlCountSecondSheet = xlWBObj.workSheets(2)  ' Work Sheet 2
xlWBObj.worksheets.add(xlCountSecondSheet).name="New Sheet"  '

xlWSObj.save   'save changes into same Excel Sheet  .

xlWBObj.close
xlObj.application.close

Set xlWBObj = nothing
Set xlObj = nothing



Change the Font color,Font Name and interior color


xlWSObj.Cells(1,2).Font.Color=vbRed
xlWSObj.Cells(2,1).Font.Name = "Verdana"
xlWSObj.cells(2.2).interior.Color=vbBlue


Copy one value from cell and paste into another one cell

xlWSObj.range("A2").Select
xlObj.selection.copy
xlWSObj.range("C4").Select
xlWSObj.paste


Copy one or more value from cell and paste into another one or more cell

xlWSObj.range("A2,C2").Select
xlObj.selection.copy
xlWSObj.range("C4").Select
xlWSObj.paste


Insert image into Excel at pericular cell


xlWSObj.cells(6,"B").select
xlWSObj.pictures.insert("c.\image.PNG")



Keyword Driven Automation Framework

Here we are mainly focus on the keywords or function, but not in tets data.That means we create the function and mapped to the functionality of the application.


For example -

Suppose you have a Train reservation application which provides many features like

    * Login to the application
    * Search Train
    * Book Train tickets
    * Cancel Tickets
    * Fax Order
    * View Reports


To implement the keyword driven automation framework for this kind of application we will create functions in vbscript for each functionality mentioned above. We pass the test data and test object details to these functions.

What are the main components of keyword driven automation framework in QTP?

Each keyword driven automation framework has some common components as mentioned below.





As dispalyed in above image, We have 5 main components in keyword driven automation framework

    *
      Scripts Library (.vbs, .txt, .qfl)
    *
      OR - Object Repository
    *
      Test Data (generally in excel format)
    *
      QTP - Settings and Environment Variables
    *
      Reports - (Generally in HTML format)

We will see examples of each component in below section.



Library Scripts (Files) in keyword driven automation framework in QTP.


As I mentioned earlier, in keyword driven automation framework we develop the kewords(Function) that are mapped to the functionality of the application. In large automation projects  where there are many functionalities, We need to create lot of functions. Generally We create functions for each module in the application and store similar functions in seperate library files.

For example -

We can store login/logout related functions in authentication.vbs file.
All functions related to booking could be stored in booking.vbs

Please note that we can store library files with 3 extentions i.e. .vbs, .txt and .qfl.
QTP engineers prefer to store the library files in a file with extension .vbs as we can include vbs files using executefile statement and also find out the syntax errors by double clicking on the vbs file.
QFL file long form is Quick test function library.




Object Repository in keyword driven automation framework in QTP.

In QTP there are two types of Object Repository.

    * Local Object Repository (objectrepository.bdb for each action)
    * Shared Object Repository (.tsr extention)


We can store all the object property values and description saved in OR.

Out of these 2 object repositoryies, Shared object repository is very popular among QTP testers. Because we can have all test objects in single file. This helps us to maintain the object repository.

To add/ edit objects inside shared object repository, you must go to Object Repository Manager and open the .tsr file and then make the changes in the shared object repository.



Test Data (generally in excel format) in keyword driven automation framework in QTP.

All test cases data is stored in excel sheets. From QTP ,we read excel file and then row by row we execute the functions in a test case. Each test case is implemented as a set of keywords.
Common columns in Data sheet are mentioned below.

    *Test case ID - Stores the Test Case ID mapped to Manual Test Cases.
    *Test Case Name - Name of the Test cases/ Scenario.
    *Keyword - Mapped to function in library file.
    *ObjectInfo - Object types, Names and Values to be entered into those objects.
    *Misc Parameter - This is used to control the execution flow in the function.



QTP Test Settings and Environment Variables in keyword driven automation framework in QTP.

This is also one of the most important component of the keyword driven automation framework.
In Test settings We need to do some setting before we execute any test suite. This could be one time set up or per execution request set up.
List of Important Settings -

    *Object Synchronization timeout -
    *When Error Occurs during run session -
    *Resources - Associated library files
    *Environment - We need to set up some variables like folder path, User Id etc
    *Recovery - We must associate the recovery scenario file to the test. Recovery Scenario will handle unexpected events during execution. This will help for smooth execution using QTP.


Reports in keyword driven automation framework in QTP.


Reports are created in html formats using custom reporting function. We use filesystemobject to create html reports.
Reports will display the total number of test cases executed, Total Pass Test cases, Total Failed test cases and total time required to execute the test cases. This will give better picture of QTP Execution.

Thursday, 17 October 2013

Difference between Verification and Validation


1) Verification is Static while Validation is Dynamic.

2) This means in Verification the s/w is inspected by looking into the code going line by line or function by function. I

n Validation, code is executed and s/w is run to find defects. Since in verification code is reviewed, location of the defect can be found which is not possible in validation.


3) Verification - is to determine the right thing, which involves the testing the implementation of right process. Ex: Are we building the product right?

Validation - is to perform the things in right direction, like checking the developed software adheres the requirements of the client. Ex: right product was built


4) Verification: To check if we are doing the right thing.
Validation: To check whether we have developed the software as per the client’s requirements or not.

5) Verification ensures the product is designed to deliver all functionality to the customer; it typically involves reviews and meetings to evaluate documents, plans, code, requirements and specifications; this can be done with checklists, issues lists, and walkthroughs and inspection meetings.

Validation ensures that functionality, as defined in requirements, is the intended behavior of the product; validation typically involves actual testing and takes place after verifications are completed.

6) Verification is the checking of data that has been copied from one place to another to ensure that is replaces the original one. E.g. PASSWORD. When you sign up in a site, just like WIKIANSWERS, you have to enter your password twice, the second entry being compared with the first.
Example in an a paper if a teacher asks us to cross xheck thats validation and when the teacher checks it again orr a re-check thats verification

Validation is the checking of data before processing to ensure that it is acceptable for it or not. E.g. When entering a date, the validation for month is 1-12, you cannot enter 13, its out of range. Similarly a telephone number cannot contain letters.


Difference Between Load testing,Stress testing and Performance Testing


LOad Testing : We have to verify at what point system get crash or unusable.And have to check whether the system is capable of handling an anticipated load

Example: Consider an online shopping web application, with a maximum of 500 concurrent users at peak hours.increase number of users perform the transaction via ATM. And estimate when THe Atm get crash


Stress testing : we have to verify that how system reacts when maximum limit of the users use the system.Stress Testing is conducted to check the systems capability beyond the anticipated load.

Example: Considering the example above the stress testing will be conducted on the application by increasing the users beyond 500 in small steps (say 100) till the application starts to degrade or breaks dow


Performance Testing : How fast system reacts when perticular user transaction in website. and estimatee performance requirement specifications with acceptable response times and resource utilization (memory, processor, network).

Example

Bug Life Cycle

Picture




1. New
    When the bug is identified and logged in bug tracking tool for the first time, its state will be "NEW".

2. Open / Closed
    After a QA has posted a bug, the QA lead validates the bug. If bug is valid then he changes the state as "OPEN" and if the bug is invalid then the lead changes its state to "CLOSED".

3. Assign
    After QA lead changes the state as "OPEN", he assigns the bug to corresponding developer or developer team lead and the bug status is changed to "ASSIGN".

4. Rejected:
    If the developer feels that the bug is not valid or it has some technical limitations and cannot be fixed, he rejects the bug. He changes the state of bug to "REJECTED".

5. Duplicate:
    If the bug is logged is repeated twice or the two bugs reported has alike results and steps to reproduce, then one bug status is changed to "DUPLICATE".   

6. Deferred:
    If the development team lead decides to fix the bug in next release due to lack of time or the priority of the bug is low then he changes the state to "DEFERRED", which is later changes to "ASSIGN" when the bug is taken in consideration to be fixed.

7. InTest
    Once the developer fixes the bug, he assigns the bug to the testing team for next round of testing. Before that he changes the state of bug to "IN TEST". It specifies that the bug has been fixed and is released to testing team.

8. Verified
    Once the bug is fixed and the status is changed to "IN TEST", the tester tests the bug. If the bug is not reproducible in the software, he changes the status to "VERIFIED".

9. Reopened
    Once the bug is fixed and the status is changed to "IN TEST", the tester tests the bug. If the bug is reproducible in the software, he changes the status to "REOPENED".

10. Closed
    After the bug status is changes to "REJECTED" or "DUPLICATE" or "VERIFIED" the QA Lead verifies the comments added by the development or Testing team. When he is satisfied with the comments he changes the state to "CLOSED".

Note: There are different process and methodologies followed in various organizations. The above content is as per my experience in industry so far.

Sunday, 13 October 2013

Non Functional Testing


Non functional testing tests the characteristics of the software like how fast the response is, or what time does the software takes to perform any operation.


Following testing should consider in non functional testing types:

    * Availability Testing
    * Baseline testing
    * Compatibility testing
    * Compliance testing
    * Configuration Testing
    * Documentation testing
    * Endurance testing
    * Ergonomics Testing
    * Interoperability Testing
    * Installation Testing
    * Load testing
    * Localization testing and Internationalization testing
    * Maintainability Testing
    * Operational Readiness Testing
    * Performance testing
    * Recovery testing
    * Reliability Testing
    * Resilience testing
    * Security testing
    * Scalability testing
    * Stress testing
    * Usability testing
    * Volume testing


Security testing

The Security Testing , we test like:-


1. copy and paste link, it should not be open the respective page, it should allow to view first login page of the website.
2. max. allow of wrong password should be 3 times and many like that.......