9
ФУНКЦИОНАЛЬНОЕ ТЕСТИРОВАНИЕ С ИСПОЛЬЗОВАНИЕМ SELENIUM. QA Club Kiev

Functional Testing with Selenium

Embed Size (px)

Citation preview

Page 1: Functional Testing with Selenium

ФУНКЦИОНАЛЬНОЕ ТЕСТИРОВАНИЕ С ИСПОЛЬЗОВАНИЕМ SELENIUM.

   

QA Club Kiev

Page 2: Functional Testing with Selenium

ФУНКЦИОНАЛЬНОЕ ТЕСТИРОВАНИЕ

Функциональное тестирование — это тестирование ПО в целях проверки реализуемости функциональных требований, то есть способности ПО в определённых условиях решать задачи, нужные пользователям (© Wiki).

Можно ли автоматизировать? Когда автоматизировать? Варианты.

Можно и нужно!

• Когда начинается регрессионный цикл. Да? Нет!• При завершении каждой истории. • Когда уже не разрабатывается новая

функциональность.

QA Club Kiev

Page 3: Functional Testing with Selenium

НАШИ ИНСТРУМЕНТЫ

Selenium 1.0

Selenium 2.0 aka webDriver.

QA Club Kiev

Page 4: Functional Testing with Selenium

web browser + webDriverWeb Browser

SELENIUM 1.0 AND WEB-DRIVER

Application

TestsSelenium RC

QA Club Kiev

Page 5: Functional Testing with Selenium

ПРИМЕР НА SELENIUM 1.0public class TestSeleniumRC {

private Selenium selenium;private SeleniumServer seleniumServer;

public TestSeleniumRC(String browserType, String host) throws Exception { RemoteControlConfiguration rcc = new RemoteControlConfiguration(); this.seleniumServer = new SeleniumServer(rcc);

this.selenium = new DefaultSelenium("localhost",4444, browserType, host);}

//start Selenium public void start() throws Exception {

seleniumServer.start();System.out.println("Server is started");selenium.start();System.out.println("Client is started");}

//stop Selenium public void stop() throws Exception {

selenium.close();selenium.stop();System.out.println("Client is stopped");seleniumServer.stop();

System.out.println("Server is stopped");}

//Open firefox and perform actionspublic static void main(String[] args) throws Exception {

TestSeleniumRC rc = new TestSeleniumRC("*firefox", "http://google.com”);rc.start();rc.stop();}

}

QA Club Kiev

Page 6: Functional Testing with Selenium

ПРИМЕР НА SELENIUM 2.0.

package org.openqa.selenium.example;

import org.openqa.selenium.By;import org.openqa.selenium.WebDriver;import org.openqa.selenium.WebElement;import org.openqa.selenium.htmlunit.FirefoxDriver;

public class Example  {    public static void main(String[] args) {        // Create a new instance of the FireFox driver        // Notice that the remainder of the code relies on the interface,         // not the implementation.        WebDriver driver = new FirefoxDriver();

        // And now use this to visit Google        driver.get("http://www.google.com");

        // Find the text input element by its name        WebElement element = driver.findElement(By.name("q"));

        // Enter something to search for        element.sendKeys("Cheese!");

        // Now submit the form. WebDriver will find the form for us from the element        element.submit();

        // Check the title of the page        System.out.println("Page title is: " + driver.getTitle()); //Close the browser driver.quit();    }}

QA Club Kiev

Page 7: Functional Testing with Selenium

ОСОБЕННОСТИ SELENIUM 2.0

Некоторые новые реализации:Более быстрое выполнение тестов по сравнению с Selenium 1.0FindElementsActions();driver.manage().timouts.implicityWaits (30, TimeUnit.SECONDS) – имлпицитные ожидания.

Не реализовано:Contains не работает в css локаторах.Не реализована интеграция с Safari. Не большое количество функций

QA Club Kiev

Page 8: Functional Testing with Selenium

WORKFLOW АВТОМАТИЗАЦИИ

Автоматизируем на основе тест-кейсов.

Вдруг нашелся дефект

Разделяй и властвуй!

QA Club Kiev

Page 9: Functional Testing with Selenium

СПАСИБО ЗА ВНИМАНИЕ!

Кравченко Никита GlobalLogic, Senior Software QAE

email: [email protected]

QA Club Kiev