View
1.456
Download
4
Category
Preview:
Citation preview
ФУНКЦИОНАЛЬНОЕ ТЕСТИРОВАНИЕ С ИСПОЛЬЗОВАНИЕМ SELENIUM.
QA Club Kiev
ФУНКЦИОНАЛЬНОЕ ТЕСТИРОВАНИЕ
Функциональное тестирование — это тестирование ПО в целях проверки реализуемости функциональных требований, то есть способности ПО в определённых условиях решать задачи, нужные пользователям (© Wiki).
Можно ли автоматизировать? Когда автоматизировать? Варианты.
Можно и нужно!
• Когда начинается регрессионный цикл. Да? Нет!• При завершении каждой истории. • Когда уже не разрабатывается новая
функциональность.
QA Club Kiev
НАШИ ИНСТРУМЕНТЫ
Selenium 1.0
Selenium 2.0 aka webDriver.
QA Club Kiev
web browser + webDriverWeb Browser
SELENIUM 1.0 AND WEB-DRIVER
Application
TestsSelenium RC
QA Club Kiev
ПРИМЕР НА 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
ПРИМЕР НА 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
ОСОБЕННОСТИ SELENIUM 2.0
Некоторые новые реализации:Более быстрое выполнение тестов по сравнению с Selenium 1.0FindElementsActions();driver.manage().timouts.implicityWaits (30, TimeUnit.SECONDS) – имлпицитные ожидания.
Не реализовано:Contains не работает в css локаторах.Не реализована интеграция с Safari. Не большое количество функций
QA Club Kiev
WORKFLOW АВТОМАТИЗАЦИИ
Автоматизируем на основе тест-кейсов.
Вдруг нашелся дефект
Разделяй и властвуй!
QA Club Kiev
СПАСИБО ЗА ВНИМАНИЕ!
Кравченко Никита GlobalLogic, Senior Software QAE
email: mykyta.kravchenko@globallogic.com
QA Club Kiev
Recommended