Test Design of native app automation

Test Objective

Test Approach

Shift-Left

Shift-left by nature prevent occurrence of bug at development stage itself, thus avoiding chances of bug-detection at a later stage.

In-sprint automation

Standard Test Practices

AAA (Arrange, Act, Assert)

  • Functions in UI Tests can have multiple assertions.
  • Having logics is acceptable in page object class if it reduces lines of code and optimizes the test code further.

F-POM (Fluent Page Object Model)

  • Contributing to simpler and readable test scripts.

Screenplay

  • Apple and Google, both encourage Large & Medium tests in UI-Test.

Red, Green, Refactor

  • Make sure the test fails when something is wrong.
  • First write the test to fail, then check if the test passes and then refactor the test.

Clean Test Code

  • Keep all test code to be simple & readable.
  • Have multiple small functions in page object class when possible.

2. DRY (Don’t Repeat Yourself)

  • If any data or line of code is found repeated anywhere during scripting, add it in well-organized reusable components.

3. Test Code Reuse

  • All generic reusable components should be organized and placed in protocols.

4. Yagni (You aren’t gonna need it)

  • Implement the simplest approach that works best.
  • Don’t commit/push any line of test code if is unused.

Distributed Parallel Testing in CI

  • Can be enabled in CI for develop/merging branches to add value.
  • Can be disabled for dev and test branches.

Components of iOS UI Test Framework

  • Test Plan ​ ​ ​​​ ​​ ​​​ ​ ​​ ​ ​​​ ​ ​​ ​ ​​​ — for easier and flexible CI test runs
  • Elements ​ ​ ​​​ ​​ ​​​ ​ ​​ ​ ​​​ ​ ​​ ​ ​​​— for easy maintainability and avoid duplication
  • Services/Objects — for placing all page object functions
  • Protocols/Extensions — for reusing only what is needed
  • Tests​ ​ ​​​ ​​ ​​​ ​ ​​ ​ ​​​ ​ ​​ ​ ​​​​ ​ ​​​ ​​ ​​​ ​ ​​ ​ ​​​ ​ ​​ ​— for placing all tests for running
  • Mock Server​ ​ ​​​ ​​ ​​​ ​ ​​ ​ ​​​— to run tests reliably & faster
  • Common

​ ​ ​​​ ​​ ​​​ ​ ​​ ​ ​​​ ​ ​​ ​ ​​​ 👉​ ​Accessibility Identifiers ​ ​ ​​​ ​​ ​​​ ​ ​​ ​ ​​​ ​ ​​ ​ ​​​— to avoid flaky tests

​ ​ ​​​ ​​ ​​​ ​ ​​ ​ ​​​ ​ ​​ ​ ​​​ 👉​ ​Test Base​ ​ ​​​ ​​ ​​​ ​ ​​ ​ ​​​ ​ ​​ ​​ ​ ​​​ ​​ ​​​ ​ ​​ ​ ​​​ ​ ​​ ​ ​​​​ ​ ​​​ ​​ ​​​ ​ ​​ ​ ​​​ ​ ​​ ​ ​​​​ ​ ​​​ ​​ ​​​ ​​​​ — for parent test class instructions

​ ​ ​​​ ​​ ​​​ ​ ​​ ​ ​​​ ​ ​​ ​ ​​​ 👉​ ​Test Data​ ​ ​​​ ​​ ​​​ ​ ​​ ​ ​​​ ​ ​​ ​ ​​​ ​ ​ ​​​ ​​ ​​​ ​ ​​ ​ ​​​ ​ ​​ ​ ​​​​ ​ ​​​ ​​ ​​​ ​ ​​ ​ ​​​ ​ ​​ ​ ​​​​ ​ ​​​ ​​— for avoiding test data duplication

Sample Projects for understanding:

IOS — XCUITest

  1. https://github.com/suparna-khamaru/Twitter-UI-Test-Automation-XCUITest
  2. https://github.com/suparna-khamaru/swift-demo-app/tree/master/brightcosmeticsUITests

Components of Espresso Android Test Framework

  • Tests — for placing all tests for running
  • Mock Server
  • Common
  • Test Base — for parent test class instructions
  • Test Data — for avoiding test data duplication

Test Result Analysis

  • Is Inbuilt and generated by XCode on every test run automatically.
  • Generates Test Result Bundle -> XCResult file after every test run.
  • Contains all information such as: Build logs, Test Result, code coverage results, test attachments (screenshots)

Android

  • Jacoco
  • Junit Report

Library/Framework Testing

  • XCode in Swift and Obj C languages using XCTest.

Visual Testing

  1. uber/ios-snapshot-test-case: Snapshot view unit tests for iOS (github.com)
  2. facebook/screenshot-tests-for-android: Generate fast deterministic screenshots during Android instrumentation tests (github.com)

Accessibility Testing

  1. Accessibility — Videos — Apple Developer

Localization Testing

I am a Principal SDE in Test, passionate about iOS, Android, Web apps,API test, Automation & ACI— https://www.linkedin.com/in/suparnakhamaru/