Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Мощь переполняет с JDI 2.0 - новая эра UI автоматизации

206 views

Published on

Доклад Романа Иовлева на SQA Days-22. 17-18 ноября 2017. Санкт-Петербург, Россия
www.sqadays.com

Published in: Education
  • Be the first to comment

  • Be the first to like this

Мощь переполняет с JDI 2.0 - новая эра UI автоматизации

  1. 1. POWER OVERWHELMING 17 NOVEMBER 2017
  2. 2. Chief QA Automation In Testing more than 12 years In Testing Automation 10 years ROMAN IOVLEV roman.Iovlev roman_iovlev@epam.com
  3. 3. 3 ? Test Automation?
  4. 4. • UI Test Framework • UI Elements oriented • Dozens of UI elements already implemented • Most of common problems already solved (e.g. stabilization) 4 JDI IS
  5. 5. • UI Test Framework • UI Elements oriented 5 JDI IS
  6. 6. • UI Test Framework • UI Elements oriented • Interfaces above engines 6 JDI IS
  7. 7. 7 JDI - CODE EXAMPLE public class Login extends Form<User> @Css(“.login”) TextField submit; @XPath(“//*[@id=‘psw’]”) TextField name; @Text(“Login”) Button login; @FindBy(xpath = “//*[*[value=‘%’]]Hello”) Menu siteNavigation; loginForm.loginAs(adminUser); siteNavigation.select(“About”);
  8. 8. 8 JDI - CODE EXAMPLE @JSite(“http://awesome.site.com”) public class AwesomeSite extends WebSite; @JPage(url=“/home”) public static HomePage page; public class HomePage extends WebPage; @Css(“.name”) public TextField name; @XPath(“//*[text()=‘%s’]”) public Menu mainMenu; … @Frame(“frameId”) public Advert advertisement; public class Advert extends Section; @FindBy(className =“pict”) public Image picture; @FindBy(css = “.descr") public Text description; Init(AwesomeSite.class);
  9. 9. • Save your time for Automation Testing • Fast on start and easy for support tests in future • Provide stable and detailed results • Platform - Flexible for any UI project 9 JDI - PROFIT Test like a boss
  10. 10. • Write test code faster up to 5 times • Average result around 2.8 times • 4.7 times speedup on the project with standard implementation • Produce less amount of test code (loc) up to 3 times • Average result around 2.1 times • 2.8 times reduction on the project with standard implementation • Achieve higher clearness of tests • Decrease of support time for test projects • Lowering of project entry barrier for newcomers • Complete projects with higher quality • Based on 70 % answers in survey 10 JDI BENEFITS
  11. 11. • Reuse investments from one Project on another • Based on 5 years of work and more than 30 projects that already use JDI • Save up to 80% test effort by migrating tests to other Platforms • Based estimated average scope reductions for all test process stages • Example: migrate Web tests to Mobile platform 11 JDI BENEFITS • Can be used any project with UI Automation • Actually we have no projects where JDI is not applicable. The only reason why not all of our projects use JDI is Client requirements • Save up to 30-40% money for testing • Based on average calculation of scope reductions for all test process stages
  12. 12. JDI 2.0 12
  13. 13. 13 NEW ARCHITECTURE WEB MOBILE DESKTOP
  14. 14. 14 NEW ARCHITECTURE • Less code for new Engines • More unification • Guideline for Engines developers • Implement list of methods with your engine • Add your engine specific features • Create list of elements (add only specific functionality)
  15. 15. 15 NEW ARCHITECTURE • Elements collections • Simple Web • Extended Web • Complex forms and tables • Shop elements • Bank / Government / Document elements …Your collections
  16. 16. • All elements and methods documentation • Simple start guideline • Cookbook: JDI features tutorial • Guideline for contributors … anything else? 16 DOCUMENTATION
  17. 17. JDI 2.0 FEATURES 17
  18. 18.  Verify layout  PageObjects generator as Library  Selenium-Selenide integration  JDI Http  JDI on Python 18 JDI 2.0 FEATURES
  19. 19. VERIFY LAYOUT 19
  20. 20. @Image(“/src/test/resources/submitbtn.png”) @FindBy(text = “Submit”) public Button submit; 20 VERIFY LAYOUT submit.isDisplayed(); submit.assertDisplayed();
  21. 21. @ImagesFolder(“/src/test/resources/imgs”) public EpamSite extends WebSite; 21 VERIFY LAYOUT @Image(“submitbtn.png”) @FindBy(text = “Submit”) public Button submit;
  22. 22. public class EpamSite extends WebSite { public static HomePage homePage; 22 VERIFY LAYOUT - DEFAULT public class HomePage extends WebPage @Text(“Submit”) public Button submit; “src/test/resources/jdi-images/epamsite/ homepage/submit.jpg”
  23. 23. 23 VERIFY LAYOUT homePage.verifyLayout() homePage.assertLayout() / homePage.checkLayout() public class HomePage extends WebPage @Text(“Submit”) Button submit; @Css(“.name”) TextField name; @XPath(“//*[text()=‘%s’]”) Menu mainMenu; @FindBy(text = “Hello”) Label label;
  24. 24. PAGE OBJECTS GENERATOR 24
  25. 25. new PageObjectsGenerator(rules, urls, output, package) .generate (); 25 PAGE OBJECTS GENERATOR LIBRARY RULES https://domain.com/ https://domain.com/login https://domain.com/shop https://domain.com/about URLS {"elements": [{ "type":"Button", "name": “value", "css": “input[type=button]" }, … ]} OUTPUT src/main/java PACKAGE com.domain
  26. 26. <input type=“button” value=“Next”> <input type=“button” value=“Previous”> <button class=“btn”>Submit</button> 26 PAGE OBJECTS GENERATOR LIBRARY "type":"Button", "name": “value", "css": “input[type=button]“ "type":"Button", "name": “text", "css": “button.btn" @Findby(css=“input[type=button][value=Next]”) public Button next; @Findby(css=“input[type=button][value=Previous]”) public Button previous; @Findby(xpath=“//button[@class=‘btn’ and text()=‘Submit’]”) public Button submit;
  27. 27. Bootstrap rules Html 5 rules KendoUI by Telerik rules … Your awesome UI framework rules 27 PAGE OBJECTS GENERATOR LIBRARY
  28. 28. 28 LOCATOR ANNOTATIONS @FindBy (model=“btn-model”) @FindBy (binding=“btn”) @FindBy (repeat=“r-button”) @FindBy (text=“Submit”) @FindBy(name=“Submit”) @FindBy(value=“Submit”) @FindBy(title=“Submit”) @FindBy(type=“Submit”) @Css(“.submit”) @XPath(“.submit”) @Tag(“button”) @Text(“Test”) @Value(“st”) @Type(“//button”) @Title(“submt-id”) Angular Selenium Special
  29. 29. SELENIUM AND SELENIDE INTEGRATION 29
  30. 30. 30 SELENIUM-SELENIDE INTEGRATION 100% 0%
  31. 31. 31 SELENIUM-SELENIDE INTEGRATION 100% 0%
  32. 32. 32 SELENIUM-SELENIDE INTEGRATION 100% 0%
  33. 33. 33 J ID 2.0
  34. 34. 34 WHAT ABOUT HTTP ?
  35. 35. 35 JDI HTTP JDI HTTP
  36. 36. @ServiceDomain("http://httpbin.org/") public class UserService { @GET("/get") static RestMethod getUser; @POST("/post") RestMethod updateSettings; @PUT("/put") RestMethod addUser; @PATCH("/patch") RestMethod patch; @DELETE("/delete") RestMethod removeUser; 36 JDI HTTP
  37. 37. @ServiceDomain("http://httpbin.org/") public class UserService { @GET("/get") static M getUser; @POST("/post") M updateSettings; @PUT("/put") M addUser; @PATCH("/patch") M patch; @DELETE("/delete") M removeUser; 37 JDI HTTP
  38. 38. UserService.addUser.call(); RestResponse resp = getUser.call(); assertEquals(resp.status, 200); assertEquals(resp.statusType, OK); assertEquals(resp.body(“name"), “Roman"); resp.assertThat(). body("url", equalTo("http://httpbin.org/get")) resp.assertThat().header("Connection", "keep-alive"); 38 JDI HTTP
  39. 39. app.addUser.send(user); User actualUser = app.getUser.asData(User.class); assertEquals(actualUser, user); 39 JDI HTTP EDT Entities @ServiceDomain ("http://httpbin.org/") public class UserService { @GET ("/get") M<User> getUser; @PUT ("/put") M<User> addUser;
  40. 40. @ServiceDomain("http://httpbin.org/") public class UserService { @ContentType(JSON) @Headers({ @Header(name = "Name", value = "Roman"), @Header(name = "Id", value = "Test") }) @GET("/get") M getUser; 40 JDI HTTP https://goo.gl/4bV36T
  41. 41. JDI PYTHON 41
  42. 42. 42 JDI PYTHON
  43. 43. 43 JDI PYTHON class AddCVForm(Form): first_name = TextField (By.css("[placeholder='First Name']")) last_name = TextField (By.css("[placeholder='Last Name']")) email = TextField (By.css("[placeholder='Email']")) country = Dropdown (root=By.css(".country-wrapper"), by_select_locator=By.css(".arrow"), … city = … cv = RFileInput (By.css(".file-upload")) comment = TextArea (By.xpath(".comment-input")) submut = Button (By.xpath("//*[.='Submit']")) cancel = Button (By.xpath("//*[.='Cancel']")) https://goo.gl/5S5nDC
  44. 44. JDI 2.0 44 http://jdi.epam.com/ https://github.com/epam/JDI https://vk.com/jdi_framework JDI

×