selenide – лаконичные тесты на selenium 2 webdriver + java bindings
TRANSCRIPT
Selenide – лаконичные тесты на
Selenium 2 WebDriver + Java bindings
Акулич Владислав
DPI.Solutions
Issoft / Coherent Solutions
О себе
Владислав Акулич
• IT consultant
DPI.Solutions
• QA Automation Engineer
ISsoft / Coherent Solutions
Сегодня мы поговорим о…
• UI тесты Selenium 2 WebDriver + Java
• Что такое Selenide?
• Вкусности Selenide
• С чего начать?
• Опыт и частота использования в
реальных проектах
UI тесты Selenium 2
WebDriver + Java
Что в этом коде нам не
нравится?
• Сложная инициализация
• А как же скриншоты?
• Объём кода
• Сложность кода
Раньше все эти «сложности» ложилось на
наши плечи!
Архитектура и
Инфраструктура как решение
• Использование automation patterns
• Написание Helper классов
Однако решение есть (и не
одно)!
Что же такое Selenide?
Selenide — это прозрачная обёртка
вокруг Selenium WebDriver, не мешающая
опуститься до уровня голого Driver-а,
позволяющая быстро и просто использовать
все возможности Selenium при разработке
тестов, сосредоточившись на логике, а не
суете с браузером + целый ряд
дополнительных возможностей.
Простой тест с Selenide
Инициализация браузера с
помощью Selenium 2
WebDriver
Инициализация браузера с
помощью Selenide
«Свойства»: Url, title и page
source
• Selenium
• Selenide
Поиск элементов
• Selenium
• Selenide
Selenium & Radio buttons
Selenide & Radio buttons
Asserts
• Selenium
• Selenide
Alerts
• Selenium
• Selenide
Selenium & Ajax
Selenide & Ajax
Готов! Хочу начать?
• Добавить dependency
• Импортировать пару классов
Что дальше?
Пиши … тесты!
Почему «Selenide»?
Библиотека Selenium взяла своё
название от химического элемента (Селен).
А селениды — это соединения селена с
другими элементами
• Selenide = Selenium + ScalaTest
• Selenide = Selenium + Junit
• Selenide = Selenium + TestNG
• Selenide = Selenium + что угодно
Плюсы Selenide
• Лаконичный API
• Улучшение работы с Ajax
• Большое количество готовых ожиданий
• Упрощение работы с браузером
• Автоматические скриншоты при падении
тестов
Применение на реальных
проектах
• Наш опыт
• Опыт разработчиков Selenide
http://selenide.org/2013/04/23/what-is-
selenide/
Customer Case Study: A
Project
• Type: Web application
• Category: Protected network monitoring system
• Technologies: HTML, CSS, Javascript, JQuery
• Stage: Updating the functionality of the application
• Automation scope: Performance testing, functional testing
Challenge
• Existing automation solution didn’t provide opportunity to fully test functionality and performance of the highly secure web application
• Provide suggestions for performance improvement of highly loaded application
• Working with image-recognition for part of the functionality
Automation technology stack
• Selenium WebDriver (Java bindings)
• Selenide
• Sikuli-API
• BrowserMob Proxy
• HAR-Storage
• JMeter
Solution
• Performance: The usage of BrowserMob Proxy allowed to
use the same architecture and similar to functional scenarios
to test performance as well as functionality
• This stack also provided the opportunity to generate JMeter
scenarios from client-side performance tests for free
• Suggestions: HAR-storage together with BrowserMob Proxy
provided easy-to-interpret statistics and data for developing
suggestions for performance improvement
• Image-recognition: Sikuli-API perfectly solving the problem
Project A: Webdriver(Java) +
SelenideProject Page Object
Test
Customer Case Study: B
Solution
• Cross-platform: more than 60 tests that are run both on IOS
and Android app
• Maintainability: using UI Map, static Page Object design
patters and selenide for better readability and support
• Different platforms: Selendroid supports wide range of
Android versions
Project
• Type: Android Mobile App
• Category: Healthcare
• Technologies: PhoneGap, Sencha Touch
• Stage: Initial development
• Automation scope: Functional testing
Challenge
• Tests that are easy to tweak and support
• Ability to execute on real devices and different platform versions
Automation technology stack
• Selendroid (Java bindings) as automation tool
• TestNG as test framework
• Selenide as Selenium wrapper
• Git as source control
• Maven as build tool
• Jenkins as CI tool
Project B: Selendroid (Java) +
SelenideProject Page Object
Test
Customer Case Study: C
Solution
• ExtJS: using ExtJS API for locating elements and Selenide
for dealing with AJAX timings
• Cross-browser: Selenium Webdriver as browser driver tool
• Devices: executing large number of tests in different
browsers with help of Jenkins and Sauce Labs cloud
• Emails: Guerrilla Mail API
Project
• Type: Web app
• Category: Online Shopping platform
• Technologies: Java EE, Ext.js
• Stage: Mid-development, existing manual test cases
• Automation scope: Functional testing
Challenge
• Deal with dynamic locators and frequent AJAX calls
• Test in many browsers
• Ability to scale testing effectively
• Automate file upload and testing emails
Automation technology stack
• Selenium Webdriver (Java bindings)
• Selenium Grid for distributed execution
• Selenide as AJAX helper
• JUnit as test framework
• Git as source control
• Jenkins as CI
• Sauce labs cloud for scaling test execution
• Allure as reporting framework
Project C: Webdriver(Java) +
SelenideProject
Page Object
Test
Спасибо! Вопросы!
Владислав Акулич
DPI.Solutions
www.dpi.solutions
Belarus QA Automation
Community
www.comaqa.by