FEEL THE POWER OF THE JDI LIGHT JDI LIGHT 22 MARCH 2019
JDI EvangelistAlmost 14 years in TestingMore than 12 years in Test Automation ROMAN IOVLEV Chief QA Automation roman.Iovlev roman.Iovlev.jdi@gmail.com 2 http://roman-iovlev.info/
JDI FRAMEWORK JDI LightSimple to use test Automation FrameworkBased on UI Elements (Buttons, Forms etc.)Fast and stable tests executionUser friendly logs and reports with no effort [since 2015] JDNSimple and modern Page Objects Generator JDI DarkWeb Services testing Framework powered by Rest Assured 3 JDI MobileUI Test Framework for Mobile JDI DesktopUI Test Framework for Desktop
PAGE OBJECTS 4 HeaderMain Section MenuOdd Radio buttonsWeather Multiselect Name TextfieldPassport checkboxDescription textarea Composite Complex Simple
UI PAGE OBJECTS @JSite( “https://epam.github.io/JDI/ ")public class EpamSite { @Url ("/index.html”) public static HomePage homepage; public static ContactPage contactPage;} @Url("/contact/%s”) @Title(“Contact Form")public class ContactPage extends WebPage { @FindBy(id=“#Name”) public TextField name; @Css(“#LastName”) public TextField lastName; @UI(“[‘Submit’]”) public Button submit;} @BeforeSuite(alwaysRun = true)public static void setUp() { initElements(EpamGithubSite.class);} open()back()/ forward()refresh()/ reload()clearCache()/ addCookie()String getHtml()zoom(double factor) 5
UI ELEMENTS 6 public class LoginForm extends Form<User> { TextField login, password; Button enter;} @FindBy(id = “jdi-logo”)public static Image jdiLogo; @Css(“#colors”) public Dropdown colors @XPath(“//*[@id=‘nav’][text=‘%s’]”) public Menu navigation; @UI(“#nav[‘%s’]”) public Menu navigation;
HTML ELEMENTS HTML elements packBootstrap elementsAngular collectionsReact collectionsVue collectionsTelerik (KendoUI) https://epam.github.io/JDI/html5.html 7
LIST OF SECTIONS 8 List<Section> = Elements in JDI T get(String name/int index)MapArray<String, T> getMap()List<E> asData(Class<E> entityClass) Get Section by name/indexGet all elements as MapGet All elements as List of Sections public class SearchResult extends Section {@Title public WebElement label; public WebElement link;public WebElement description; } 8
LIST OF SECTIONS EXAMPLES @UI(“.g”) List<SearchResult> results; Assert.assertContains(results.get(5).description.getText(), “JDI some text”); results.get(“EPAM JDI”).link.click(); results.assertThat().value(expetedValue);results.assertThat().any(e -> e.name.toLowerCase().contains(“epam jdi"));results.assertThat().each(e -> e.name.toLowerCase().contains("jdi")) || e.description.contains(“jdi"));results.assertThat().onlyOne(e -> e.name.contains("EPAM JDI"));results.assertThat().noOne(e -> e.name.contains("SELENIDE")); 9
ELEMENT ASSERTS redButton.assertThat().text(is(“Submit”));notification.is().displayed();teaser.assertThat().text(containsString(“JDI is Awesome")) .cssClass(is(“jdi-teaser")).attr("type", is(“submit"));results.is().notEmpty();results.assertThat().values(hasItem(“JDI")); Powered by Hamcrest No more waits!Compare to Selenide and Selenium asserts 10
NO PAGE OBJECTS STYLE @Testpublic void nonPageObjectTest() { WebPage.openUrl("https://epam.github.io/JDI/index.html"); $("img#user-icon").click(); $("form #name").input("epam"); $("form #password").input("1234"); $("form [type=submit]").click(); Assert.assertEquals(WebPage.getUrl(), "https://epam.github.io/JDI/index.html");} 11
REDUCE AMOUNT OF CODE IN 5-30 TIMES 1