what s that smell tidying up our test code
play

What's That Smell? Tidying Up Our Test Code Presented - PDF document

T8 Test Automation 2019-05-02 11:15 What's That Smell? Tidying Up Our Test Code Presented by: Angie Jones


  1. ¡ ¡ ¡ ¡ ¡ T8 ¡ Test ¡Automation ¡ 2019-­‑05-­‑02 ¡11:15 ¡ ¡ ¡ ¡ ¡ ¡ ¡ What's ¡That ¡Smell? ¡Tidying ¡Up ¡Our ¡Test ¡ Code ¡ ¡ Presented ¡by: ¡ ¡ ¡ Angie ¡Jones ¡ Applitools ¡ ‘ ¡ ¡ ¡ Brought ¡to ¡you ¡by: ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ 888 -­‑-­‑-­‑ 268 -­‑-­‑-­‑ 8770 ¡ ·√·√ ¡904 -­‑-­‑-­‑ 278 -­‑-­‑-­‑ 0524 ¡-­‑ ¡info@techwell.com ¡-­‑ ¡ http://www.stareast.techwell.com/ ¡ ¡ ¡ ¡ ¡

  2. ¡ Angie ¡Jones ¡ ¡ Angie ¡Jones ¡is ¡a ¡Senior ¡Developer ¡Advocate ¡who ¡specializes ¡in ¡test ¡automation ¡ strategies ¡and ¡techniques. ¡She ¡shares ¡her ¡wealth ¡of ¡knowledge ¡by ¡speaking ¡and ¡ teaching ¡at ¡software ¡conferences ¡all ¡over ¡the ¡world, ¡as ¡well ¡as ¡writing ¡tutorials ¡and ¡ blogs ¡on ¡angiejones.tech. ¡As ¡a ¡Master ¡Inventor, ¡Angie ¡is ¡known ¡for ¡her ¡innovative ¡and ¡ out-­‑of-­‑the-­‑box ¡thinking ¡style ¡which ¡has ¡resulted ¡in ¡more ¡than ¡25 ¡patented ¡inventions ¡in ¡ the ¡US ¡and ¡China. ¡In ¡her ¡spare ¡time, ¡Angie ¡volunteers ¡with ¡Black ¡Girls ¡Code ¡to ¡teach ¡ coding ¡workshops ¡to ¡young ¡girls ¡in ¡an ¡effort ¡to ¡attract ¡more ¡women ¡and ¡minorities ¡to ¡ tech. ¡

  3. What's That Smell? What's That Smell? Tidying Up Our Test Code Tidying Up Our Test Code Angie Jones Angie Jones Senior Developer Advocate Senior Developer Advocate http://angiejones.tech http://angiejones.tech Applitools, San Francisco, CA, USA Applitools, San Francisco, CA, USA @techgirl1908 @techgirl1908

  4. @techg

  5. a CODE SMELL CODE SMELL is an implementation that is an implementation that violates fundamental design violates fundamental design principles in a way that may principles in a way that may

  6. APPLICATION APPLICATION UNDER UNDER TEST TEST @techgirl1908

  7. JAKE'S JAKE'S CODE CODE BASE BASE @techgirl1908

  8. LONG CLASS LONG CLASS The purpose of the class is The purpose of the class is multifold. multifold. To find anything, you must To find anything, you must scroll and scroll. scroll and scroll. @techgirl1908

  9. ISSUES ISSUES 1. No single responsibility 1. No single responsibility 2. Hard to find things 2. Hard to find things 3. Difficult to maintain 3. Difficult to maintain @techgirl1908

  10. SEPARATE SEPARATE CONCERNS CONCERNS @tech

  11. LONG METHOD LONG METHOD This guy does it all! This guy does it all! But it makes it hard to know But it makes it hard to know when to call. when to call. @techgirl1908

  12. ISSUES ISSUES 1. No single responsibility 1. No single responsibility 2. Confusing for callers 2. Confusing for callers 3. Difficult to read and understan 3. Difficult to read and understan @techgirl1908

  13. WE HAVE A PROBLEM! WE HAVE A PROBLEM! How come our second test How come our second test cannot utilize the search cannot utilize the search method? method? @techgirl1908

  14. SPLIT SPLIT METHODS METHODS @tech

  15. DUPLICATE CODE DUPLICATE CODE When you find yourself When you find yourself coding in haste, coding in haste, it's very tempting it's very tempting @techgirl1908

  16. ISSUES ISSUES 1. Any change needed has to 1. Any change needed has to take place in multiple spots take place in multiple spots 2. Can lead to other smells 2. Can lead to other smells @techgirl1908

  17. REMOVE REMOVE DUPLICATION DUPLICATION @tech

  18. FLAKY LOCATOR STRATEGY FLAKY LOCATOR STRATEGY At this moment, At this moment, your locators work fine. your locators work fine. But can they But can they

  19. ISSUES ISSUES 1. Fragility 1. Fragility 2. Unreliability 2. Unreliability @techgirl1908

  20. STABILIZE STABILIZE LOCATORS LOCATORS @tech

  21. INDECENT EXPOSURE INDECENT EXPOSURE � Too many see you. Too many see you. Your scope is too wide. Your scope is too wide. All who should know you All who should know you @techgirl1908

  22. ISSUES ISSUES 1. Violates encapsulation (fields) 1. Violates encapsulation (fields) 2. Allows tests to directly access 2. Allows tests to directly access and manipulate the DOM, and manipulate the DOM, which is not their responsibility which is not their responsibility

  23. NARROW NARROW SCOPE SCOPE @tech

  24. INEFFICIENT WAITS INEFFICIENT WAITS The speed of machine The speed of machine is faster than man is faster than man so you slow it down so you slow it down @techgirl1908

  25. ISSUES ISSUES 1. Slows down runtime 1. Slows down runtime 2. Different environments may 2. Different environments may require different wait times require different wait times @techgirl1908

  26. WAIT WAIT NTELLIGENTLY NTELLIGENTLY @tech

  27. ULTIPLE POINTS OF FAILUR ULTIPLE POINTS OF FAILUR The framework's job The framework's job is to force state, is to force state, not to determine not to determine @techgirl1908

  28. ISSUES ISSUES 1. Violates single responsibility 1. Violates single responsibility 2. Limits reusuability 2. Limits reusuability @techgirl1908

  29. INCREASE INCREASE FLEXIBILITY FLEXIBILITY @tech

  30. QUESTIONS? QUESTIONS? @techgirl1908

  31. What's That Smell? What's That Smell? Tidying Up Our Test Code Tidying Up Our Test Code Angie Jones Angie Jones Senior Developer Advocate Senior Developer Advocate http://angiejones.tech http://angiejones.tech Applitools, San Francisco, CA, USA Applitools, San Francisco, CA, USA @techgirl1908 @techgirl1908

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend