20170302 tryswift tasting_tests

57
Tasting tests at Cookpad by @Kazu_cocoa for Try!SwiftTokyo

Upload: kazuaki-matsuo

Post on 12-Apr-2017

2.350 views

Category:

Software


0 download

TRANSCRIPT

Tasting tests at Cookpadby @Kazu_cocoa

for Try!SwiftTokyo

Kazuaki Matsuo( @Kazu_cocoa) : Cookpad Inc.

Test Engineer / Software Engineer in Quality Lang: / / /

Maintainer: Appium Ruby binding

😋

A bunch of themes in tests

Test Level Focus on UI Tests

How UI Tests support our development

We should know about the test target

🍽

What is Cookpad?

https://www.similarweb.com/top-websites/category/food-and-drink/cooking-and-recipes

Cookpad for iOS(Japan and Global)

35 million users (include Web/mobile)

63 million users (include Web/mobile)

4Q and Full Year 2016 Results / https://cf.cpcdn.com/info/assets/wp-content/uploads/20170214121206/2016Q4en.pdf

Cookpad for iOS(Japan)

35 million users (include Web/mobile)

63 million users (include Web/mobile)

The app has been developed for a long time

How often Cookpad app changes

Release cycle: 2weeks ~ 1month Code changes: 5,000 ~ 10,000 lines

UI changes: Frequently(large or small)

kano-model and Japan market

Must-be

Attractive

Diachronic Quality for Mobile

take a break 🍵

Cookpad iOS app has been developed so long time.

Must-be quality in Japan is high, especially crash free rate.

🍽🥗

Tasting how re-engineering the app with UI Tests😋🍴

We’ve been developed UI Tests for mobile since 2014

Why have we implemented this UI tests?🤔

Should we taste from?

Writing unit tests before refactoring is sometimes impossible and often pointless.

Re-Engineering Legacy Software

Basic strategy

👪from

Internalfrom

External

Make checkable from external to internal

Unit Tests

UI Tests

re-write/re-factor

Make checkable from external to internal

Unit Tests

UI Tests

re-write/re-factor

External

Make checkable from external to internal

Unit Tests

UI Tests

re-write/re-factor

Internal

Make checkable from external to internal

Unit Tests

UI Tests

re-write/re-factor

External

Make checkable from external to internal

Unit Tests

UI Tests

re-write/re-factor

Unit tests for Re-Engineering

Most developers would agree that unit test should be fully automated,

Re-Engineering Legacy Software

Unit tests are not a silver bullet

but the level of automation for other kind of tests(such as integration tests) is often much

lower.

Re-Engineering Legacy Software

UI Test should be automated

One area that cries out for automation is UI testing.

Re-Engineering Legacy Software

Test Pyramid

UI Tests

Integration Tests

Unit Tests

Manual Testing

Flipped pyramid make development cycle slow

Unit Tests

UI Tests

Manual Testing

Integration Tests

Flipped pyramid make development cycle slow

Unit Tests

UI Tests

Manual Testing

Integration Teststhe largest area to check the app

Flipped again

UI Tests

Integration Tests

Manual Testing

Unit Tests

🔀Unit Tests

UI Tests

Manual Testing

Integration Tests

Conduct tests for combinations

8.0 8.1 8.2 8.3 8.4 9.0 9.1 9.2 9.3 10.0

iPhone ● ● ● ● ● ● ●

iPad ● ● ●

iPad Pro ●

Automated UI Tests help Re-Engineering

2015/3 2017/2

implement the strategy

We’ve been developed UI Tests since 2014

Architecture for UI Tests

Scenarios steps wrapper Appium Binding

Focus on User Scenario

Convert scenarios to Ruby code

Appium/other utils Focus on iOS side

👪

Scenarios with data-driven testing

feature: A user can search several words via search field background: given Conduct tests with ‘iPhone’ device

scenario_outline: Users can see search results

when I login with <user_status> when I search <search_words> via search fields then I swipe down ‘3’ times then I can see ‘xxx’ on the display

example: | user_status | search_words | | 'ps' | 'sushi' | | 'non-ps' | '🍣' | | 'guest' | 'sukiyaki' |

steps/wrapper/bindings

step "Conduct tests with :device device" do |device| start_device(device) end

def start_device(device) driver_start_with(desired_capabilities: des_app_caps, server_caps: des_server_caps) set_location(DEFAULT_LOCATION) close_initial_information(device) end

🍛Seasoning🍲

Reduce dependency from internal product code

find_element :xpath, “//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]”

Reduce dependency from internal product code

find_element :xpath, “//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]”

Strongly depends on view structures

Reduce dependency from internal product code

find_element :xpath, “//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]”

find_element :accessibility_id, “an arbitrary identifier”⭕

Don't conduct tests for all boundaries

in UI Tests

more 🍛🌶

image diffe.g. Broken the order of Allow/Cancel button

image diffe.g. Broken the order of Allow/Cancel button

Request counts

Request counts

Re-Engineering re-write/re-factor without fear

for developers

introduce Swift

faster🚴 and more stable

Conclusion

Quality, Environment and Services change frequently in Mobile

UI Tests support Re-Engineering

🍽🥗🍛🍲

Do you get motivations to challenge

automated UI Tests? 🙌

Don’t forget this kind of challenges can’t do

in developer’s spare time

🍝 ≠ 🍜

Thanks for listening😋