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.

No comments:

Post a Comment