JavaOne – Java Test Automation for REST, Web and Mobile

“Java Test Automation for REST, Web and Mobile”

Speaker: Edson Yanaga & Elias Nogueira

Code had

For more blog posts from JavaOne, see the table of contents

Toolbox for testing

  1. Test real REST Service – intermediate validation between back and front end
  2. Test mock REST service – so can guarantee stability during test cycles
  3. Test mobile UI – functional and acceptance tests
  4. Test Web UI – functional and acceptance tests

Test REST web service

  • Just as important as UI
  • Swagger – REST API documentation
  • Use curl or PostMan to manually validate before trying to automate. Postman provides a UI for running REST calls.

Mock REST web service

  • Spark – microframework for Java 8
  • Good discussion of why record/replay shouldn’t be the only tool for testers
  • Spark is a call to get (or the appropriate verb) method taking params for the URL and then a lambda for request/response logic
  • Rest Assured for testing – can integrate with Spark. Fluent API style

Test Web UI

  • Selenium for in browser testing.
  • Nobody in the room is using Selenium IDE. [good that everyone using it is on RC!]
  • Selenium uses a browser specific executable file
  • Workflow – Navigation, Integration (find a web element), Manipulation (click/update text), Synchronization (wait for dynamic elements/async request)
  • Chrome gives a warning that automated software opened the window [that’s awesome! you know it isn’t malicious if you did it and you know which isn’t your interactive session]

Test mobile UI

  • Appium uses same API/DSL as Selenium.
  • Can run Appium test on real device or emulator
  • Workflow – Desired Capabilities (ex: size), Session (start session), Interrogation/Manipulation, Synchronization

Best practices

  • Test against server, not just your machine
  • Use software to change the internet speed
  • Use page objects so test scripts are modular
  • Avoid XPATH
  • For mobile, have scripts for both fresh and pre-installed apps

My take: Good end to the day. It was nice to see a bunch of tools in a short time both on slides and with demos/live coding of each. The presenters were one tester and one developer creating a bunch of jokes back and forth.


Leave a Reply

Your email address will not be published.