• Like
Selenium
Upcoming SlideShare
Loading in...5
×
Uploaded on

 

More in: Technology , Business
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
6,730
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
385
Comments
0
Likes
6

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Presentation @ selemium tool Jagdish Patel Sr. QA Engineer
  • 2.
    • A brief overview of functional, regression and compatibility testing
    • An introduction to Selenium tool
    • Understanding various concepts related to Selenium
    • Practical examples
    • Q&A
    Topics for today's presentation © Copyright 2008, Gateway Group of companies.
  • 3.
    • Measures the quality of the business components of the system.
    • Verifies that the system behaves correctly from the user / business perspective.
    • Verifies that each component or business event performs in accordance to the specifications, responds correctly to all conditions that may be presented by incoming events / data, moves data correctly from one business event to the next in the order required to meet the business objectives of the system.
    Functional testing © Copyright 2008: Gateway Group of companies.
  • 4.
    • Testing of a program that has been modified in order to ensure that additional bugs have not been introduced. When a program is enhanced, testing is often done only for the newly added features. However, adding source code to a program often introduces errors in other routines. Hence the old and stable functions must be retested along with the new ones.
    Regression testing © Copyright 2008, Gateway Group of companies.
  • 5.
    • Part of software non-functional testing, conducted on the application to evaluate the application's compatibility with the computing environment like:
    • Browser compatibility (Firefox, Netscape, Internet Explorer,Safari, etc.)‏
    • Operating systems (MVS, UNIX, Windows, etc.)‏
    • Database (Oracle, Sybase, DB2, etc.)‏
    • Other System Software (Web server, networking/ messaging tool, etc.)‏
    • Computing capacity of Hardware Platform (IBM 360, HP 9000, etc.)‏
    • Bandwidth handling capacity of networking hardware
    Compatibility testing © Copyright 2008, Gateway Group of companies.
  • 6.
    • A test case is a set of test data and test programs (test scripts) and their expected results. A test case validates one or more system requirements and generates a pass or fail.
    • A test suite is collection of test scenarios and/or test cases that are related or that cooperate with each other.
    Test Case & Test Suite © Copyright 2008, Gateway Group of companies.
  • 7.
    • Selenium is a portable software testing framework for web applications. The tests can be written as HTML tables or coded in a number of popular programming languages and can be run directly in most modern web browsers. Selenium can be deployed on Windows, Linux, and Macintosh.
    • Selenium was developed by a team of programmers and testers at ThoughtWorks Inc .
    • It is released under the Apache 2.0 license and can be downloaded and used without charge.
    What is Selenium? © Copyright 2008, Gateway Group of companies.
  • 8.
    • Reduce the time in regression testing
    • Platform independent
    • Browser compatibility
    • Open source
    • Light weight
    • Check periodically to see if the site is on-line and works correctly
    Why should we care? © Copyright 2008, Gateway Group of companies.
  • 9.
    • Get everything at: www.openqa.org/selenium/
    • Additional requirements:
    • JDK 1.5 or above: www.sun.com
    • Ant 1.7: http://apache.mirrors.hoobly.com/ant/binaries/apache-ant-1.7.0-bin.zip
    Where to get Selenium © Copyright 2008, Gateway Group of companies.
  • 10.
    • Selenium Core
    • Selenium IDE
    • Selenium Remote Control
    • Selenium Grid
    Selenium core concepts © Copyright 2008, Gateway Group of companies.
  • 11. How Selenium Works © Copyright 2008, Gateway Group of companies.
  • 12.
    • Browser support
    Platforms supported by Selenium © Copyright 2008, Gateway Group of companies. Browser Selenium IDE Selenium RC Selenium Core Firefox 3 Record and playback tests Start browser, run tests Run test Firefox 2 Record and playback tests Start browser, run tests Run test IE 6 not supported Start browser, run tests Run test IE 7 not supported Start browser, run tests Run test Safari 3 not supported Start browser, run tests Run test Safari 2 not supported Start browser, run tests Run test Opera 9 not supported Start browser, run tests Run test
  • 13.
    • OS Support
    Platforms supported by Selenium.. © Copyright 2008, Gateway Group of companies. OS Selenium IDE Selenium RC Selenium Core Windows Works in Firefox 2+ Start browser, run tests Run test OS X Works in Firefox 2+ Start browser, run tests Run test Linux Works in Firefox 2+ Start browser, run tests Run test Solaris Works in Firefox 2+ Start browser, run tests Run test
  • 14.
    • Programming Languages support
    Platforms supported by Selenium.. © Copyright 2008, Gateway Group of companies. Language Selenium IDE Selenium RC Selenium Core C# Generate code Library ("driver") support n/a Java Generate code Library ("driver") support n/a Perl Generate code Library ("driver") support n/a PHP Generate code Library ("driver") support n/a Python Generate code Library ("driver") support n/a Ruby Generate code Library ("driver") support n/a
  • 15. Selenium Core © Copyright 2008, Gateway Group of companies.
    • Selenium Core is a test tool for web applications. Selenium Core tests run
    • directly in a browser, just as real users do. The test cases/suites can be
    • tested on various browsers like: IE, FireFox and Opera and also on
    • multiple platforms like: Mac, Windows, Linux etc.
  • 16.
    • Selenium Core uses a unique mechanism which allows it to run on so many platforms
    • Written in pure JavaScript/DHTML
    • We must have 'write' access to the machine our web application server is running on to
    • install Selenium Core.
    Selenium Core.. © Copyright 2008, Gateway Group of companies.
  • 17. Platform and Browser Compatibility: Windows: Internet Explorer 6.0 and 7.0 Firefox 0.8 to 2.0 Mozilla Suite 1.6+, 1.7+ Seamonkey 1.0 Opera 8 & 9 Mac OS X: Safari 2.0.4+ Firefox 0.8 to 2.0 Camino 1.0a1 Mozilla Suite 1.6+, 1.7+ Seamonkey 1.0 Not yet supported: OmniWeb Selenium Core.. © Copyright 2008, Gateway Group of companies.
  • 18. Linux: Firefox 0.8 to 2.0 Mozilla Suite 1.6+, 1.7+ Konqueror Opera 8 & 9 Selenium Core.. © Copyright 2008, Gateway Group of companies.
  • 19.
    • We need to extract the Selenium Core zip file into the 'DocumentRoot', 'htdocs', or 'webroot' folder of our webserver.
    • We then try to open the TestRunner.html page on our website, which should be in the folder/directory.
    • http://10.0.1.106/selenium core/core/TestRunner.html
    Installing Selenium Core © Copyright 2008, Gateway Group of companies.
  • 20.
    • Selenium uses javascript and iframes to embed a test automation engine in your
    • browser
    • .
    • This technique should work with any javascript-enabled browser
    • .
    • Because different browsers handle javascript somewhat differently, we usually have to
    • tweak the engine to support a wide range of browsers on Windows, Mac OS X and Linux.
    How does Selenium Core Work © Copyright 2008, Gateway Group of companies.
  • 21. Running Selenium's Test Suite © Copyright 2008, Gateway Group of companies.
  • 22. Test Suite Application being tested Test Cases Steps of the test case Execution Control
  • 23. Run All Tests Run Selected Test Pause/Play Execution Step through Execution Control Speed of Execution Highlight Elements in the Execution View the DOM of the current Page being tested Summary of the Test View the log of the current execution
  • 24.
    • To use Selenium Core, we need to make it available from the same web server as the application you want to test.
    • That means that we can't use Selenium Core (pure DHTML/JavaScript) to write a test of google.com This is because Selenium Core is pure DHTML/JavaScript, and so it is bound by JavaScript's security restrictions.
    • Specifically, JavaScript enforces (This is a JavaScript security requirement. If we can't/won't modify the webserver we want to test, Selenium Core may not be the right tool for us;
    • We may just want to use Selenium IDE or Selenium RC instead.
    Limitation of Selenium Core © Copyright 2008, Gateway Group of companies.
  • 25.
    • Selenium IDE is an integrated development environment for Selenium tests. It is implemented as a Firefox extension, and allows us to record, edit, and debug tests. Selenium IDE includes the entire Selenium Core, allowing us to easily and quickly record and play back tests in the actual environment that they will run.
    • Selenium IDE is not only recording tool: it is a complete IDE. We can choose to use its recording capability, or we may edit our scripts by hand. With the autocomplete support and the ability to move commands around quickly, Selenium IDE is the ideal environment for creating Selenium tests no matter what style of tests we prefer.
    Selenium IDE © Copyright 2008, Gateway Group of companies.
  • 26. The root of web application you want to test The list of actions in the actual test case to execute The log of the events that were executed, including any errors or warning that have occurred
  • 27. Execution Commands Try the test in the Web based TestRunner Reference of the currently selected command Record test actions Specify commands, including asserts
  • 28.
    • Features:
    • Easy record and playback
    • Intelligent field selection will use IDs, names, or XPath as needed
    • Autocomplete for all common Selenium commands
    • Walk through tests
    • Debug and set breakpoints
    • Save tests as HTML, Ruby scripts, or any other format
    • Support for Selenium user-extensions.js file
    • Option to automatically assert the title of every page
    Selenium IDE.. © Copyright 2008, Gateway Group of companies.
  • 29.
    • How to create a test plan in Selenium IDE
    • Install Selenium IDE 1.0-beta, a Firefox plugin.
    • After installing Selenium we need to restart your Firefox browser for the plugin to be activated.
    • Now we should see a new added menu item named Selenium IDE under the Firefox 'Tools' menu.
    • We open / browse the site for which we want to prepare a test case.
    • We start Selenium IDE from Firefox Tools->Selenium IDE.
    • We browse some pages.
    • We click red button to stop recording.
    Selenium IDE.. © Copyright 2008, Gateway Group of companies.
  • 30. Creating a Test Suite
    • A Test Suite in Selenium is just an HTML file that contains a table of links to tests
    <html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot; lang=&quot;en&quot;> <head> <meta content=&quot;text/html; charset=UTF-8&quot; http-equiv=&quot;content-type&quot; /> <title>Test Suite</title></head> <body> <table id=&quot;suiteTable&quot; cellpadding=&quot;1&quot; cellspacing=&quot;1&quot; border=&quot;1&quot; class=&quot;selenium&quot;><tbody> <tr><td><b>Test Suite</b></td></tr> <tr><td><a href=&quot;hotel.html&quot;>hotel</a></td></tr> <tr><td> <a href=&quot;Restaurant.html&quot;>Restaurant</a></td> </tr><tr><td> <a href=&quot;Meeting.html&quot;>Meeting</a></td></tr> <tr><td> <a href=&quot;Vacancies.html&quot;>Vacancies</a></td></tr> </tbody></table> </body> </html>
  • 31.
    • 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 tests run directly in a browser, just as real users do. These tests can be used for both acceptance testing (by performing higher-level tests on the integrated system instead of just testing each unit of the system independently) and browser compatibility testing (by testing the web application on different operating systems and browsers
    Selenium-Remote Control © Copyright 2008, Gateway Group of companies.
  • 32.
    • 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 favourite computer language.
    • The RC server also bundles Selenium Core, and automatically loads it into the browser.
    Selenium-Remote Control.. © Copyright 2008, Gateway Group of companies.
  • 33. Selenium-Remote Control © Copyright 2008, Gateway Group of companies.
  • 34.
    • The Selenium Server is written in Java, and requires the Java Runtime Environment (JRE) version 1.5.0 or higher in order to start. You may already have it installed. Try running this from the command line:
    • java -version
    • You should see a brief message telling you what version of Java is installed, like this:
    • java version &quot;1.5.0_07&quot;
    • Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03)‏
    • Java HotSpot(TM) Client VM (build 1.5.0_07-b03, mixed mode)‏
    • If you see an error message instead, you may need to install the JRE, or you may need to add it to your PATH environment variable.
    Selenium-Remote Control.. © Copyright 2008, Gateway Group of companies.
  • 35.
    • C:Program FilesJava>d:
    • D:>cd jag*
    • D:jagdish>cd se*
    • D:jagdishseleniumtool>cd se*
    • D:jagdishseleniumtoolSELenium core>cd..
    • D:jagdishseleniumtool>cd seleniumrc
    • D:jagdishseleniumtoolSeleniumRC>cd selenium-re*
    • D:jagdishseleniumtoolSeleniumRCselenium-remote-control-1.0-beta-1>cd selenium-se*
    • D:jagdishseleniumtoolSeleniumRCselenium-remote-control-1.0- beta-1selenium-server-1.0-beta-1>
    • D:jagdishseleniumtoolSeleniumRCselenium-remote-control-1.0- beta-1selenium-server-1.0-beta-1>java -jar selenium-server.jar -htmlsuite *firefox http://10.0.1.106/chagallhotel/ c: estsuiteChagallhotel.html c: estsuite esults.html
    Selenium-Remote Control.. © Copyright 2008, Gateway Group of companies.
  • 36. Selenium-Remote Control.. © Copyright 2008, Gateway Group of companies.
  • 37. (+) Java (JUnit)‏ import com.thoughtworks.selenium.*; import junit.framework.*; public class ChagallTest extends TestCase { private Selenium browser; public void setUp() { browser = new DefaultSelenium(&quot;localhost&quot;, 4444, &quot;*firefox&quot;, &quot;http://10.0.1.106/chagallhotel/&quot;); browser.start(); } public void testGoogle() { browser.open(&quot;http://10.0.1.106/chagallhotel/admin&quot;); browser.type(&quot;q&quot;, &quot;ld&quot;); browser.click(&quot;btnG&quot;); browser.waitForPageToLoad(&quot;5000&quot;); assertEquals(&quot; &quot;, browser.getTitle()); } public void tearDown() { browser.stop(); } } Programming a Selenium RC Test © Copyright 2008, Gateway Group of companies.
  • 38. (+) C# (NUnit)‏ using Selenium; using Nunit.Framework; namespace MyTests { [TestFixture] public class ChagallTest { private ISelenium browser public void SetUp() { browser = new DefaultSelenium(&quot;localhost&quot;, 4444,&quot;*firefox&quot;,&quot;http://http://10.0.1.106/chagallhotel/&quot;); browser.Start(); } public void testChagall() { browser.Open(&quot;http://10.0.1.106/chagallhotel/&quot;); browser.Type(&quot;q&quot;, &quot;ld&quot;); browser.Click(&quot;btnG&quot;); browser.WaitForPageToLoad(&quot;5000&quot;); Assert.AreEqual(&quot; &quot;, browser.GetTitle()); } public void TearDown() { browser.Stop(); } } } Programming a Selenium RC Test © Copyright 2008, Gateway Group of companies.
  • 39. (+) PHP (PHPUnit)‏ require_once 'Testing/Selenium.php'; require_once 'PHPUnit/Framework/TestCase.php'; class ChagallTest extends PHPUnit_Framework_TestCase { private $browser; public function setUp() { $this->browser = new Testing_Selenium(&quot;*firefox&quot;, &quot;http://http://10.0.1.106/chagallhotel/&quot;); $this->browser->start(); } public function tearDown() {$this->browser->stop();} public function testChagall()‏ { $this->browser->open(&quot;/webhp?hl=en&quot;); $this->browser->type(&quot;q&quot;, &quot;ld&quot;); $this->browser->click(&quot;btnG&quot;); $this->browser->waitForPageToLoad(10000); $this->assertRegExp(&quot; &quot;, $this->browser->getTitle()); } } Programming a Selenium RC Test © Copyright 2008, Gateway Group of companies.
  • 40.
    • Live Demo of an example
    © Copyright 2008, Gateway Group of companies.
  • 41.
    • Q&A
    © Copyright 2008, Gateway Group of companies.
  • 42. Anand Tiwari Thanks to... © Copyright 2008, Gateway Group of companies.
  • 43. Fulfilling Customer Needs
    • Describe the main attributes of the product
    • Link the product attributes to customer needs
  • 44. Cost Analysis
    • Indicate the financial advantages for the customer
    • Compare quality and price with those of the competition
  • 45. Strengths and Advantages
    • Summarize the special features and advantages of the product being introduced
  • 46. Next Steps of Action
    • Explain the steps that now need to be taken