roman iovlev battle - typified or not tepified elements jdi vs selenide - heisenbug
TRANSCRIPT
QA Battle ofAutomation Approaches
Элементы с типизацией (JDI)vs. элементы без типизации (Selenide)
Roman Iovlev Alexei Vinogradov
Chief QA AutomationIn Testing more than 11 yearsIn Testing Automation 9 years
ROMAN IOVLEV
Alexei VinogradovIT-Kонсультант
тестирование, управление тестированием, автоматизация в тестировании, коучинг
15+ лет в IT, докладчик SQA Days / Codefest / QA Fest
Студент-практикант -> Программист -> Тестировщик ->…
TYPIFIED ELEMENTS
10 DEC 2016
TYPIFIED ELEMENTS VS SUPER ELEMENT
6
VS
WebElementSelenideElement
SIMPLE BUT…
6
$(“#submit”).click();
$(“#submit”).click();
$(“#submit”).click();
$(“#submit”).click();
$(“#submit”).click();
$(“#submit”).click();
$(“#submit”).click();
$(“#submit”).click();
private SelenideElement colorsArrow = $(“#color-arrow“);private List<SelenideElement> colorsValues = $$(“#colors li“);private SelenideElement colorsValue = $(“#colors“);
public void selectColor(String color) { colorsArrow.click(); colorsValues.filter(text(color)).first().click();}public String getColor() { colorsValue.text();}
private SelenideElement submitButton= $(“.submit”)
3 DROPDOWNS
6
private SelenideElement colorsArrow = $(“#color-arrow“);private List<SelenideElement> colorsValues = $$(“#colors li“);private SelenideElement colorsValue = $(“#colors“);private SelenideElement typesArrow = $(“#type-arrow“);private List<SelenideElement> typesValues = $$(“#types li“);private SelenideElement typesValue = $(“# types“);private SelenideElement shapesArrow = $(“#shape-arrow“);private List<SelenideElement> shapesValues = $$(“#shapes li“);private SelenideElement shapesValue = $(“#shapes “);
public void selectColor(String color) { colorsArrow.click(); colorsValues.filter(text(color)).first().click();}public String getColor() { colorsValue.text();}public void selectType(String type) { typesArrow.click(); typesValues.filter(text(type)).first().click();}public String getType() { typesValue.text();}public void selectShape(String shape) { shapesArrow.click(); shapesValues.filter(text(shape)).first().click();}public String getShape() { shapesValue.text();}
SO OBVIOUS
6
@JDropdown(expand= “#color-arrow“ list = “#colors li" value = “#colors")public Dropdown colors;
@JDropdown(expand= “#type-arrow“ list = “#types li" value = “#types")public Dropdown types;
@JDropdown(expand= “#shape-arrow“ list = “#shapes li" value = “#shapes")public Dropdown shapes;
• Десятки элементов (> 30 элементов)
• Сотни методов (в ITable > 100)
Actions
Control
ControlBusiness
SIMPLE BUT…
6
open(“http://my.site.com”);
homePage.open();
open(“http://my.site.com”);open(“http://my.site.com”);
public class HomePage { public void open() { open(“http://my.site.com”); } …}
open(“http://my.site.com”);
SAVINGS
6
1. Save your time2. Save your Client money3. Get tests with more quality4. Do more interesting things
SHORT & OBVIOUS
5
public class Filter { public WebElement submitButton; public WebElement followMeLink; public WebElement navigation; public WebElement colors; public WebElement areas; public WebElement settings; public WebElement tags; public WebElement shirtSizes; public WebElement vote; public WebElement rating;
}
public class Filter { public Button submit; public Link followMe; public Menu navigation; public Dropdown colors; public Tabs areas; public Checklist settings; public ComboBox tags; public DropList shirtSizes; public Selector vote; public RadioButtons rating;
}
public class Filter { public _ submitButton; public _ followMeLink; public _ navigation; public _ colors; public _ areas; public _ settings; public _ tags; public _ shirtSizes; public _ vote; public _ rating;
}
public class Filter { public SelenideElement submitButton; public SelenideElement followMeLink; public SelenideElement navigation; public SelenideElement colors; public SelenideElement areas; public SelenideElement settings; public SelenideElement tags; public SelenideElement shirtSizes; public SelenideElement vote; public SelenideElement rating;
}
click()
isDisplayed()
is()
sendKeys()
attr()
shouldHave()
should()
getLocation()
find()
findElement()
getText()
getCoordinates()
$()
$$()
append()
clickContext()
closest()
…
ONLY USABLE ACTIONS
5
Button submitButton. click()getText()
SelenideElement submitButton.
LOGS & REPORTING
5
Click on Login Button Get Row with “Type=Approved” from Products Table Select “Blue” in Color Dropdown Login with “CorrectUser” …
WORK WITH OBJECTS
5
• registerForm.save(vipClient);• searchForm.find(product);• List<Product> products = products.entities(p -> p.Type == “shoes”);• Card products = cards.entity(c -> c.Status == APPROVED && c.Name.contains(“Duke”));• …ITable products;ITable cards;
EntityDrivenTesting
WIND OF CHANGE
3
• Fast writing one test• Small projects (< 4 months)• Selenide is better engine
than Selenium but still an engine layer
• Fast writing bunch of tests• Midle-Large projects (> 6 months)• JDI is an UI Automation
Framework and represents Application/Business layer
PLATO'S THEORY OF FORMS
5
No application but you can write UI Objects (Page Objects )
IButton
INTERFACES
5
IButton submit;IDropdown cities;ITable products;
MapInterfaceToElement.update( new Object[][]{ { IDropDown.class, MyDropDown.class}, { IButton.class, MyButton.class}, { ITable.class, CustomTable.class} });
EVERYBODY DO IT
6
1. Save a lot of time - money2. More obvious test scenarios, page objects,
logs, reports – easier develop & support3. Operate with real business Objects4. Write UI Objects (Page Objects) without app5. Easier scenarios reusage on different platforms
20
WEB TESTING 2.0
PageObjects
Smoke Tests
BE LAZY
6
22
PLANS
23
23
CONTACTS
HTTP://JDI.EPAM.COM/HTTPS://VK.COM/JDI_FRAMEWORK
https://github.com/epam/JDI
INFO CONTACTS