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

How to create an automated test suite for the C...

katryo
March 28, 2017

How to create an automated test suite for the Chromium based app and the Unity app

Testing, E2E test, Selenium, Appium, Selenium-Unity-Driver

katryo

March 28, 2017
Tweet

More Decks by katryo

Other Decks in Programming

Transcript

  1. How to create an
 automated test suite for the
 Chromium

    based app and the Unity app Ryo Kato SWET, DeNA
  2. Ryo Kato @katryo DeNA CO., Ltd. Software Engineer / Test

    Engineer SWET Group SoftWare Engineer in Test
  3. • DeNA’s new service (released in 2016) • Video game

    platform for PCs. • Runs on Windows • The games are made of Unity, Unreal Engine, etc. • AndApp client is made with Chromium What is AndApp? http://www.andapp.jp/
  4. We can assist you AndApp
 dev team Me I have

    never developed an E2E test for native apps One day…
  5. Our goal Create a software test suite about payment
 for

    AndApp The payment is done on the combination of AndApp client and the Unity app
  6. How users purchase an item I want to purchase this

    item ! Game window Before the payment Made with Unity
  7. Game window Credit card form window appears Inputting my credit

    card number… Made with Chromium How users purchase an item
  8. I have purchased the item! Game window The window
 disappears

    After the payment How users purchase an item
  9. 1. The user starts the game app (Unity) 2. He/she

    pushes the purchase button on the game app 3. Credit card form window (AndApp client) opens 4. He/she inputs credit card number on the AndApp client Control the Unity app Control the AndApp client How users purchase an item
  10. Control the Chromium based app
 and the Unity apps
 on

    Windows !?
 I had never done such a task
  11. But we finally managed to develop a
 test suite for

    the Chromium based app
 and the Unity app!
  12. How to control Chromium-based apps Off course you can use

    Selenium to control Chromium apps. ⭕
  13. Controlling Unity app with Appium • You can control Unity

    apps with Appium • Microsoft provides WinAppDriver for Appium ⭕ Appium
 with WinAppDriver
  14. Problem about controlling the Unity app • Appium does not

    offer any way to identify an element. • You can click the point at (x:100, y:200) using Appium, but you cannot click the button by specifying the ID. • (Appium fork, Selenium-Unity-Driver offers the way to identify element on Unity app, but it is not available for Windows apps.) Click the button 
 with id: “ok” ! Click the button
 at the point of (x: 100, y: 200) ! ⭕ ❌
  15. Confusion between two apps • You cannot identify an element

    on the Unity app. • But you can identify an element on the Chromium based app Controlling different apps is too confusing!
  16. Solution for the confusion between two apps We implemented the

    same interface for the Chromium based app and the Unity app using Polymorphism
  17. Complicated procedures • We have to control multiple apps at

    the same time • AndApp client has multiple windows • Multiple window multiple app testing is more difficult than browser testing
  18. Screenplay pattern •A design pattern for E2E tests
 using Page,

    Actor, Ability, Task, Action, and Question. •Useful for complicated web app tests •I learned a lot from screenplay pattern! •We did not adopt whole the features
  19. We adopted some parts of screenplay pattern • Our framework

    uses Task, Action, and Page. • Our framework does not use Actor, Ability, and Question because they are not suitable for our test cases. • Our framework uses Operation that the screenplay pattern does not use. • We used RSpec, but other testing frameworks are also okay Task Action Page Task is made up of actions Action interacts with a page Operation Operation is made up of tasks
  20. Page classes have
 instance methods
 that represent elements
 on the

    page card_number_input confirm_button Page class
  21. You can define a task with a series of ACTIONS

    connecting actions with dots using method chain Task class
  22. Unstable tests When AndApp client dev team changed the client’s

    behavior, 
 payment dev team’s test fails. Payment
 dev team AndApp client
 dev team We changed the behaviour of AndApp client. Hey, our test failed
 because of other team’s
 development! AndApp is developed under multiple teams,
 so it is almost impossible to follow the changes made by other teams.
  23. When a test fails… We have to identify the reason

    and fix it.
 However, identifying the reason of the failure is not an easy task We started recording AndApp client’s and the Unity app’s logs, but it was not very useful enough to identify the reason.
  24. Solution for identifying the reasons for the failures We started

    recording videos that capture the screen of the Windows machine From the video,
 I found that
 AndApp clinent’s 
 UI has been changed
 and this is the reason for the failure!
  25. How it works 1. Jenkins job starts 2. It starts

    recording when each test case begins,
 it finishes recording when the test case finishes. 3. After the tests, it uploads all the video files
 to the shared storage 4. It notify us
 with Slack
  26. Sum up • We Used Selenium for the Chromium based

    app, Appium for the Unity app • We implemented the same interface methods using polymorphism • We developed the test framework adopting some features from screenplay pattern • We started recording the video to identify the reasons for failures