Continuous Delivery for Native Apps 16...

57
Continuous delivery for native apps Niels Frydenholm, ebay Classifieds

Transcript of Continuous Delivery for Native Apps 16...

Page 1: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Continuous delivery for native apps

Niels Frydenholm, ebay Classifieds

Page 2: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery
Page 3: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Continuous delivery

3

Page 4: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Continuous delivery

Being able to build a release-ready binary at any given time.

3

Page 5: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

ebay Classifieds, Denmark

4

Page 6: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

ebay Classifieds, Denmark

• Native apps – DBA – BilBasen

4

Page 7: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Tools that support multiple platforms

5

Page 8: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Branches, build and distribution

Page 9: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Feature branches

7

Page 10: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Jenkins jobs pr. branch

8

Page 11: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Jenkins jobs pr. branch

8

Page 12: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Jenkins jobs pr. branch

8

Page 13: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Jenkins jobs pr. branch - configuration

9

• Plugin: http://entagen.github.io/jenkins-build-per-branch/

Page 14: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Jenkins jobs pr. branch - configuration

9

• Plugin: http://entagen.github.io/jenkins-build-per-branch/

Page 15: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Jenkins jobs pr. branch - configuration

9

• Plugin: http://entagen.github.io/jenkins-build-per-branch/

Page 16: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Hockey app distribution pr. branch

• A new app is created for each feature branch – Easy manuel testing on devices – UX verification

• Deleted again together with the branch – Hockey app does not get cluttered

10

Page 17: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Tests

Page 18: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Prerequisites

• Required – Stable test environment(s) – Good test data

12

Page 19: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Prerequisites

• Required – Stable test environment(s) – Good test data

• Optional (but a very good idea) – Ways to setup data to a given state • E.g trigger something normally done in a batch job

12

Page 20: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Different kind of tests

13

Page 21: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Different kind of tests

13

Unit testsLike all other platforms - super fast, and an easy way to tests all objects in isolation

Page 22: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Different kind of tests

13

Unit testsLike all other platforms - super fast, and an easy way to tests all objects in isolation

Integration testsTest of backend api´s from the app code - verifying json, mapping to the model, error codes etc.

Page 23: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Different kind of tests

Cucumber / Calabash - user scenarios to verify app from end-to-end

13

UI tests

Unit testsLike all other platforms - super fast, and an easy way to tests all objects in isolation

Integration testsTest of backend api´s from the app code - verifying json, mapping to the model, error codes etc.

Page 24: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Cucumber / Calabash

14

Page 25: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Example

15

Scenario: I can only send a valid report of a listing once Given I am logged in as "UniqueSeller" using quick login And I am on the VIP for "iPhone" When I go to report listing And I try to send the report Then I see the validation error for "Årsag, Beskriv din anmeldelse"

When I close the system message view And I select report listing cause "Annoncen er ulovlig" And I set report description text to "Den er billigere end min!" And I send the report Then I see the report listing VIP

When I close the system message view And I touch the report listing button Then I am informed that I already has reported the listing

Page 26: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

X-platform UI tests

16

Feature

Scenario

Step

Page 27: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

X-platform UI tests

16

Feature

Scenario

Step

Page object

iOS Android

Page 28: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

X-platform UI tests

16

Feature

Scenario

Step

Page object

iOS Android

• Same scenarios / Steps • Page objects are specific to the platform – Use -r in Cucumber to load for each platform

• features-folder is a Git SubModule

Page 29: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Structure your test code with Page objects

17

Step definition

When(/^I send the report$/) do @page = @page.send_the_report end

Page 30: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Structure your test code with Page objects

17

Step definition

When(/^I send the report$/) do @page = @page.send_the_report end

ReportListingpage - Page object (iOS) def send_the_report transition(:tap => "view marked:'Anmeld annonce'", :page => self.previous_page) end

Page 31: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Avoid timing-issues

18

Page 32: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Don’tAnd /^I set price to "(.*?)"$/ do |price| macro 'I swipe up' sleep(1) touch("view marked:'Price'") sleep(0.5) set_text("view marked:'Price'", price) sleep(0.5) touch("view marked:'OK'") sleep(1) end

Avoid timing-issues

18

Page 33: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Don’tAnd /^I set price to "(.*?)"$/ do |price| macro 'I swipe up' sleep(1) touch("view marked:'Price'") sleep(0.5) set_text("view marked:'Price'", price) sleep(0.5) touch("view marked:'OK'") sleep(1) end

Avoid timing-issues

18

DoAnd /^I set price to "(.*?)"$/ do |price| @page.write_price(price) end

page object def write_price(price) scroll_and_wait_for_row_with_mark("priceCell") touch("view marked:'Price'") keyboard_enter_text price close_keyboard end

Page 34: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Re-run failed tests

19

• Underlying bits and pieces can be unstable – UIAutomation – Simulator

• Cucumber rerun formatter – Give failed test one more try

Page 35: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Re-run failed tests

19

• Underlying bits and pieces can be unstable – UIAutomation – Simulator

• Cucumber rerun formatter – Give failed test one more try

cucumber -f rerun --out rerun.txt

cucumber @rerun.txt

Page 36: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Fast feedback

20

• Only run part of UI test suite on each commit – use @tags

• Use “backdoor” to setup/teardown – E.g. login or create a new user

Page 37: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Fast feedback

20

Page 38: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Fast feedback

20

@commit Scenario: I can manage my listing and see the changes Given I am logged in as "UniqueSeller" using quick login And I have created a listing for "Hovedtelefoner" and is on the SYI VIP Then I see the VIP for "Her kommer en rimelig lang tekst"

When I go back to my listings page And the created listing is in the list …more steps omitted…

Page 39: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Fast feedback

20

@commit Scenario: I can manage my listing and see the changes Given I am logged in as "UniqueSeller" using quick login And I have created a listing for "Hovedtelefoner" and is on the SYI VIP Then I see the VIP for "Her kommer en rimelig lang tekst"

When I go back to my listings page And the created listing is in the list …more steps omitted…

1 scenario (1 passed) 19 steps (19 passed) 0m34.054s

1 scenario (1 passed) 19 steps (19 passed) 1m16.610s

Page 40: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Visible feedback

21

Page 41: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Visible feedback

21

Page 42: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Test on real devices

22

Page 43: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Test on real devices

22

Page 44: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Test on real devices

22

Page 45: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Is test automation all you need?

23

Page 46: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Is test automation all you need?

23

No, but they are • Fast(er than humans) • They never forget details (that you taught it) • Great way to avoid “old” bugs (regression)

Page 47: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Is test automation all you need?

23

No, but they are • Fast(er than humans) • They never forget details (that you taught it) • Great way to avoid “old” bugs (regression)

Page 48: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Manuel tests

• Still very important • Part of Definition of Done for each story • QA has more time to do

– Exploratory tests – Focus on highest risk

24

Page 49: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Trust

• All team members write/maintaining tests • QA trusts the automated tests • Developers trusts QA to find the “tricky” bugs • Everyone trusts that a red test means something is wrong

– No broken windows • Code coverage

25

Page 50: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Trust

• All team members write/maintaining tests • QA trusts the automated tests • Developers trusts QA to find the “tricky” bugs • Everyone trusts that a red test means something is wrong

– No broken windows • Code coverage

25

Page 51: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Plan smaller and frequent releases

• Convince Product Owner of the agility – Automated app updates = fast adoption rate

• Define release scope with Product Owner

26

Page 52: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Plan smaller and frequent releases

• Convince Product Owner of the agility – Automated app updates = fast adoption rate

• Define release scope with Product Owner

26

Page 53: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Plan smaller and frequent releases

• Convince Product Owner of the agility – Automated app updates = fast adoption rate

• Define release scope with Product Owner

Prepare your app for it

26

Page 54: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Plan smaller and frequent releases

• Convince Product Owner of the agility – Automated app updates = fast adoption rate

• Define release scope with Product Owner

Prepare your app for it• “Kill switch” to force users to update eventually

– Work as an emergency brake as well• Welcome screens

– Highlight whats new – Teach the users how to use new features – Do not expect users to read “Whats new” in the AppStore

26

Page 55: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Relax - no worries!

27

Page 56: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery

Embrace failures

• Bug free software is an illusion • Learn/improve from bugs/crashes found by users

– Add new tests to prevent it from happening again • Celebrate (potential) bugs found by tests before production

Know your app quality • Visual information about app health • Be proactive and fix bugs before too many users notice them

28

Page 57: Continuous Delivery for Native Apps 16 9gotocon.com/dl/goto-cph-2015/slides/NielsFrydenholm...Continuous delivery for native apps Niels Frydenholm, ebay Classifieds Continuous delivery