Você está na página 1de 32

Types Of Testing

Testing on a high-level can be divided into two types; 1.Manual Testing This covers testing of both the functional and non-

functional aspects of the application. 2.Automation Testing Covers functional and non-functional testing by using some software tools to automate the process.

Automation Testing
When to Automate a System: Automation testing is generally done after 85% of the manual testing is done and the system is stable. Non-Functional Automation Testing:Performance of a system, Load Testing, Stress Testing,UI Testing
Tools:Apache J-Meter(Open Source) LoadRunner(Paid tool) WinRunner

Automation Testing

Functional Automation Testing:Tests functional part of the system. Tools of trade; Selenium Quick Test Professional

Open-Source Light on System Learning and Configuartion are needed.

Varies from $8000 - $12000 1.7 GBSystem crashes. Easy to use.

Selenium Tools
Basically there are 4 types of Selenium tools;
1.Selenium IDE

2.Selenium RC
3.Selenium Web Driver 4.Selenium Grid

Selenium IDE
Firefox add-on Record and Run playback system.

Easy to use UI
Generates codes to run with RC.

Cons: Works with only Firefox.

Selenium RC

Client/Server system that controls web browsers Can be used with all most all the languages Can work on most of the browsers available today. May not work with latest version of IE and Firefox.

No UI Independent of language OS indepenent. Can work on Mac based system


Cons: Start and stop server everytime we run the script.

Web Driver
Uses all most all the languages

like Java,Ruby,Python,C# except PHP and Perl. Supports all most all the browsers like IE,Firefox,Chrome except Opera and Safari. Android and iphone testing Multiple platforms like Windows,Linux,Solaris

Selenium Grid
It is a server that allows allows tests to use web browser

instances running on remote machines. With Selenium Grid, one server acts as the hub. Tests contact the hub to obtain access to browser instances. Can run tests on multiple servers. The hub has a list of servers that provide access to browser instances (WebDriver nodes), and lets tests use these instances. Can run tests in parallel on multiple machines manages different browser versions and browser configurations centrally.

Selenium 2.0
Selenium 1
(IDE,RC,GRID)

Web Driver

Selenium 2

Selenium Installation

Open the following link in your firefox browser; http://docs.seleniumhq.org/download/ Download the .xpi file for your Firefox browser. Automatically installs IDE in Firefox. Restart Firefox. Now Selenium commands(Selenese) can be seen on the right-click option menu. For detailed installation procedure, refer the link below; http://docs.seleniumhq.org/docs/02_selenium_ide.jsp#i nstalling-the-ide

Firebug Installation
Firefox Add-on.
Developers tool. Can find out paths and locations for different elements in a

page. Can be downloaded in the following link; https://addons.mozilla.org/en-S/firefox/addon/firebug/ After installation restart Firefox. Firebug logo can be seen on the top right in the toolbar of firebug. Also Inspect Element with Firebug is added to context menu

Selenium IDE Basics

Selenese Commands
open opens a page using a URL. click/clickAndWait performs a click operation, and optionally waits

for a new page to load. verifyTitle/assertTitle verifies an expected page title. verifyTextPresent verifies expected text is somewhere on the page. verifyElementPresent verifies an expected UI element, as defined by its HTML tag, is present on the page. verifyText verifies expected text and its corresponding HTML tag are present on the page. verifyTable verifies a tables expected contents. waitForPageToLoad pauses execution until an expected new page loads. Called automatically when clickAndWait is used. waitForElementPresent pauses execution until an expected UI element, as defined by its HTML tag, is present on the page.

Assert and Verify


Assert:Checks if an element is present on a page. If it is not there then the test stops there. Verify:Checks if an element is present on a page. If it is not there then still the test execution carries on. *Note:We can use these commands by right-clicking on any element on window and selecting any of the Assert or Verify options.

Locators
Locating elements in a page by different methods; 1.Locating elements by ID 2.Locating element by Name 3.Locating element by LinkText 4.Locating elements by DOM 5.Locating element by CSS 6.Locating element by Xpath

1.Locating Elements by ID

Using Element ID on Selenium IDE

2.Locating Elements by Name

Element Name and Value on Selenium IDE

3.Locating Elements by LinkText

4.Locating Elements by DOM


Document Object Model(DOM)
Is a cross-platform and language-independent convention for

representing and interacting with objects in HTML, XHTML and XML documents. DOM is updated via AJAX ,so locators need time to fetch element by DOM.

5.Locating Elements by CSS

6.Locating Elements by XPath

WebDriver
Drivers of Webdriver 1.HtmlUnit Driver 2.Firefox Driver 3.Internet Explorer Driver 4.Chrome Driver 5.Opera Driver 6.iPhone Driver 7.Android Driver

WebDriver API
To Control Browser WebDriver driver = new FirefoxDriver To work with Elements WebElement element = driver.findElement(By.id(id)); To open a url Get(http:// ); To Maximize Browser Window driver.manage().window().maximize();

WebDriver API
Close Browser void quit(); Finding Elements By.id(idOFObject); By.linkText(TextUsedInTheLink); By.partialLinkText(part of Thelink); By.tagName(theHTMLNodeType); By.className(cssSelectorToTheElement); By.xpath(//Xpath/to/the/element); By.name(nameOfElement);

Basic Operations on Elements


click(); submit(); getValue(); sendKeys(); clear(); driver.switchTo().alert(); alert.accept(); alert.dismiss(); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

Test Suites and Frameworks


Test Suite All the scripts together Framework Framework runs the scripts. Gives and gets all the data. Gives all the loggings. Gives results Gets information from .xls files

Frameworks for Webdriver


Junit and TestNG famework
Junit is the most popular framework eventhough

TestNG has more features. Junit cant be used when Javascript sandbox is used

Useful References
http://docs.seleniumhq.org/docs/

http://guru99.com/selenium-tutorial.html
http://book.theautomatedtester.co.uk

Thank You

Você também pode gostar