23
Eclipse UI Automation Srinivas Kantipudi 18 / 07 / 09

Eclipse UI automation

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Eclipse UI automation

Eclipse UI Automation

Srinivas Kantipudi18 / 07 / 09

Page 2: Eclipse UI automation

Workshop Overview

In this workshop, you will learn:• Ways to automate Eclipse based applications using UI Automation tools• Challenges in UI automation of Eclipse based applications• Different UI Automation tools• Different types of automation that can be performed with UI Automation tools

Page 3: Eclipse UI automation

Workshop Overview, continued…

When you complete this workshop, you should be able to:• Understand basics of UI Automation tools• Ways to automate the functionality of Eclipse based applications• Ways to use UI Automation tools for Functional, Performance and Load testing• Tips and Tricks while doing UI Automation

Page 4: Eclipse UI automation

Eclipse IDE

• Open, standards based environment• An IDE and more…

• Java development environment (JDT)• General tools and integration platform• General application platform (RCP)

• More than 1200 plug-ins just in Eclipse plugin central site•The real challenge of UI Automation starts here

Page 5: Eclipse UI automation

OpenEdge Architect IDE

.NET Window Infragistics controls

Eclipse IDE

Page 6: Eclipse UI automation

Apama Studio IDE

Page 7: Eclipse UI automation

IDEs that use Graphical Framework

Page 8: Eclipse UI automation

UI Automation Tools

Eclipse plug-ins• Squish – Supports Eclipse RCP/SWT/Swing• TPTP• WindowTester – Java UI, Swing and SWT

Other popular UI Automation tools• QuickTest Professional (QTP)• Rational Robot

Page 9: Eclipse UI automation

QuickTest Professional

• Previously Mercury Interactive product, now taken over by HP• Supports only Windows OS• Scripting language based on VB Script• Supports .NET, Java, Web, XML, Main Frame, SAP, Siebel, PeopleSoft• Robust support for scripting• Stable

Page 10: Eclipse UI automation

QuickTest Professional demo

• Creating Tests• Scripting• Debugging• Object repository• Running the application• Preparing Suites

Page 11: Eclipse UI automation

Challenges with UI Automation of Eclipse

Challenge 1:Identification of every UI

object Uniquely

Page 12: Eclipse UI automation

Lab 1 – 20 minutes

OverviewThe goal of this lab is to create a QTP script to create a Project,create a Java file in the project, select Link with Editor option fromPackage Explorer toolbar and verify that the project is created.

PrerequisitesQTP and Eclipse should be open.

Steps1. From Eclipse SDK, create a new Java Project.2. Create a new Java Class with the main method inside this project.3. Add a verification point to make sure file is created under the

project.4. Select “Link with Editor” option from Package explorer view

toolbar.

Page 13: Eclipse UI automation

Discussion on Lab 1

• How did QTP recognize the Resources view?• What happens if the order of Views change?• How did QTP recognize the Toolbars?• Did we script to make sure the script passes in all conditions?• Did the Window title change in the course of Automation?• How are Toolbars recognized?

Page 14: Eclipse UI automation

Challenges with UI Automation of Eclipse

Challenge 1:Identification of every UI

object Uniquely

Page 15: Eclipse UI automation

Lab 1 – 20 minutes

Overview:The goal of this lab is to create a QTP script to create a Project,create a Java file in the project, select Link with Editor option fromPackage Explorer toolbar and verify that the project is created.

Prerequisites:QTP and Eclipse should be open.

Steps:1. From Eclipse SDK, create a new Java Project.2. Create a new Java Class with the main method inside this project.3. Add a verification point to make sure file is created under the

project.4. Select “Link with Editor” option from Package explorer view

toolbar.

Page 16: Eclipse UI automation

Discussion on Lab 1

• How did QTP recognize the Resources view?• What happens if the order of Views change?• How did QTP recognize the Toolbars?• Did we script to make sure the script passes in all conditions?• Did the Window title change in the course of Automation?• How are Toolbars recognized?

Page 17: Eclipse UI automation

Lab 1 - AnswerOption ExplicitDim PrjName, ClassFile, ClsName

PrjName = "Proj1"ClsName = "FirstClass"

'JavaTree description object --------------------------------------------------Dim gobjResourcesTViewSet gobjResourcesTView = Description.Create()gobjResourcesTView("developer name").Value = "Java(.*\n?)*"

JavaWindow("Java - Eclipse SDK").JavaMenu("File").JavaMenu("New").JavaMenu("Java Project").SelectJavaWindow("Java - Eclipse SDK").JavaWindow("New Java Project").JavaEdit("Project name:").Set PrjNameJavaWindow("Java - Eclipse SDK").JavaWindow("New Java Project").JavaButton("Finish").Click

wait(2)JavaWindow("Java - Eclipse SDK").JavaTree(gobjResourcesTView).OpenContextMenu PrjNameJavaWindow("Java - Eclipse SDK").WinMenu("ContextMenu").Select "New;Class"wait(1)

JavaWindow("Java - Eclipse SDK").JavaWindow("New Java Class").JavaEdit("Name:").Set ClsNameJavaWindow("Java - Eclipse SDK").JavaWindow("New Java Class").JavaButton("Finish").Click

wait(1)JavaWindow("Java - Eclipse SDK").JavaTree(gobjResourcesTView).Expand PrjName

'Checkpoint for verification of ABL Class file existing in resource tabClassFile = JavaWindow("Java - Eclipse SDK").JavaTree(gobjResourcesTView).GetROProperty("value")If InStr(ClassFile, ClsName) >= 1 Then

Reporter.ReportEvent micPass, "JavaTree - Resource","Class was created"else

Reporter.ReportEvent micFail,"JavaTree - Resource" , "Class was NOT created "End If

fnSetToolBarOptn ("Link with Editor")

Public Function fnSetToolBarOptn (pstrTBOptn)

Dim objDesc Dim objLists 'List of Toolbar items Dim i,j,strContent,strCheckIfExist

Set objDesc = Description.Create() objDesc("to_class").Value = "JavaToolbar"

Set objLists = JavaWindow("Java - Eclipse SDK").ChildObjects(objDesc)

j=objLists.count() i=0 For i=0 To j-1If objLists(i).GetItemscount()<>0 Then strContent =objLists(i).GetContent() strCheckIfExist =InStr(strContent,pstrTBOptn) If (strCheckIfExist) Then objLists(i).Press(pstrTBOptn) Exit For End IfEND IfNext

End Function 'fnSetToolBarOptn

Page 18: Eclipse UI automation

Challenges with UI Automation of Eclipse

Challenge 2: Constant UI changes

Page 19: Eclipse UI automation

Lab 2 – 10 minutes

Overview:The goal of this lab is to create a script to open Java Browsing

perspective or any other perspective.

Prerequisites:QTP and Eclipse should be open.

Steps:1. From Eclipse SDK, open Java Browsing perspective by

selecting Window -> Open Perspective -> Java Browsing.2. Add a verification point to check that Java Browsing

perspective is opened.

Page 20: Eclipse UI automation

Discussion on Lab 1

• How did QTP recognize the Resources view?• What happens if the order of Views change?• How did QTP recognize the Toolbars?• Did we script to make sure the script passes in all conditions?• Did the Window title change in the course of Automation?• How are Toolbars recognized?

Page 21: Eclipse UI automation

Eclipse IDE

• Open, standards based environment• An IDE and more…

• Java development environment (JDT)• General tools and integration platform• General application platform (RCP)

• More than 1200 plug-ins just in Eclipse plugin central site•The real challenge of UI Automation starts here

Page 22: Eclipse UI automation

Eclipse IDE

• Open, standards based environment• An IDE and more…

• Java development environment (JDT)• General tools and integration platform• General application platform (RCP)

• More than 1200 plug-ins just in Eclipse plugin central site•The real challenge of UI Automation starts here

Page 23: Eclipse UI automation

Eclipse IDE

• Open, standards based environment• An IDE and more…

• Java development environment (JDT)• General tools and integration platform• General application platform (RCP)

• More than 1200 plug-ins just in Eclipse plugin central site•The real challenge of UI Automation starts here