How can we improve the testability of applications?

How can we improve the testability of applications?

OnlineTestConf 2020 Spring
https://www.onlinetestconf.com/

Ea9506ab742ba01d1bea53af6f5649b7?s=128

tsuemura

May 21, 2020
Tweet

Transcript

  1. None
  2. Self Introduction Takuya Suemura Software Developer / Tester Test Automation

    Specialist @ Autify, Inc. Committer of CodeceptJS
  3. None
  4. Features Record & Playback Self Healing Parallel Execution Cross-Browser Compatibility

    Test
  5. Agenda About Testability and why we need it Adding new

    small test into the low testability code Building a stable product with high testability How to make more testable an app on the E2E level
  6. Developing vs Testing There is a tendency to focus on

    small details during development: Incomplete logic Effect on other components DB becomes locked for a long period Cannot think about what will bring great value to the user Testing is an effective approach for various concerns, big and small
  7. Testing Small Concern Using Complex UI

  8. TESTABILITY

  9. Testing Small Concern Using Complex UI ...it means the system

    has low testability
  10. What's the testability? A part of software quality Leverage for

    quality improvement A basis for various tests
  11. Difficulity of E2E Automation

  12. Difficulity of E2E Automation Limited operating point – everything needs

    to be operated through UI Functions cannot be split – cannot split functions which is not useful for the user
  13. Ice Cream Cone

  14. Test Pyramid And Ice Cream Cone

  15. Why does this icecream occur? Lack of understanding of testing

    Doesn’t know testing other than acceptance testing “Unit test? What is that? Can you eat it?” Misunderstanding of refactoring Starts off prioritizing implementation without any automated testing “We can just refactor it later, right? :D”
  16. Icecream = Value of product

  17. Functional Integration Unit Integration Unit Use Case External Integration Performance

    / Security Use Case External Integration Performance / Security UI Integration / Backend API Big Cone
  18. Example: A simple new user registration form 1. Display an

    error if a required field is empty 2. Display an error if the email address does not contain “@” 3. [Submit] button cannot be clicked if there is an error 4. Email addresses that are already registered cannot be registered 5. Registration is complete when the user clicks the link in the new registration email
  19. Separating the client and the server- side

  20. Does UI testing always need a real backend? https://unsplash.com/photos/xGtHjC_QNJM

  21. UI Integration Test Use lightweight & flexible browser automation tool

    Puppeteer(https://pptr.dev/) Cypress(https://www.cypress.io/) Use mock instead of the real backend MockServer(https://www.mock-server.com/) PollyJS(https://netflix.github.io/pollyjs/#/)
  22. Feature('mock'); Scenario('Interrupt suggestion', (I) => { I.amOnPage('https://www.google.com/') I.mockRequest('GET', 'https://www.google.com/complete/search?*', 404)

    I.fillField('.gLFyf.gsfi', 'OnlineTestConf') });
  23. Testing backend APIs public function testBasicExample() { $response = $this->withHeaders([

    'X-Header' => 'Value', ])->json('POST', '/user', ['name' => 'Sally']); $response ->assertStatus(201) ->assertJson([ 'created' => true, ]); } https://laravel.com/docs/7.x/http-tests
  24. Other tools for testing backend APIs Karate(https://github.com/intuit/karate) Tavern(https://github.com/taverntesting/tavern) Postman(https://www.postman.com/)

  25. Cone To Cup Integration Unit Use Case External Integration Performance

    / Security UI Component / Backend API Integration Unit Use Case External Integration Performance / Security UI Integration / Backend API
  26. Use Architectures https://en.wikipedia.org/wiki/Model–view– viewmodel

  27. Testing UI Component

  28. Get More Icecream https://unsplash.com/photos/Wpg3Qm0zaGk

  29. Efficiently create test data from UI Using Record & Playback

    Tool WildFire iMacros
  30. Reuse your automation code during a manual test $ npx

    codeceptjs shell I.loginAs('admin') I.addAllItemToCart() I.proceedOrder()
  31. Automate test preparation Add APIs for preparing test data &

    preconditions Combinate those APIs with a process automation tool n8n(nodemation) (https://n8n.io/)
  32. Testing EMail & SMS Mail MailCatcher(https://mailcatcher.me/) MailHog(https://github.com/mailhog/MailHog) MailTrap(https://mailtrap.io/) Mail &

    SMS Mailosaur(https://mailosaur.com/)
  33. Automatability for E2E Testing https://unsplash.com/photos/FTfjMijq-Ws

  34. Semantic Locator I.FillField('Username', 'takuyasuemura') I.FillField('Email', 'takuya@autify.com') I.FillField('Password', 'P@ssword') I.click('Sign up

    for GitHub') https://github.com/
  35. Utilize the meaning within a structure const modal = label

    => locate('.modal').withText(label) within(modal('Modal title'), () => { I.see('Modal body text goes here.') I.click('Save changes') }) https://getbootstrap.com/docs/4.0/components/modal/
  36. Using Multiple Locators Selenium IDE's fallback locator

  37. ID: not matched class: matched alter text: matched coodinate: not

    matched image source: matched .... Confidence: 80% AI for Automatability
  38. Why we need to improve the testability?

  39. To assure the value for customers https://unsplash.com/photos/oqStl2L5oxI

  40. Conclusion: Larger cup, more icecream Have more tests focusing on

    targeted concern by effectively using the existing interface and mock. Remake applications protected by the test so that they are even easier to test. Maximize the product’s appeal by testing products high in internal quality.
  41. Enjoy Testing!