SlideShare uma empresa Scribd logo
1 de 31
PowerPoint Presentation on



SELENIUM TESTING
Selenium is a portable software testing framework for web
applications. Selenium provides a record/playback tool for
authoring tests without learning a test scripting language.
Selenium provides a test domain specific language (DSL) to
write tests in a number of popular programming
languages, including C#, Java, Groovy, Perl, PHP, Python
and Ruby. Test playback is possible in most modern web
browsers. Selenium deploys on Windows, Linux, and
Macintosh platforms.

It works anywhere JavaScript is supported. Selenium was
originally developed by Jason Huggins, who was later
joined by other programmers and testers at Thought Works.
It is open source software, released under the Apache 2.0
license and can be downloaded and used without charge.
• You can use Selenium-Core and customize
  everything – deprecated.

• But it is easier to just get a Firefox plug-in
  “Selenium-IDE” that helps you “record” test
  Cases.

• You can record how an app is being used and then
playback those recordings followed by asserts.

• Get everything at: www.openqa.org/selenium/
• Integrated Development Environment for building
  Selenium test cases.

• Operates as a Firefox add-on and provides an interface for
  developing and running individual test cases or entire test
  suites.

• Selenium-IDE has a recording feature, which will keep
  account of user actions as they are performed and store
  them as a reusable script to play back.

• It also has a context menu (right-click) integrated with the
  Firefox browser, which allows the user to pick from a list
  of assertions and verifications for the selected location.
• Offers full editing of test cases.

• Although it is a Firefox only add-on, tests
  created in it can also be run against other
  browsers by using Selenium-RC &
  specifying the name of the test suite on
  the command line.
Selenium-RC (Remote Control)
Selenium Remote Control (RC) is a test tool that
allows you to write automated web application UI
tests in any programming language against any
HTTP website using any mainstream JavaScript-
enabled browser.

Selenium RC comes in two parts.
1. A server which automatically launches and kills
   browsers, and acts as a HTTP proxy for web
   requests from them.
2. Client libraries for your favorite computer
   language.
Selenium-Grid allows the Selenium-RC solution to
scale for test suites or test suites to be run in multiple
environments.

• With Selenium-Grid multiple instances of Selenium-
  RC are running on various operating system and
  browser configurations, each of these when
  launching register with a hub. When tests are sent to
  the hub they are then redirected to an available
  Selenium-RC, which will launch the browser and
  run the test.
This allows for running tests in parallel, with the entire
test suite theoretically taking only as long to run as the
longest individual test.
Selenium-IDE
STEP 1 – installation :
You can download Selenium IDE from this
locations.
http://selenium-
ide.openqa.org/download.jsp
https://addons.mozilla.org/en-
US/firefox/addon/2079

Once the add-on is installed make sure you
do not forget to restart Firefox.
STEP 2 – running a simple test :
a. Start Selenium IDE in Firefox:
   Tools->Selenium IDE. You will see the following popup.
                                            The list of
                                            actions in the
                                            actual test
                                            case
                                            to execute
    The root of web
    application you
    want to test




    The log of the
    events that were
    executed, including
    any errors or
    warning that may
    have occurred
Execution               Record test
Commands                actions




Reference of the
currently selected
command              Specify commands,
                     including asserts
b. Click on the red record button on the right.

c. Browse to Google.com and enter ‟selenium‟ in the
   search box and click enter.

d. Click on the first result, which is that of
   selenium.openqa.org.

e. Stop the recording by clicking on the record button.

You should see something like in next slide.
If you click on the „ Source‟ tab you can see the test html generated by selenium.
The „table‟ tab shows the commands recorded by Selenium.
f. Open a new tab in Firefox and click on the Selenium IDE‟s
   play button to run the recorded test.




The IDE should play your recorded test. The IDE after the
test run is shown in next slide. In the „Log section‟ you can
see the various events run by the test. In the table tab you
can see that all the rows are green, which means that the test
ran successfully.
Now lets add a small assertion to the above test.
 a. Click on the blank line below after the last „clickAndWait‟
     command and insert „assertTextPresent‟ command from
    the drop down box as shown below. You should see
    something like this.
This test checks to see if the text „Selenium News‟ is present in the last rendered
page. Run the test again and you should see that the test has run successfully. No
try replacing the text with something that is not present on the page, take for
example „elvis‟ and run the test again. Now the test fails and you should get the
screen below.
Selenium-RC
Installation-
Installation is rather a misnomer for Selenium. Selenium has set of
libraries available in the programming language of your choice. You
could download them from www.openqa.org/selenium/
Once you‟ve chosen a language to work with, you simply need to:
Install the Selenium RC Server.
Set up a programming project using a language specific client driver.


Installing Selenium Server-

•   Ensure that JDK is present on the machine and is in the class path.

•   The Selenium RC server is simply a Java jar file (selenium-server-
    standalone-<version-number>.jar), which doesn‟t require any special
    installation. Just downloading the zip file and extracting the server in
    the desired directory is sufficient.
Creating a Selenium Test Case in Java
• I assume you have Eclipse installed
• I assume you have downloaded the Selenium RC
      1. The files selenium-server.jar and selenium-java-client-
         driver.jar will be needed

• In Eclipse create a new Java Project
     1. Add the selenium-java-<version-number>.jar files to
        your project as references.
     2. Add to your project class path the file selenium-java-
        <version-number>.jar.
     3. Finish

• Right click on the src folder and create a new JUnit Test Case
• You should now be looking at the JUnit test case class in the
  editor
Server Start selenium Server
•    Once you have the server running, in Eclipse you want to
     run the test case as a JUnit Test


For details on Java test project configuration, see the Appendix
sections
Configuring Selenium RC With Eclipse

    SEE DEMO OF TESTRUNNER.HTML

http://masivukeni.ccnmtl.columbi
a.edu/site_media/selenium/TestR
unner.html
Run a HTML test suite using Selenium-RC
After you generated your HTML suite file, you can run the suite using –
htmlSuite command.

-htmlSuite requires you to specify:

* browserString (e.g. "*firefox")
* startURL (e.g. "http://www.google.com")
* suiteFile (e.g. "c:absolutepathtomyHTMLSuite.html")
* resultFile (e.g. "c:absolutepathtomyresults.html")

Follow these steps to run the suite:

1. Create a HTML file that will keep your test results
2. Open a command line
3. cd to the selenium-server.jar location.

For example: cd E:javaseleniumselenium-server-standalone-2.1.0.jar
4. Run the command with the required arguments. For example
 java -jar selenium-server.jar -port 4546 -htmlSuite
 *firefox "http://www.google.com"
 "c:SeleniumTestTestSuite.html" "C:test.html"
  You will see how Test runner is invoked and starts running the test in Firefox
In case Test runner does not start running the test cases, ensure pop-up
windows are enabled in your browser.
After the test script is done, you can check the test results in the HTML file
you provided as argument.
How to set up selenium Grid

 • You will need to download and install the latest Java JRE on your
   system. You can find this at http://java.sun.com .

 • You need to check that you have Apache Ant. If you open up a
   terminal/command prompt and type ant -version. If it doesn't return an
   error then you should be fine. If it returns an error you will need to
   download Apache Ant and expand the archive to a folder on hard drive.

 • You will need to now download Selenium Grid and put that in a folder
   that is easy to access. Now that we have all the relevant parts installed
   lets start the grid up.

 • We are going to start up the Selenium Grid Hub first. Open up a
   command prompt or terminal and navigate to the folder where the
   Selenium Grid files are stored.
•   From the command prompt run ant launch-hub. This will get the
    hub running. To see it running put http://localhost:4444/console
    into a browser and you will be shown a webpage with 3 columns.
    The first column shows what Environments it can handle, the
    second column shows what remote controls are available and the
    third column shows what remote controls are currently running
    tests. Like the following screenshot
•    Now that we have our hub running, lets start up a remote control. Open up
     another command prompt or terminal and navigate to the Selenium Grid folder.
     Run ant launch-remote-control. This will launch a Selenium Remote Control for
     handling Firefox on your OS on port 5555.

•    We now have a Selenium Grid up and running.


Running the Tests in Parallel on Firefox on a Single Machine
    Now let‟s start three more remote control instances. Launch them in separate
    terminals:

    ant -Dport=5556 launch-remote-control
    ant -Dport=5557 launch-remote-control
    ant -Dport=5558 launch-remote-control

    You should now see a total of four remote controls available in the Hub console
    http://localhost:4444/console:
Available Remote Controls
      Host          Port         Environment

      localhost     5555         *firefox

      localhost     5556         *firefox

      localhost     5557         *firefox

      localhost     5558         *firefox




Launch the tests in parallel in a new terminal:

ant run-demo-in-parallel
Selenium Testing

Mais conteúdo relacionado

Mais procurados

Selenium WebDriver with Java
Selenium WebDriver with JavaSelenium WebDriver with Java
Selenium WebDriver with JavaFayis-QA
 
Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...
Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...
Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...Simplilearn
 
Selenium webdriver course content rakesh hansalia
Selenium webdriver course content rakesh hansaliaSelenium webdriver course content rakesh hansalia
Selenium webdriver course content rakesh hansaliaRakesh Hansalia
 
Selenium test automation
Selenium test automationSelenium test automation
Selenium test automationSrikanth Vuriti
 
Selenium webdriver interview questions and answers
Selenium webdriver interview questions and answersSelenium webdriver interview questions and answers
Selenium webdriver interview questions and answersITeLearn
 
Automated Web Testing Using Selenium
Automated Web Testing Using SeleniumAutomated Web Testing Using Selenium
Automated Web Testing Using SeleniumWeifeng Zhang
 
Web application testing with Selenium
Web application testing with SeleniumWeb application testing with Selenium
Web application testing with SeleniumKerry Buckley
 
Selenium- A Software Testing Tool
Selenium- A Software Testing ToolSelenium- A Software Testing Tool
Selenium- A Software Testing ToolZeba Tahseen
 
Test Automation and Selenium
Test Automation and SeleniumTest Automation and Selenium
Test Automation and SeleniumKarapet Sarkisyan
 
Selenium Presentation at Engineering Colleges
Selenium Presentation at Engineering CollegesSelenium Presentation at Engineering Colleges
Selenium Presentation at Engineering CollegesVijay Rangaiah
 
Efficient Automated Test Creation With Selenium IDE Plugins
Efficient Automated Test Creation With Selenium IDE PluginsEfficient Automated Test Creation With Selenium IDE Plugins
Efficient Automated Test Creation With Selenium IDE PluginsSamit Badle
 
Automated Web Testing With Selenium
Automated Web Testing With SeleniumAutomated Web Testing With Selenium
Automated Web Testing With SeleniumDeepak Mittal
 
Selenium WebDriver with C#
Selenium WebDriver with C#Selenium WebDriver with C#
Selenium WebDriver with C#srivinayak
 
Selenium Webdriver Interview Questions
Selenium Webdriver Interview QuestionsSelenium Webdriver Interview Questions
Selenium Webdriver Interview QuestionsJai Singh
 

Mais procurados (20)

Selenium WebDriver with Java
Selenium WebDriver with JavaSelenium WebDriver with Java
Selenium WebDriver with Java
 
Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...
Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...
Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...
 
Selenium webdriver course content rakesh hansalia
Selenium webdriver course content rakesh hansaliaSelenium webdriver course content rakesh hansalia
Selenium webdriver course content rakesh hansalia
 
Selenium test automation
Selenium test automationSelenium test automation
Selenium test automation
 
Selenium (1)
Selenium (1)Selenium (1)
Selenium (1)
 
Selenium webdriver interview questions and answers
Selenium webdriver interview questions and answersSelenium webdriver interview questions and answers
Selenium webdriver interview questions and answers
 
Automated Web Testing Using Selenium
Automated Web Testing Using SeleniumAutomated Web Testing Using Selenium
Automated Web Testing Using Selenium
 
Selenium basic
Selenium basicSelenium basic
Selenium basic
 
Selenium Demo
Selenium DemoSelenium Demo
Selenium Demo
 
Web application testing with Selenium
Web application testing with SeleniumWeb application testing with Selenium
Web application testing with Selenium
 
Introduction to selenium
Introduction to seleniumIntroduction to selenium
Introduction to selenium
 
Selenium- A Software Testing Tool
Selenium- A Software Testing ToolSelenium- A Software Testing Tool
Selenium- A Software Testing Tool
 
Selenium topic 1- Selenium Basic
Selenium topic 1-  Selenium BasicSelenium topic 1-  Selenium Basic
Selenium topic 1- Selenium Basic
 
Test Automation and Selenium
Test Automation and SeleniumTest Automation and Selenium
Test Automation and Selenium
 
Selenium Presentation at Engineering Colleges
Selenium Presentation at Engineering CollegesSelenium Presentation at Engineering Colleges
Selenium Presentation at Engineering Colleges
 
Efficient Automated Test Creation With Selenium IDE Plugins
Efficient Automated Test Creation With Selenium IDE PluginsEfficient Automated Test Creation With Selenium IDE Plugins
Efficient Automated Test Creation With Selenium IDE Plugins
 
Automated Web Testing With Selenium
Automated Web Testing With SeleniumAutomated Web Testing With Selenium
Automated Web Testing With Selenium
 
Selenium WebDriver with C#
Selenium WebDriver with C#Selenium WebDriver with C#
Selenium WebDriver with C#
 
Selenium introduction
Selenium introductionSelenium introduction
Selenium introduction
 
Selenium Webdriver Interview Questions
Selenium Webdriver Interview QuestionsSelenium Webdriver Interview Questions
Selenium Webdriver Interview Questions
 

Destaque

Ten reasons why now is the perfect time to get serious about the mobile web
Ten reasons why now is the perfect time to get serious about the mobile webTen reasons why now is the perfect time to get serious about the mobile web
Ten reasons why now is the perfect time to get serious about the mobile webTijs Vrolix
 
Webinar: Appium & Perfecto: A Perfect Match
Webinar: Appium & Perfecto: A Perfect MatchWebinar: Appium & Perfecto: A Perfect Match
Webinar: Appium & Perfecto: A Perfect MatchLizzy Guido (she/her)
 
How to Test on the Right Mobile Platforms
How to Test on the Right Mobile PlatformsHow to Test on the Right Mobile Platforms
How to Test on the Right Mobile PlatformsPerfecto by Perforce
 
Qtp 8.0 basic
Qtp 8.0 basicQtp 8.0 basic
Qtp 8.0 basicmedsherb
 
Achieving a Winning Digital User Experience with Real World Testing
Achieving a Winning Digital User Experience with Real World TestingAchieving a Winning Digital User Experience with Real World Testing
Achieving a Winning Digital User Experience with Real World TestingPerfecto by Perforce
 
QTP Automation Testing Tutorial 2
QTP Automation Testing Tutorial 2QTP Automation Testing Tutorial 2
QTP Automation Testing Tutorial 2Akash Tyagi
 
TechTalk: Taking the Mystery Out of Object ID Automation
TechTalk: Taking the Mystery Out of Object ID AutomationTechTalk: Taking the Mystery Out of Object ID Automation
TechTalk: Taking the Mystery Out of Object ID AutomationLizzy Guido (she/her)
 
Hp perfecto webinar - UFT Mobile
Hp perfecto webinar - UFT MobileHp perfecto webinar - UFT Mobile
Hp perfecto webinar - UFT MobilePerfecto Mobile
 
10 reasons why now is the perfect time to get started with the mobile web
10 reasons why now is the perfect time to get started with the mobile web10 reasons why now is the perfect time to get started with the mobile web
10 reasons why now is the perfect time to get started with the mobile webTijs Vrolix
 
Test Automation Tool comparison – HP UFT/QTP vs. Selenium
Test Automation Tool comparison –  HP UFT/QTP vs. SeleniumTest Automation Tool comparison –  HP UFT/QTP vs. Selenium
Test Automation Tool comparison – HP UFT/QTP vs. SeleniumAspire Systems
 
Launch Better Apps, Faster - Perfecto & Orasi Joint Webinar Sldies
Launch Better Apps, Faster - Perfecto & Orasi Joint Webinar SldiesLaunch Better Apps, Faster - Perfecto & Orasi Joint Webinar Sldies
Launch Better Apps, Faster - Perfecto & Orasi Joint Webinar SldiesPerfecto by Perforce
 
iOS9 Launch - Mobile Dev & Test Implications
iOS9 Launch - Mobile Dev & Test ImplicationsiOS9 Launch - Mobile Dev & Test Implications
iOS9 Launch - Mobile Dev & Test ImplicationsPerfecto Mobile
 
7 Keys for Unattended Test AUtomation webinar deck
7 Keys for Unattended Test AUtomation webinar deck7 Keys for Unattended Test AUtomation webinar deck
7 Keys for Unattended Test AUtomation webinar deckPerfecto Mobile
 
Webinar learn how to test any mobile app style from within eclipse using real...
Webinar learn how to test any mobile app style from within eclipse using real...Webinar learn how to test any mobile app style from within eclipse using real...
Webinar learn how to test any mobile app style from within eclipse using real...Perfecto Mobile
 

Destaque (20)

Qtp day 1
Qtp day 1Qtp day 1
Qtp day 1
 
Ten reasons why now is the perfect time to get serious about the mobile web
Ten reasons why now is the perfect time to get serious about the mobile webTen reasons why now is the perfect time to get serious about the mobile web
Ten reasons why now is the perfect time to get serious about the mobile web
 
Webinar: Appium & Perfecto: A Perfect Match
Webinar: Appium & Perfecto: A Perfect MatchWebinar: Appium & Perfecto: A Perfect Match
Webinar: Appium & Perfecto: A Perfect Match
 
How to Test on the Right Mobile Platforms
How to Test on the Right Mobile PlatformsHow to Test on the Right Mobile Platforms
How to Test on the Right Mobile Platforms
 
Qtp 80 Basics3561
Qtp 80 Basics3561Qtp 80 Basics3561
Qtp 80 Basics3561
 
Qtp 8.0 basic
Qtp 8.0 basicQtp 8.0 basic
Qtp 8.0 basic
 
TechTalk: Report Bugs Like a Boss
TechTalk: Report Bugs Like a BossTechTalk: Report Bugs Like a Boss
TechTalk: Report Bugs Like a Boss
 
Achieving a Winning Digital User Experience with Real World Testing
Achieving a Winning Digital User Experience with Real World TestingAchieving a Winning Digital User Experience with Real World Testing
Achieving a Winning Digital User Experience with Real World Testing
 
QTP Automation Testing Tutorial 2
QTP Automation Testing Tutorial 2QTP Automation Testing Tutorial 2
QTP Automation Testing Tutorial 2
 
TechTalk: Taking the Mystery Out of Object ID Automation
TechTalk: Taking the Mystery Out of Object ID AutomationTechTalk: Taking the Mystery Out of Object ID Automation
TechTalk: Taking the Mystery Out of Object ID Automation
 
Hp perfecto webinar - UFT Mobile
Hp perfecto webinar - UFT MobileHp perfecto webinar - UFT Mobile
Hp perfecto webinar - UFT Mobile
 
Qtp object repository
Qtp object repositoryQtp object repository
Qtp object repository
 
10 reasons why now is the perfect time to get started with the mobile web
10 reasons why now is the perfect time to get started with the mobile web10 reasons why now is the perfect time to get started with the mobile web
10 reasons why now is the perfect time to get started with the mobile web
 
Test Automation Tool comparison – HP UFT/QTP vs. Selenium
Test Automation Tool comparison –  HP UFT/QTP vs. SeleniumTest Automation Tool comparison –  HP UFT/QTP vs. Selenium
Test Automation Tool comparison – HP UFT/QTP vs. Selenium
 
Testing Apps for Wearables
Testing Apps for WearablesTesting Apps for Wearables
Testing Apps for Wearables
 
Launch Better Apps, Faster - Perfecto & Orasi Joint Webinar Sldies
Launch Better Apps, Faster - Perfecto & Orasi Joint Webinar SldiesLaunch Better Apps, Faster - Perfecto & Orasi Joint Webinar Sldies
Launch Better Apps, Faster - Perfecto & Orasi Joint Webinar Sldies
 
iOS9 Launch - Mobile Dev & Test Implications
iOS9 Launch - Mobile Dev & Test ImplicationsiOS9 Launch - Mobile Dev & Test Implications
iOS9 Launch - Mobile Dev & Test Implications
 
7 Keys for Unattended Test AUtomation webinar deck
7 Keys for Unattended Test AUtomation webinar deck7 Keys for Unattended Test AUtomation webinar deck
7 Keys for Unattended Test AUtomation webinar deck
 
Appium vs. Appium with Perfecto
Appium vs. Appium with PerfectoAppium vs. Appium with Perfecto
Appium vs. Appium with Perfecto
 
Webinar learn how to test any mobile app style from within eclipse using real...
Webinar learn how to test any mobile app style from within eclipse using real...Webinar learn how to test any mobile app style from within eclipse using real...
Webinar learn how to test any mobile app style from within eclipse using real...
 

Semelhante a Selenium Testing

Selenium by using JAVA
Selenium by using JAVASelenium by using JAVA
Selenium by using JAVAmahirayavarapu
 
First steps with selenium rc
First steps with selenium rcFirst steps with selenium rc
First steps with selenium rcDang Nguyen
 
Selenium Tutorial
Selenium TutorialSelenium Tutorial
Selenium Tutorialprad_123
 
Selenium Ide Tutorial
Selenium Ide TutorialSelenium Ide Tutorial
Selenium Ide Tutorialmetapix
 
Steps to write Selenium
Steps to write Selenium  Steps to write Selenium
Steps to write Selenium Rohit Thakur
 
Selenium introduction and some feautures
Selenium introduction and some feauturesSelenium introduction and some feautures
Selenium introduction and some feautureszahid32
 
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 Automation Using Ruby
Selenium Automation Using RubySelenium Automation Using Ruby
Selenium Automation Using RubyKumari Warsha Goel
 
Selenium institute in bangalore
Selenium institute in bangaloreSelenium institute in bangalore
Selenium institute in bangaloreTIB Academy
 

Semelhante a Selenium Testing (20)

Sel
SelSel
Sel
 
Selenium by using JAVA
Selenium by using JAVASelenium by using JAVA
Selenium by using JAVA
 
Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
First steps with selenium rc
First steps with selenium rcFirst steps with selenium rc
First steps with selenium rc
 
Selenium Tutorial
Selenium TutorialSelenium Tutorial
Selenium Tutorial
 
Selenium Ide Tutorial
Selenium Ide TutorialSelenium Ide Tutorial
Selenium Ide Tutorial
 
Selenium
SeleniumSelenium
Selenium
 
Steps to write Selenium
Steps to write Selenium  Steps to write Selenium
Steps to write Selenium
 
Selenium Introduction
Selenium IntroductionSelenium Introduction
Selenium Introduction
 
Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Selenium introduction and some feautures
Selenium introduction and some feauturesSelenium introduction and some feautures
Selenium introduction and some feautures
 
Selenium Installation
Selenium  InstallationSelenium  Installation
Selenium Installation
 
Selenium - Installation
Selenium - InstallationSelenium - Installation
Selenium - Installation
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
Selenium Installation
Selenium InstallationSelenium Installation
Selenium Installation
 
Selenium Automation Using Ruby
Selenium Automation Using RubySelenium Automation Using Ruby
Selenium Automation Using Ruby
 
Selenium institute in bangalore
Selenium institute in bangaloreSelenium institute in bangalore
Selenium institute in bangalore
 
SKILLWISE_SELENIUM
SKILLWISE_SELENIUMSKILLWISE_SELENIUM
SKILLWISE_SELENIUM
 

Selenium Testing

  • 2. Selenium is a portable software testing framework for web applications. Selenium provides a record/playback tool for authoring tests without learning a test scripting language. Selenium provides a test domain specific language (DSL) to write tests in a number of popular programming languages, including C#, Java, Groovy, Perl, PHP, Python and Ruby. Test playback is possible in most modern web browsers. Selenium deploys on Windows, Linux, and Macintosh platforms. It works anywhere JavaScript is supported. Selenium was originally developed by Jason Huggins, who was later joined by other programmers and testers at Thought Works. It is open source software, released under the Apache 2.0 license and can be downloaded and used without charge.
  • 3. • You can use Selenium-Core and customize everything – deprecated. • But it is easier to just get a Firefox plug-in “Selenium-IDE” that helps you “record” test Cases. • You can record how an app is being used and then playback those recordings followed by asserts. • Get everything at: www.openqa.org/selenium/
  • 4.
  • 5. • Integrated Development Environment for building Selenium test cases. • Operates as a Firefox add-on and provides an interface for developing and running individual test cases or entire test suites. • Selenium-IDE has a recording feature, which will keep account of user actions as they are performed and store them as a reusable script to play back. • It also has a context menu (right-click) integrated with the Firefox browser, which allows the user to pick from a list of assertions and verifications for the selected location.
  • 6. • Offers full editing of test cases. • Although it is a Firefox only add-on, tests created in it can also be run against other browsers by using Selenium-RC & specifying the name of the test suite on the command line.
  • 7. Selenium-RC (Remote Control) Selenium Remote Control (RC) is a test tool that allows you to write automated web application UI tests in any programming language against any HTTP website using any mainstream JavaScript- enabled browser. Selenium RC comes in two parts. 1. A server which automatically launches and kills browsers, and acts as a HTTP proxy for web requests from them. 2. Client libraries for your favorite computer language.
  • 8.
  • 9. Selenium-Grid allows the Selenium-RC solution to scale for test suites or test suites to be run in multiple environments. • With Selenium-Grid multiple instances of Selenium- RC are running on various operating system and browser configurations, each of these when launching register with a hub. When tests are sent to the hub they are then redirected to an available Selenium-RC, which will launch the browser and run the test.
  • 10. This allows for running tests in parallel, with the entire test suite theoretically taking only as long to run as the longest individual test.
  • 11. Selenium-IDE STEP 1 – installation : You can download Selenium IDE from this locations. http://selenium- ide.openqa.org/download.jsp https://addons.mozilla.org/en- US/firefox/addon/2079 Once the add-on is installed make sure you do not forget to restart Firefox.
  • 12. STEP 2 – running a simple test : a. Start Selenium IDE in Firefox: Tools->Selenium IDE. You will see the following popup. The list of actions in the actual test case to execute The root of web application you want to test The log of the events that were executed, including any errors or warning that may have occurred
  • 13. Execution Record test Commands actions Reference of the currently selected command Specify commands, including asserts
  • 14. b. Click on the red record button on the right. c. Browse to Google.com and enter ‟selenium‟ in the search box and click enter. d. Click on the first result, which is that of selenium.openqa.org. e. Stop the recording by clicking on the record button. You should see something like in next slide.
  • 15. If you click on the „ Source‟ tab you can see the test html generated by selenium. The „table‟ tab shows the commands recorded by Selenium.
  • 16. f. Open a new tab in Firefox and click on the Selenium IDE‟s play button to run the recorded test. The IDE should play your recorded test. The IDE after the test run is shown in next slide. In the „Log section‟ you can see the various events run by the test. In the table tab you can see that all the rows are green, which means that the test ran successfully.
  • 17.
  • 18. Now lets add a small assertion to the above test. a. Click on the blank line below after the last „clickAndWait‟ command and insert „assertTextPresent‟ command from the drop down box as shown below. You should see something like this.
  • 19. This test checks to see if the text „Selenium News‟ is present in the last rendered page. Run the test again and you should see that the test has run successfully. No try replacing the text with something that is not present on the page, take for example „elvis‟ and run the test again. Now the test fails and you should get the screen below.
  • 20. Selenium-RC Installation- Installation is rather a misnomer for Selenium. Selenium has set of libraries available in the programming language of your choice. You could download them from www.openqa.org/selenium/ Once you‟ve chosen a language to work with, you simply need to: Install the Selenium RC Server. Set up a programming project using a language specific client driver. Installing Selenium Server- • Ensure that JDK is present on the machine and is in the class path. • The Selenium RC server is simply a Java jar file (selenium-server- standalone-<version-number>.jar), which doesn‟t require any special installation. Just downloading the zip file and extracting the server in the desired directory is sufficient.
  • 21. Creating a Selenium Test Case in Java • I assume you have Eclipse installed • I assume you have downloaded the Selenium RC 1. The files selenium-server.jar and selenium-java-client- driver.jar will be needed • In Eclipse create a new Java Project 1. Add the selenium-java-<version-number>.jar files to your project as references. 2. Add to your project class path the file selenium-java- <version-number>.jar. 3. Finish • Right click on the src folder and create a new JUnit Test Case • You should now be looking at the JUnit test case class in the editor
  • 23. Once you have the server running, in Eclipse you want to run the test case as a JUnit Test For details on Java test project configuration, see the Appendix sections Configuring Selenium RC With Eclipse SEE DEMO OF TESTRUNNER.HTML http://masivukeni.ccnmtl.columbi a.edu/site_media/selenium/TestR unner.html
  • 24. Run a HTML test suite using Selenium-RC After you generated your HTML suite file, you can run the suite using – htmlSuite command. -htmlSuite requires you to specify: * browserString (e.g. "*firefox") * startURL (e.g. "http://www.google.com") * suiteFile (e.g. "c:absolutepathtomyHTMLSuite.html") * resultFile (e.g. "c:absolutepathtomyresults.html") Follow these steps to run the suite: 1. Create a HTML file that will keep your test results 2. Open a command line 3. cd to the selenium-server.jar location. For example: cd E:javaseleniumselenium-server-standalone-2.1.0.jar
  • 25. 4. Run the command with the required arguments. For example java -jar selenium-server.jar -port 4546 -htmlSuite *firefox "http://www.google.com" "c:SeleniumTestTestSuite.html" "C:test.html" You will see how Test runner is invoked and starts running the test in Firefox
  • 26. In case Test runner does not start running the test cases, ensure pop-up windows are enabled in your browser. After the test script is done, you can check the test results in the HTML file you provided as argument.
  • 27. How to set up selenium Grid • You will need to download and install the latest Java JRE on your system. You can find this at http://java.sun.com . • You need to check that you have Apache Ant. If you open up a terminal/command prompt and type ant -version. If it doesn't return an error then you should be fine. If it returns an error you will need to download Apache Ant and expand the archive to a folder on hard drive. • You will need to now download Selenium Grid and put that in a folder that is easy to access. Now that we have all the relevant parts installed lets start the grid up. • We are going to start up the Selenium Grid Hub first. Open up a command prompt or terminal and navigate to the folder where the Selenium Grid files are stored.
  • 28. From the command prompt run ant launch-hub. This will get the hub running. To see it running put http://localhost:4444/console into a browser and you will be shown a webpage with 3 columns. The first column shows what Environments it can handle, the second column shows what remote controls are available and the third column shows what remote controls are currently running tests. Like the following screenshot
  • 29. Now that we have our hub running, lets start up a remote control. Open up another command prompt or terminal and navigate to the Selenium Grid folder. Run ant launch-remote-control. This will launch a Selenium Remote Control for handling Firefox on your OS on port 5555. • We now have a Selenium Grid up and running. Running the Tests in Parallel on Firefox on a Single Machine Now let‟s start three more remote control instances. Launch them in separate terminals: ant -Dport=5556 launch-remote-control ant -Dport=5557 launch-remote-control ant -Dport=5558 launch-remote-control You should now see a total of four remote controls available in the Hub console http://localhost:4444/console:
  • 30. Available Remote Controls Host Port Environment localhost 5555 *firefox localhost 5556 *firefox localhost 5557 *firefox localhost 5558 *firefox Launch the tests in parallel in a new terminal: ant run-demo-in-parallel