SlideShare una empresa de Scribd logo
1 de 55
Descargar para leer sin conexión
Efficient Automated Test
Creation With Selenium IDE
           Plugins

  Selenium Conference 2011
        San Francisco
         4th April 2011
Samit Badle

           @samitbadle

http://blog.reallysimplethoughts.com
Goals

• Give you a taste of creating a Selenium
  IDE plugin
• Make you aware of the code in various
  files by completing the TODOs in the
  exercises
• Introduce you to ideas for efficiently
  creating tests or test data
Agenda

• Brief introduction
• Create a Selenium IDE plugin with
  – Menu and Toolbar buttons
  – Selenium IDE Plugin API
  – Preferences
  – Command Builder
• Ideas to efficiently create tests
Getting Ready

• Install the latest version of Firefox
  – Either Firefox 3.6.16 or Firefox 4.0
• Install 7-Zip or your favorite zip tool
• Download the WorkshopFiles.zip
  – http://links.reallysimplethoughts.com/files/Wor
    kshopFiles.zip
Using WorkshopFiles.zip

• Extract WorkshopFiles.zip
• Install the special version of Selenium IDE
  (selenium-ide-multi-workshop.xpi) included
  in it
• The HandsOn folder contains the
  exercises
• The Solutions folder contains the
  completed versions and pre-built plugins
What are Selenium IDE Plugins?




           Demos!
Where to find them?

• Selenium download page
  http://seleniumhq.org/download/


• Firefox add-ons page
  https://addons.mozilla.org/en-US/firefox/


• Other places on the Internet
  Google ☺
http://seleniumhq.org/download/
https://addons.mozilla.org/
Efficient Automated Test Creation?


         “Automated Tests are Cool!”

 “Automating Generation of Automated Tests is
                Even Cooler.”

                 “But How?”
“Be Efficient” Selenium IDE Plugin


                Here’s How!

• Add “Write My Test” to the context menu
• When I click on it, write my test for me
“Be Efficient” Selenium IDE Plugin


               The Benefits

• Capture test data or test commands
  directly
• Direct access to the web page
• Reuse code from Selenium IDE and
  Selenium
Demo!
Be Efficient In Action
•   Open Selenium IDE
•   In Firefox, open www.bing.com
•   Type selenium in search box
•   Hit the enter key
•   Right click on the results web page
•   Select Write My Test!
•   Check the generated test case
•   Execute the test case (maybe with
    highlight elements plugin)
Be Efficient In Action
Be Efficient In Action
Be Efficient In Action
Be Efficient In Action
Be Efficient In Action
Be Efficient Code

      Main code


      Installation / registration code



      User interface



      User interface styling


      Preferences defaults

      Files required for a Firefox add-on
Simple Firefox Add-on
Simple Firefox Add-on

• XPI (zippy)
• Install Manifest (install.rdf)
• Chrome Manifest (chrome.manifest)
• Overlay containing a menu and toolbar
  button
• Style-sheet for the toolbar button
• Icon for the toolbar button
Simple Firefox Addon
Your Turn

• Explore the files in the first exercise
  HandsOn/selenium-ide_be-efficient_ex1
• Complete the TODO in the following files
  – Install Manifest (install.rdf)
  – Chrome Manifest (chrome.manifest)
  – Overlay (ovIDE.xul)
  – Style sheet (beefficient.css)
Package and Install

•   Create a zip of all files in src folder
•   Change the file extension from .zip to .xpi
•   Open this xpi file in Firefox
•   Click on install button
•   Restart to complete
Result
Result

• New menu item in the Options menu in
  Selenium IDE
• A new toolbar button on the right side
• Clicking on the menu item or toolbar item
  results in a simple alert message
Selenium IDE Plugin API
Plugin API Functions

•   addPlugin
•   addPluginProvidedIdeExtension
•   addPluginProvidedFormatter
•   addPluginProvidedUserExtension
Using the Plugin API

• Code to register plugin with Selenium IDE
• Load the real plugin code as an IDE
  extension
• Lots of boilerplate code
Using My pluginframework.js

Lots of boilerplate code hidden away in
  pluginframework.js and reduces the
        required code to two lines.
Plugin API
Your Turn

• Explore the files in the second exercise
  HandsOn/selenium-ide_be-efficient_ex2
• Complete the TODO in the following files
  – Chrome Manifest (chrome.manifest)
  – Setup overlay (setup.xul)
  – Setup code (setup.js)
  – Overlay (ovIDE.xul)
  – Real plugin code (BeEfficient.js)
Result

• Be Efficient Plugin now shows up in
  Plugins tab of the Selenium IDE options
  dialog
• The plugin code in BeEfficient and
  ovIDE.xul can now change the enabled
  state from the UI
Result
Preferences
Preferences

• Lot of support is built into Firefox
• Involves mostly boilerplate code
Preferences
• Create defaults for the preferences
• Create dialog to allow user to change preference
• Create an observer to receive notification of
  changes

• And one of the following (or both):
  – Define options in Install manifest
  – Create UI (usually menu) to show Options dialog
Preferences
Your Turn

• Explore the files in the third exercise
  HandsOn/selenium-ide_be-efficient_ex3
• Complete the TODO in the following files
  – Preference defaults (defaults.js)
  – Options dialog (options.xul)
  – Plugin code (BeEfficient.js)
  – Install Manifest (install.rdf)
Result

• Be Efficient Plugin options dialog is
  available
• The options dialog can now be opened
  from the menu item
• The preference can be seen in
  about:config
• The preference and the UI elements are
  now in sync
Result
Result
Creating a Command Builder
Command Builder

• Puts a menu item in the context menu on
  the web page when Selenium IDE is open
• Three types: Action, Accessor, Util
• Util type will be available with Selenium
  IDE v1.0.11
Util Command Builder
• Register the Util command builder
  functions

• Prepare (builder) function
  – Returns the menu item to show
• Execute function
  – Called when the menu item is clicked
  – Can return zero or more commands to add to
    the test case
Be Efficient Command Builder

• When the Write My Test! context menu
  item is pressed, create commands for the
  following
• Verify page title
• Wait for all results
• Verify each result
Your Turn

• Explore the files in the third exercise
  HandsOn/selenium-ide_be-efficient_ex4
• Complete the TODO in the following file
  – Plugin code (BeEfficient.js)
Result

• Write My Test! context menu is available
  on the web page when Selenium IDE is
  open
• Clicking on the write my test on bing.com
  search results page will generate your test
Be Efficient In Action
•   Open Selenium IDE
•   In Firefox, open www.bing.com
•   Type selenium in search box
•   Hit the enter key
•   Right click on the results web page
•   Select Write My Test!
•   Check the generated test case
•   Execute the test case (maybe with
    highlight elements plugin)
Resources for Selenium IDE Plugins

• Selenium IDE Plugin Documentation
  http://seleniumhq.org/projects/ide/plugins.html


• My Blog
  http://blog.reallysimplethoughts.com/
Resources for Firefox Add-ons
https://developer.mozilla.org/en/XUL_School

https://developer.mozilla.org/en/Building_an_Extension

https://developer.mozilla.org/En/Firefox_addons_developer_guide

http://robertnyman.com/2009/01/24/how-to-develop-a-firefox-extension/

http://books.mozdev.org/chapters/index.html

https://developer.mozilla.org/en/Creating_XPCOM_Components

http://blog.mozilla.com/addons/2009/01/28/how-to-develop-a-firefox-extension/

http://roachfiend.com/archives/2004/12/08/how-to-create-firefox-extensions/
Time to Celebrate!

 Thanks for Joining!
Questions?

Feel free to chat with me anytime

Más contenido relacionado

La actualidad más candente

Selenium test automation
Selenium test automationSelenium test automation
Selenium test automationSrikanth Vuriti
 
Web application testing with Selenium
Web application testing with SeleniumWeb application testing with Selenium
Web application testing with SeleniumKerry Buckley
 
Automation Testing using Selenium
Automation Testing using SeleniumAutomation Testing using Selenium
Automation Testing using SeleniumNaresh Chintalcheru
 
Selenium IDE Tutorial For Beginners | Selenium IDE Tutorial | What Is Seleniu...
Selenium IDE Tutorial For Beginners | Selenium IDE Tutorial | What Is Seleniu...Selenium IDE Tutorial For Beginners | Selenium IDE Tutorial | What Is Seleniu...
Selenium IDE Tutorial For Beginners | Selenium IDE Tutorial | What Is Seleniu...Simplilearn
 
Selenium- A Software Testing Tool
Selenium- A Software Testing ToolSelenium- A Software Testing Tool
Selenium- A Software Testing ToolZeba Tahseen
 
Automated Web Testing Using Selenium
Automated Web Testing Using SeleniumAutomated Web Testing Using Selenium
Automated Web Testing Using SeleniumWeifeng Zhang
 
Selenium WebDriver with C#
Selenium WebDriver with C#Selenium WebDriver with C#
Selenium WebDriver with C#srivinayak
 
Automation - web testing with selenium
Automation - web testing with seleniumAutomation - web testing with selenium
Automation - web testing with seleniumTzirla Rozental
 
Selenium IDE and Beyond
Selenium IDE and BeyondSelenium IDE and Beyond
Selenium IDE and BeyondSamit Badle
 
Selenium Ide Tutorial
Selenium Ide TutorialSelenium Ide Tutorial
Selenium Ide Tutorialmetapix
 

La actualidad más candente (20)

Selenium IDE
Selenium IDESelenium IDE
Selenium IDE
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
Selenium IDE features
Selenium IDE featuresSelenium IDE features
Selenium IDE features
 
Selenium Primer
Selenium PrimerSelenium Primer
Selenium Primer
 
Selenium Demo
Selenium DemoSelenium Demo
Selenium Demo
 
Selenium test automation
Selenium test automationSelenium test automation
Selenium test automation
 
Introduction to selenium
Introduction to seleniumIntroduction to selenium
Introduction to selenium
 
Web application testing with Selenium
Web application testing with SeleniumWeb application testing with Selenium
Web application testing with Selenium
 
Automation Testing using Selenium
Automation Testing using SeleniumAutomation Testing using Selenium
Automation Testing using Selenium
 
Selenium IDE Tutorial For Beginners | Selenium IDE Tutorial | What Is Seleniu...
Selenium IDE Tutorial For Beginners | Selenium IDE Tutorial | What Is Seleniu...Selenium IDE Tutorial For Beginners | Selenium IDE Tutorial | What Is Seleniu...
Selenium IDE Tutorial For Beginners | Selenium IDE Tutorial | What Is Seleniu...
 
Selenium- A Software Testing Tool
Selenium- A Software Testing ToolSelenium- A Software Testing Tool
Selenium- A Software Testing Tool
 
Automated Web Testing Using Selenium
Automated Web Testing Using SeleniumAutomated Web Testing Using Selenium
Automated Web Testing Using Selenium
 
Selenium WebDriver with C#
Selenium WebDriver with C#Selenium WebDriver with C#
Selenium WebDriver with C#
 
Selenium IDE
Selenium IDESelenium IDE
Selenium IDE
 
QSpiders - Automation using Selenium
QSpiders - Automation using SeleniumQSpiders - Automation using Selenium
QSpiders - Automation using Selenium
 
Automation - web testing with selenium
Automation - web testing with seleniumAutomation - web testing with selenium
Automation - web testing with selenium
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
Selenium IDE and Beyond
Selenium IDE and BeyondSelenium IDE and Beyond
Selenium IDE and Beyond
 
Selenium Ide Tutorial
Selenium Ide TutorialSelenium Ide Tutorial
Selenium Ide Tutorial
 
Selenium Automation
Selenium AutomationSelenium Automation
Selenium Automation
 

Destacado

Selenium Ide Tutorials
Selenium Ide TutorialsSelenium Ide Tutorials
Selenium Ide Tutorialsgueste1e4db
 
Steps to write Selenium
Steps to write Selenium  Steps to write Selenium
Steps to write Selenium Rohit Thakur
 
Automated User Tests with Apache Flex
Automated User Tests with Apache FlexAutomated User Tests with Apache Flex
Automated User Tests with Apache FlexGert Poppe
 
Selenium IDE and Extensions
Selenium IDE and ExtensionsSelenium IDE and Extensions
Selenium IDE and ExtensionsYana Altunyan
 
Sakai10 Selenium Workshop
Sakai10 Selenium WorkshopSakai10 Selenium Workshop
Sakai10 Selenium Workshopcoreyjack
 
Jmeter Performance Testing
Jmeter Performance TestingJmeter Performance Testing
Jmeter Performance TestingAtul Pant
 
Java Basics for selenium
Java Basics for seleniumJava Basics for selenium
Java Basics for seleniumapoorvams
 
Selenium ide
Selenium ide Selenium ide
Selenium ide Pé Vịt
 

Destacado (14)

Selenium Ide Tutorials
Selenium Ide TutorialsSelenium Ide Tutorials
Selenium Ide Tutorials
 
Selenium Training
Selenium TrainingSelenium Training
Selenium Training
 
Selenium
SeleniumSelenium
Selenium
 
Steps to write Selenium
Steps to write Selenium  Steps to write Selenium
Steps to write Selenium
 
Automated User Tests with Apache Flex
Automated User Tests with Apache FlexAutomated User Tests with Apache Flex
Automated User Tests with Apache Flex
 
Selenium IDE and Extensions
Selenium IDE and ExtensionsSelenium IDE and Extensions
Selenium IDE and Extensions
 
Sakai10 Selenium Workshop
Sakai10 Selenium WorkshopSakai10 Selenium Workshop
Sakai10 Selenium Workshop
 
Selenium IDE
Selenium IDESelenium IDE
Selenium IDE
 
Selenium
SeleniumSelenium
Selenium
 
Selenium WebDriver FAQ's
Selenium WebDriver FAQ'sSelenium WebDriver FAQ's
Selenium WebDriver FAQ's
 
Jmeter Performance Testing
Jmeter Performance TestingJmeter Performance Testing
Jmeter Performance Testing
 
Java Basics for selenium
Java Basics for seleniumJava Basics for selenium
Java Basics for selenium
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
Selenium ide
Selenium ide Selenium ide
Selenium ide
 

Similar a Efficient Automated Test Creation With The "Be Efficient

Selenium by using JAVA
Selenium by using JAVASelenium by using JAVA
Selenium by using JAVAmahirayavarapu
 
Selenium By Pravin Mishra
Selenium By Pravin MishraSelenium By Pravin Mishra
Selenium By Pravin MishraPravin Mishra
 
Selenium Tutorial
Selenium TutorialSelenium Tutorial
Selenium Tutorialprad_123
 
Selenium Installation
Selenium  InstallationSelenium  Installation
Selenium InstallationANKUR-BA
 
Selenium - Installation
Selenium - InstallationSelenium - Installation
Selenium - InstallationRajesh-QA
 
Selenium Installation
Selenium InstallationSelenium Installation
Selenium InstallationSachin-QA
 
Selenium with testng and eclipse ide
Selenium with testng and eclipse ideSelenium with testng and eclipse ide
Selenium with testng and eclipse ideTestertester Jaipur
 
Automated testing with Cypress
Automated testing with CypressAutomated testing with Cypress
Automated testing with CypressYong Shean Chong
 
Getting Started with Selenium
Getting Started with SeleniumGetting Started with Selenium
Getting Started with SeleniumDave Haeffner
 
Selenium training
Selenium trainingSelenium training
Selenium trainingRobin0590
 
Selenium web driver_2.0_presentation
Selenium web driver_2.0_presentationSelenium web driver_2.0_presentation
Selenium web driver_2.0_presentationsayhi2sudarshan
 

Similar a Efficient Automated Test Creation With The "Be Efficient (20)

Selenium Training in Chennai
Selenium Training in ChennaiSelenium Training in Chennai
Selenium Training in Chennai
 
Selenium training in chennai
Selenium training in chennaiSelenium training in chennai
Selenium training in chennai
 
Automated ui-testing
Automated ui-testingAutomated ui-testing
Automated ui-testing
 
Selenium by using JAVA
Selenium by using JAVASelenium by using JAVA
Selenium by using JAVA
 
Selenium By Pravin Mishra
Selenium By Pravin MishraSelenium By Pravin Mishra
Selenium By Pravin Mishra
 
Selenium Tutorial
Selenium TutorialSelenium Tutorial
Selenium Tutorial
 
Selenium Installation
Selenium  InstallationSelenium  Installation
Selenium Installation
 
Selenium - Installation
Selenium - InstallationSelenium - Installation
Selenium - Installation
 
Selenium ide made easy
Selenium ide made easySelenium ide made easy
Selenium ide made easy
 
Selenium Topic 2 IDE
Selenium Topic 2 IDESelenium Topic 2 IDE
Selenium Topic 2 IDE
 
Selenium Training in Chennai
Selenium Training in ChennaiSelenium Training in Chennai
Selenium Training in Chennai
 
Selenium Installation
Selenium InstallationSelenium Installation
Selenium Installation
 
Selenium with testng and eclipse ide
Selenium with testng and eclipse ideSelenium with testng and eclipse ide
Selenium with testng and eclipse ide
 
Automated testing with Cypress
Automated testing with CypressAutomated testing with Cypress
Automated testing with Cypress
 
Web works hol
Web works holWeb works hol
Web works hol
 
Getting Started with Selenium
Getting Started with SeleniumGetting Started with Selenium
Getting Started with Selenium
 
Selenium training
Selenium trainingSelenium training
Selenium training
 
Extending NetBeans IDE
Extending NetBeans IDEExtending NetBeans IDE
Extending NetBeans IDE
 
Selenium Testing
Selenium Testing Selenium Testing
Selenium Testing
 
Selenium web driver_2.0_presentation
Selenium web driver_2.0_presentationSelenium web driver_2.0_presentation
Selenium web driver_2.0_presentation
 

Último

Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 

Último (20)

Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 

Efficient Automated Test Creation With The "Be Efficient

  • 1. Efficient Automated Test Creation With Selenium IDE Plugins Selenium Conference 2011 San Francisco 4th April 2011
  • 2. Samit Badle @samitbadle http://blog.reallysimplethoughts.com
  • 3. Goals • Give you a taste of creating a Selenium IDE plugin • Make you aware of the code in various files by completing the TODOs in the exercises • Introduce you to ideas for efficiently creating tests or test data
  • 4. Agenda • Brief introduction • Create a Selenium IDE plugin with – Menu and Toolbar buttons – Selenium IDE Plugin API – Preferences – Command Builder • Ideas to efficiently create tests
  • 5. Getting Ready • Install the latest version of Firefox – Either Firefox 3.6.16 or Firefox 4.0 • Install 7-Zip or your favorite zip tool • Download the WorkshopFiles.zip – http://links.reallysimplethoughts.com/files/Wor kshopFiles.zip
  • 6. Using WorkshopFiles.zip • Extract WorkshopFiles.zip • Install the special version of Selenium IDE (selenium-ide-multi-workshop.xpi) included in it • The HandsOn folder contains the exercises • The Solutions folder contains the completed versions and pre-built plugins
  • 7. What are Selenium IDE Plugins? Demos!
  • 8. Where to find them? • Selenium download page http://seleniumhq.org/download/ • Firefox add-ons page https://addons.mozilla.org/en-US/firefox/ • Other places on the Internet Google ☺
  • 11. Efficient Automated Test Creation? “Automated Tests are Cool!” “Automating Generation of Automated Tests is Even Cooler.” “But How?”
  • 12. “Be Efficient” Selenium IDE Plugin Here’s How! • Add “Write My Test” to the context menu • When I click on it, write my test for me
  • 13. “Be Efficient” Selenium IDE Plugin The Benefits • Capture test data or test commands directly • Direct access to the web page • Reuse code from Selenium IDE and Selenium
  • 14. Demo!
  • 15. Be Efficient In Action • Open Selenium IDE • In Firefox, open www.bing.com • Type selenium in search box • Hit the enter key • Right click on the results web page • Select Write My Test! • Check the generated test case • Execute the test case (maybe with highlight elements plugin)
  • 16. Be Efficient In Action
  • 17. Be Efficient In Action
  • 18. Be Efficient In Action
  • 19. Be Efficient In Action
  • 20. Be Efficient In Action
  • 21. Be Efficient Code Main code Installation / registration code User interface User interface styling Preferences defaults Files required for a Firefox add-on
  • 23. Simple Firefox Add-on • XPI (zippy) • Install Manifest (install.rdf) • Chrome Manifest (chrome.manifest) • Overlay containing a menu and toolbar button • Style-sheet for the toolbar button • Icon for the toolbar button
  • 25. Your Turn • Explore the files in the first exercise HandsOn/selenium-ide_be-efficient_ex1 • Complete the TODO in the following files – Install Manifest (install.rdf) – Chrome Manifest (chrome.manifest) – Overlay (ovIDE.xul) – Style sheet (beefficient.css)
  • 26. Package and Install • Create a zip of all files in src folder • Change the file extension from .zip to .xpi • Open this xpi file in Firefox • Click on install button • Restart to complete
  • 28. Result • New menu item in the Options menu in Selenium IDE • A new toolbar button on the right side • Clicking on the menu item or toolbar item results in a simple alert message
  • 30. Plugin API Functions • addPlugin • addPluginProvidedIdeExtension • addPluginProvidedFormatter • addPluginProvidedUserExtension
  • 31. Using the Plugin API • Code to register plugin with Selenium IDE • Load the real plugin code as an IDE extension • Lots of boilerplate code
  • 32. Using My pluginframework.js Lots of boilerplate code hidden away in pluginframework.js and reduces the required code to two lines.
  • 34. Your Turn • Explore the files in the second exercise HandsOn/selenium-ide_be-efficient_ex2 • Complete the TODO in the following files – Chrome Manifest (chrome.manifest) – Setup overlay (setup.xul) – Setup code (setup.js) – Overlay (ovIDE.xul) – Real plugin code (BeEfficient.js)
  • 35. Result • Be Efficient Plugin now shows up in Plugins tab of the Selenium IDE options dialog • The plugin code in BeEfficient and ovIDE.xul can now change the enabled state from the UI
  • 38. Preferences • Lot of support is built into Firefox • Involves mostly boilerplate code
  • 39. Preferences • Create defaults for the preferences • Create dialog to allow user to change preference • Create an observer to receive notification of changes • And one of the following (or both): – Define options in Install manifest – Create UI (usually menu) to show Options dialog
  • 41. Your Turn • Explore the files in the third exercise HandsOn/selenium-ide_be-efficient_ex3 • Complete the TODO in the following files – Preference defaults (defaults.js) – Options dialog (options.xul) – Plugin code (BeEfficient.js) – Install Manifest (install.rdf)
  • 42. Result • Be Efficient Plugin options dialog is available • The options dialog can now be opened from the menu item • The preference can be seen in about:config • The preference and the UI elements are now in sync
  • 46. Command Builder • Puts a menu item in the context menu on the web page when Selenium IDE is open • Three types: Action, Accessor, Util • Util type will be available with Selenium IDE v1.0.11
  • 47. Util Command Builder • Register the Util command builder functions • Prepare (builder) function – Returns the menu item to show • Execute function – Called when the menu item is clicked – Can return zero or more commands to add to the test case
  • 48. Be Efficient Command Builder • When the Write My Test! context menu item is pressed, create commands for the following • Verify page title • Wait for all results • Verify each result
  • 49. Your Turn • Explore the files in the third exercise HandsOn/selenium-ide_be-efficient_ex4 • Complete the TODO in the following file – Plugin code (BeEfficient.js)
  • 50. Result • Write My Test! context menu is available on the web page when Selenium IDE is open • Clicking on the write my test on bing.com search results page will generate your test
  • 51. Be Efficient In Action • Open Selenium IDE • In Firefox, open www.bing.com • Type selenium in search box • Hit the enter key • Right click on the results web page • Select Write My Test! • Check the generated test case • Execute the test case (maybe with highlight elements plugin)
  • 52. Resources for Selenium IDE Plugins • Selenium IDE Plugin Documentation http://seleniumhq.org/projects/ide/plugins.html • My Blog http://blog.reallysimplethoughts.com/
  • 53. Resources for Firefox Add-ons https://developer.mozilla.org/en/XUL_School https://developer.mozilla.org/en/Building_an_Extension https://developer.mozilla.org/En/Firefox_addons_developer_guide http://robertnyman.com/2009/01/24/how-to-develop-a-firefox-extension/ http://books.mozdev.org/chapters/index.html https://developer.mozilla.org/en/Creating_XPCOM_Components http://blog.mozilla.com/addons/2009/01/28/how-to-develop-a-firefox-extension/ http://roachfiend.com/archives/2004/12/08/how-to-create-firefox-extensions/
  • 54. Time to Celebrate! Thanks for Joining!
  • 55. Questions? Feel free to chat with me anytime