Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How can we improve the testability of applicati...

How can we improve the testability of applications?

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

tsuemura

May 21, 2020
Tweet

More Decks by tsuemura

Other Decks in Technology

Transcript

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

    Specialist @ Autify, Inc. Committer of CodeceptJS
  2. 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
  3. 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
  4. What's the testability? A part of software quality Leverage for

    quality improvement A basis for various tests
  5. 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
  6. 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”
  7. Functional Integration Unit Integration Unit Use Case External Integration Performance

    / Security Use Case External Integration Performance / Security UI Integration / Backend API Big Cone
  8. 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
  9. 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/#/)
  10. 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
  11. 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
  12. Reuse your automation code during a manual test $ npx

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

    preconditions Combinate those APIs with a process automation tool n8n(nodemation) (https://n8n.io/)
  14. 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/
  15. ID: not matched class: matched alter text: matched coodinate: not

    matched image source: matched .... Confidence: 80% AI for Automatability
  16. 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.