1 / 116

Day 1

Day 1. Selenium – Testing Tool. What is Selenium?. • Selenium is a robust set of tools that supports rapid development of test automation for web-based applications. • Works anywhere JavaScript is supported • Hooks for many other languages - Java, Ruby, Python

Télécharger la présentation

Day 1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Day 1

  2. Selenium – Testing Tool

  3. What is Selenium? • Selenium is a robust set of tools that supports rapid development of test automation for web-based applications. • Works anywhere JavaScript is supported • Hooks for many other languages - Java, Ruby, Python • Can simulate a user navigating through pages and then assert for specific marks on the pages • All you need to really know is HTML to start using it right away

  4. Selenium • You can use open source - Selenium tool • Selenium IDE is a plug-in to Firefox to record and playback tests (like WinRunner, QTP). • You can then export the recorded test in most language e.g. HTML, Java , .NET , Perl , Ruby etc. • The exported test can be run in any browser and any platform using "selenium remote control".

  5. Where to get it? • You can use Selenium-Core and customize everything • 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. • Get everything at: www.openqa.org/selenium/

  6. Selenium Components

  7. Selenium-IDE • 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.

  8. Selenium-RC (Remote Control) • Selenium-RC provides an API (Application Programming Interface) and library for each of its supported languages: HTML, Java, C#, Perl, PHP, Python, and Ruby. • This ability to use Selenium-RC with a high-level programming language to develop test cases also allows the automated testing to be integrated with a project’s automated build environment.

  9. Selenium-Grid 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.

  10. Steps to start with Selenium! 1) Begin: write and run tests in Firefox. Selenium IDE is a Firefox add-on that records clicks, typing, and other actions to make a test, which you can play back in the browser. 2) Customize: your language, your browser. Selenium Remote Control (RC) runs your tests in multiple browsers and platforms. Tweak your tests in your preferred language. 3) Deploy: scale out, speed up Selenium Grid extends Selenium RC to distribute your tests across multiple servers, saving you time by running tests in parallel.

  11. Supported Browsers * Tests developed on Firefox via Selenium-IDE can be executed on any other supported browser via a simple Selenium-RC command line.

  12. DAY 2

  13. Introduction WebDriver WebDriver is one of the most powerful and popular tools of Selenium toolkit. WebDriver comes as an extended version to Selenium RC with superfluous advantages and addresses many of its limitations. WebDriver extends its support to many latest browsers and platforms unlike Selenium IDE. WebDriver also doesn’t require Selenium server to be started prior to execution of the test scripts unlike Selenium RC.

  14. Architecture WebDriver is a web-based testing tool with a subtle difference with Selenium RC. Since, the tool was built on the fundamental where an isolated client was created for each of the web browser; no JavaScript Heavy lifting was required as we discussed in our very first tutorial. WebDriver makes direct calls to the Web browser and the entire test script is executed in this fashion. WebDriver uses the browsers support and capabilities to automation.

  15. WebDriver Browser Compatibility

  16. Language Support Java C# PHP Pearl Ruby Python

  17. Configuring WebDriver As we would be using Java as the programming language for this series and in order to create test scripts in java, we would have to introduce language- specific client drivers. Thus, let us begin with the downloading of Selenium Java Client Libraries.

  18. Download the Selenium Java Client Libraries • Step 1: Go to Selenium’s official website and navigate to its download page – “http://docs.seleniumhq.org/download/”. Refer the section in the below illustration where you can find Client Libraries listed for distinct programming languages. Click on the download link for Java Client Library.

  19. Step 2: Once downloaded, copy the folder and place it in the desired location on your file system

  20. Step 3: Extract the zipped folder, a folder named as “Selenium-2.41.0.zip“can be seen. The folder embodies all the required jar files which enable users to create test scripts in Java.

  21. Configuring Libraries with Eclipse Step 1: Navigate towards Eclipse. Create a new java based project following File -> New -> Java Project. Refer the following figure for the same.

  22. Eclipse Menu

  23. Step 2: Provide a user defined name for your Java Project. Let us provide the name as Learning_Selenium and Click on the Finish Button. The newly created project can be viewed at the left side of the screen in the package explorer panel.

  24. Step 3: Create a new Java class named as “First_WebdriverClass” under the source folder by right clicking on it and navigating to New -> class.

  25. Step 4: Now let us configure the libraries into our Java project. For this, select the project and Right click on it. Select “Properties” within the listed options. The following screen appears, Select “Java Build Path” from the options.

  26. Step 5: By default, “Libraries” tab is opened. If not, click on the “Libraries” tab. Then, click on the “Add External Jars…” button. Browse to the location where we have saved the extracted folder for Java Client Libraries.

  27. Step 6: Select all the JAR files present in the “selenium-java-2.41.0” folder and click on open button within the dialog box. The properties dialog box should look like the below illustration.

  28. Step 7: Click on the “OK” button within the dialog box so as to complete the configuration part of Selenium Libraries in our java project.

  29. Day 3

  30. Web Driver’s Driver

  31. Day 4

  32. How to Invoke IE Browser System.setProperty("webdriver.ie.driver","C://IEDriverServer.exe"); WebDriver driver=new InternetExplorerDriver(); // this line launch chrome browser driver.get("http://www.google.co.in");

  33. How to invoke Chrome Browser System.setProperty("webdriver.chrome.driver","C://chromedriver.exe"); WebDriver driver=new ChromeDriver(); // this line launch chrome browser driver.get("http://www.google.co.in");

  34. TestNG How to Download TestNG

  35. Step 1:In Eclipse, on top menu bar, Under Help Menu, Click on "Install new Software" in help window

  36. Step 2:Enter the URL (http://beust.com/eclipse/) at Work With field and click on "Add" button.

  37. Step 3:Once you click on "Add", it will display the screen, Enter the Name as "TestNG".

  38. Step 4:After clicking on "OK", it will scan and display the software available with the URL which you have mentionedNow select the checkbox at TestNG and Click on "Next" button.

  39. Step 5:It will check for the requirement and dependencies before starting the installation. If there is any problem with the requirements/dependencies, it will ask you to install them first before continuing with TestNG. Most of the cases it will successfully get installed nothing to worry about it.

  40. Step 6: Once the above step is done, it will ask you to review the installation details. If your are ready or Ok to install TestNG, click on "Next" to continue.

  41. Step 7: Accept the Terms of the license agreement and Click on "Finish" button.

  42. Thats it... It will take few minutes to get installed. Finally once the installation is done, you can if the TestNG is installed properly or Not.Go to Windows Menu bar, and Mouse Over on "Show View" and Click on "Other" at the last as in the below screen shot.

  43. Expand Java folder and see if the TestNg is available as in the below screen shot.

  44. Day 5

  45. Wait command In selenium "Waits" play an important role in executing tests. you will learn various aspects of both "Implicit" and "Explicit" waits in Selenium

More Related