with selenium - accueil - 11es rmll du 6 au 11 juillet 20102010.rmll.info/img/pdf/selenium.pdf-java...

25
Web Applications Testing with Selenium Jérémy Hérault Kévin Pollet

Upload: buibao

Post on 12-Jun-2018

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: with Selenium - Accueil - 11es RMLL du 6 au 11 juillet 20102010.rmll.info/IMG/pdf/Selenium.pdf-Java / Java EE Technologies-Helium :) Jérémy HERAULT • Java Engineer • In charge

Web Applications Testingwith Selenium

Jérémy HéraultKévin Pollet

Page 2: with Selenium - Accueil - 11es RMLL du 6 au 11 juillet 20102010.rmll.info/IMG/pdf/Selenium.pdf-Java / Java EE Technologies-Helium :) Jérémy HERAULT • Java Engineer • In charge

Agenda

• The speakers

• Web applications functional testing

• The software suite

• Selenium in practice

• Selenium 2

• Q&A

Page 3: with Selenium - Accueil - 11es RMLL du 6 au 11 juillet 20102010.rmll.info/IMG/pdf/Selenium.pdf-Java / Java EE Technologies-Helium :) Jérémy HERAULT • Java Engineer • In charge

Agenda

• The speakers

•• Web applications functional testing

• The software suite

• Selenium in practice

• Selenium 2

• Q&A

Page 4: with Selenium - Accueil - 11es RMLL du 6 au 11 juillet 20102010.rmll.info/IMG/pdf/Selenium.pdf-Java / Java EE Technologies-Helium :) Jérémy HERAULT • Java Engineer • In charge

Kévin POLLET

• Java Engineer

• Open Source activity

- Selenium commiter

- Member of the Selenium IDE Lead

- Co-Leader and Lead developer of the Helium project

• Hobbies

- Java / Java EE Technologies

- Helium :)

Page 5: with Selenium - Accueil - 11es RMLL du 6 au 11 juillet 20102010.rmll.info/IMG/pdf/Selenium.pdf-Java / Java EE Technologies-Helium :) Jérémy HERAULT • Java Engineer • In charge

Jérémy HERAULT

• Java Engineer

• In charge of functional test process automation for a business application as part of a System Information overhaul

• Open Source activity

- Selenium IDE commiter

- Member of the Selenium IDE Lead

- Lead-Mentor and Co-Mentor on the GSoC 2010

• Hobbies

- Java / Java EE Technologies

- Selenium :)

Page 6: with Selenium - Accueil - 11es RMLL du 6 au 11 juillet 20102010.rmll.info/IMG/pdf/Selenium.pdf-Java / Java EE Technologies-Helium :) Jérémy HERAULT • Java Engineer • In charge

Agenda

• The speakers

• The software suite

• Selenium in practice

• Selenium 2

• Q&A

• Web applications functional testing

Page 7: with Selenium - Accueil - 11es RMLL du 6 au 11 juillet 20102010.rmll.info/IMG/pdf/Selenium.pdf-Java / Java EE Technologies-Helium :) Jérémy HERAULT • Java Engineer • In charge

• Functional Test allow to

- Verify that functionalities of an application are present as needed

- Verify the non-regression of application during evolutions and fixes

• Functional Tests are long and fastidious

- Need to automate it

➥ A possible answer: Selenium

The Functional Test

Page 8: with Selenium - Accueil - 11es RMLL du 6 au 11 juillet 20102010.rmll.info/IMG/pdf/Selenium.pdf-Java / Java EE Technologies-Helium :) Jérémy HERAULT • Java Engineer • In charge

Agenda

• The speakers

• Web applications functional testing

• Selenium in practice

• Selenium 2

• Q&A

• The software suite

Page 9: with Selenium - Accueil - 11es RMLL du 6 au 11 juillet 20102010.rmll.info/IMG/pdf/Selenium.pdf-Java / Java EE Technologies-Helium :) Jérémy HERAULT • Java Engineer • In charge

• Open Source project

- Currently hosted on Google Code

- Created in 2005 by Jason Huggins

• Functional Test automation of web applications

- Framework used by Google (+51 000 tests/day)

- Record / Replay of test cases

Selenium ?

Page 10: with Selenium - Accueil - 11es RMLL du 6 au 11 juillet 20102010.rmll.info/IMG/pdf/Selenium.pdf-Java / Java EE Technologies-Helium :) Jérémy HERAULT • Java Engineer • In charge

• It’s the core of Selenium :)

- Cross browsers: 100% JavaScript

• Allow to manipulate the DOM of the web page

- Do verifications

- Replay user actions: send DOM events

• Used by Selenium IDE and RC

Selenium Core

Page 11: with Selenium - Accueil - 11es RMLL du 6 au 11 juillet 20102010.rmll.info/IMG/pdf/Selenium.pdf-Java / Java EE Technologies-Helium :) Jérémy HERAULT • Java Engineer • In charge

• Firefox extension

- Help in the text writing

- Spy the DOM events

- Replay saved test cases: use of Selenium Core

• Allow to export test cases to different formats

- Java, Groovy, Python, C#, PHP, Perl

- Exported test cases: Selenium RC Client

• Extensible

- Open a lost of possibilities !!

Selenium IDE

Page 12: with Selenium - Accueil - 11es RMLL du 6 au 11 juillet 20102010.rmll.info/IMG/pdf/Selenium.pdf-Java / Java EE Technologies-Helium :) Jérémy HERAULT • Java Engineer • In charge

• « User Extensions »

- locators, actions, ...

• Plugin: Enriches Selenium IDE with Firefox extension

- Use the XUL extension mechanism

- Plugins already exist or in progres:

‣ Helium

‣ FlexMonkium, SilverLight

‣ Save test cases on remote storage (SVN, WebDav, ...)

- “ Pluginification ” work: Adam Goucher

‣ Create an API

‣ Available since the version 1.0.4

Selenium IDE Extensible

Page 13: with Selenium - Accueil - 11es RMLL du 6 au 11 juillet 20102010.rmll.info/IMG/pdf/Selenium.pdf-Java / Java EE Technologies-Helium :) Jérémy HERAULT • Java Engineer • In charge

• Replay server written in Java

- Driven by a client written in Java, PHP, Groovy, ...

➡ Exported from Selenium IDE for example :)

- Runs remote test cases

• Use Selenium Core + specific config. for each browser

- Example: Chrome extension for Firefox

Selenium RC (Remote Control)

Page 14: with Selenium - Accueil - 11es RMLL du 6 au 11 juillet 20102010.rmll.info/IMG/pdf/Selenium.pdf-Java / Java EE Technologies-Helium :) Jérémy HERAULT • Java Engineer • In charge

Selenium RC (Remote Control)

Page 15: with Selenium - Accueil - 11es RMLL du 6 au 11 juillet 20102010.rmll.info/IMG/pdf/Selenium.pdf-Java / Java EE Technologies-Helium :) Jérémy HERAULT • Java Engineer • In charge

• Allow to run test cases in parallel

- Software hub

- Manage multiple instances of Selenium RC

• Routing of the test case according to the desired platform

- Linux + Firefox

- MacOs + Safari

- ...

• Cross Platforms: Java

Selenium Grid

Page 16: with Selenium - Accueil - 11es RMLL du 6 au 11 juillet 20102010.rmll.info/IMG/pdf/Selenium.pdf-Java / Java EE Technologies-Helium :) Jérémy HERAULT • Java Engineer • In charge

Selenium Grid

Page 17: with Selenium - Accueil - 11es RMLL du 6 au 11 juillet 20102010.rmll.info/IMG/pdf/Selenium.pdf-Java / Java EE Technologies-Helium :) Jérémy HERAULT • Java Engineer • In charge

Agenda

• The speakers

• Web applications functional testing

• The software suite

• Selenium 2

• Q&A

• Selenium in practice

Page 18: with Selenium - Accueil - 11es RMLL du 6 au 11 juillet 20102010.rmll.info/IMG/pdf/Selenium.pdf-Java / Java EE Technologies-Helium :) Jérémy HERAULT • Java Engineer • In charge

• Development side

- Need to use unique IDs for web components

- Preferred binding for Selenium RC

- Facilitates replay

• Project Owner MOA / Unit testing side

- Record test cases with Selenium IDE

- Run test cases with management tools

‣ TestLink, Selenium Bromine

Selenium in practiceSeizure of test cases

Page 19: with Selenium - Accueil - 11es RMLL du 6 au 11 juillet 20102010.rmll.info/IMG/pdf/Selenium.pdf-Java / Java EE Technologies-Helium :) Jérémy HERAULT • Java Engineer • In charge

• Java EE 6 application (JSF 2.0, EJB 3.1, JPA 2.0)

• Application server: GlassFish 3.0

- Embedded server: « maven-embedded-glassfish-plugin »

- Standalone server

• Selenium RC for functional tests replay

- Use of Maven plugin: “ selenium-maven-plugin ”

- Standalone instance of Selenium RC

• Hudson for continuous integration

- Nighty build for example

Selenium in practiceEx: Continuous integration chain with Maven

Page 20: with Selenium - Accueil - 11es RMLL du 6 au 11 juillet 20102010.rmll.info/IMG/pdf/Selenium.pdf-Java / Java EE Technologies-Helium :) Jérémy HERAULT • Java Engineer • In charge

• Integration of the Selenium tests in the Maven LifeCycle

Selenium in practice

package

pre-integration-test

integration-test

post-integration-test

validate

deploy

Deploy the application

Run tests with Selenium RC

Delete the application

Ex: Continuous integration chain with Maven

Page 21: with Selenium - Accueil - 11es RMLL du 6 au 11 juillet 20102010.rmll.info/IMG/pdf/Selenium.pdf-Java / Java EE Technologies-Helium :) Jérémy HERAULT • Java Engineer • In charge

Agenda

• The speakers

• Web applications functional testing

• The software suite

• Selenium in practice

• Selenium 2

• Q&A

• Selenium 2

- WebDriver

- Integration with Selenium

Page 22: with Selenium - Accueil - 11es RMLL du 6 au 11 juillet 20102010.rmll.info/IMG/pdf/Selenium.pdf-Java / Java EE Technologies-Helium :) Jérémy HERAULT • Java Engineer • In charge

• Allow functional testing of web applications

- Created by Simon Stewart at ThoughtWorks and now at Google

• Object view of the application « myObjet.click() »

• Light and powerful API

• Send native events

• One browser = One driver

- Closer to browser / One development per browser

Selenium 2WebDriver

Page 23: with Selenium - Accueil - 11es RMLL du 6 au 11 juillet 20102010.rmll.info/IMG/pdf/Selenium.pdf-Java / Java EE Technologies-Helium :) Jérémy HERAULT • Java Engineer • In charge

• Integration of WebDriver in Selenium

- More powerful

- More faster

• Improved API (use of the WebDriver API)

- before: selenium.type != selenium.typeKeys

- now: selenium.type == selenium.typeKeys

• More native integration with the OS

• Better integration/simulation with the webapp

Selenium 2Integration with Selenium

Page 24: with Selenium - Accueil - 11es RMLL du 6 au 11 juillet 20102010.rmll.info/IMG/pdf/Selenium.pdf-Java / Java EE Technologies-Helium :) Jérémy HERAULT • Java Engineer • In charge

• Curently in the 2a4 version

- even more stable

• Advanced features available soon for the mouse

• And the other projects ?

- Selenium Grid soon

- Integration in progress for Selenium IDE

Selenium 2RoadMap