Slide 1

Slide 1 text

Greg Shackles OLO @gshackles [email protected] github.com/gshackles Keeping Your Users Happy With Testable Apps

Slide 2

Slide 2 text

TDD

Slide 3

Slide 3 text

TDD KISS SOLID BDD DRY SOC YAGNI DDD SRP OCP LSP ISP DIP XP IOC CQS

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

Why Test?

Slide 6

Slide 6 text

Stability

Slide 7

Slide 7 text

Stability • Obvious, but important

Slide 8

Slide 8 text

Stability • Obvious, but important • Refactor and iterate with a safety net

Slide 9

Slide 9 text

Stability • Obvious, but important • Refactor and iterate with a safety net • Compilation is only the first unit test

Slide 10

Slide 10 text

Stability • Obvious, but important • Refactor and iterate with a safety net • Compilation is only the first unit test • Verify cross-platform compatibility

Slide 11

Slide 11 text

“I don’t have time to write tests!”

Slide 12

Slide 12 text

“I don’t have time to NOT write tests!”

Slide 13

Slide 13 text

Once It’s Out, It’s Out

Slide 14

Slide 14 text

Once It’s Out, It’s Out • This isn’t the web

Slide 15

Slide 15 text

Once It’s Out, It’s Out • This isn’t the web • Difficult and expensive to fix

Slide 16

Slide 16 text

Once It’s Out, It’s Out • This isn’t the web • Difficult and expensive to fix • Quality bar has been raised

Slide 17

Slide 17 text

Once It’s Out, It’s Out • This isn’t the web • Difficult and expensive to fix • Quality bar has been raised • Bad reviews stick with you

Slide 18

Slide 18 text

The Happy Path

Slide 19

Slide 19 text

• Improves design The Happy Path

Slide 20

Slide 20 text

• Improves design • More shared code (not just mobile apps) The Happy Path

Slide 21

Slide 21 text

• Improves design • More shared code (not just mobile apps) • Optimize independently of a platform The Happy Path

Slide 22

Slide 22 text

• Improves design • More shared code (not just mobile apps) • Optimize independently of a platform • IterationSpeed++ The Happy Path

Slide 23

Slide 23 text

• Improves design • More shared code (not just mobile apps) • Optimize independently of a platform • IterationSpeed++ • FACT: Green tests are good for the soul The Happy Path

Slide 24

Slide 24 text

What To Test?

Slide 25

Slide 25 text

What to Test?

Slide 26

Slide 26 text

What to Test? • 100% code coverage != the goal

Slide 27

Slide 27 text

What to Test? • 100% code coverage != the goal • Test parts that provide value

Slide 28

Slide 28 text

What to Test? • 100% code coverage != the goal • Test parts that provide value • Testing platform code can be difficult

Slide 29

Slide 29 text

What to Test? • 100% code coverage != the goal • Test parts that provide value • Testing platform code can be difficult • Start small

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

! ! Unit  Tests

Slide 32

Slide 32 text

! ! ! ! Unit  Tests Integra-on  Tests

Slide 33

Slide 33 text

! ! ! ! ! ! Unit  Tests Integra-on  Tests UI  /  UX  Tests

Slide 34

Slide 34 text

! ! ! ! ! ! Unit  Tests Integra-on  Tests UI  /  UX  Tests Mixed Automated

Slide 35

Slide 35 text

Unit / Integration Tests

Slide 36

Slide 36 text

Unit / Integration Tests • Automated

Slide 37

Slide 37 text

Unit / Integration Tests • Automated • Low friction

Slide 38

Slide 38 text

Unit / Integration Tests • Automated • Low friction • Leverage tooling

Slide 39

Slide 39 text

Unit / Integration Tests • Automated • Low friction • Leverage tooling • NUnit (Lite)

Slide 40

Slide 40 text

Unit / Integration Tests • Automated • Low friction • Leverage tooling • NUnit (Lite) • Run on all platforms

Slide 41

Slide 41 text

Unit / Integration Tests • Automated • Low friction • Leverage tooling • NUnit (Lite) • Run on all platforms • Simulator vs Device

Slide 42

Slide 42 text

Mocking

Slide 43

Slide 43 text

Mocking • Limited options

Slide 44

Slide 44 text

Mocking • Limited options • Manual mocking

Slide 45

Slide 45 text

Mocking • Limited options • Manual mocking • Code generation, T4 github.com/gshackles/Muntz

Slide 46

Slide 46 text

01 02 03 04 05 06 07 08 09 10 11 12 13 14 Mocking interface IService { ! string Foo(string bar); } ! class MockService : IService { ! public Func FooBody { get; set; } ! ! ! public Foo(string bar) ! { ! ! return FooBody(); ! } }

Slide 47

Slide 47 text

Manual Testing

Slide 48

Slide 48 text

Manual Testing • User feedback is critical

Slide 49

Slide 49 text

Manual Testing • User feedback is critical • UX testing

Slide 50

Slide 50 text

Manual Testing • User feedback is critical • UX testing • Exploratory testing

Slide 51

Slide 51 text

Manual Testing • User feedback is critical • UX testing • Exploratory testing • TestFlight testflightapp.com

Slide 52

Slide 52 text

MVVM

Slide 53

Slide 53 text

MVVM • MvvmCross

Slide 54

Slide 54 text

MVVM • MvvmCross • Shared, testable view models

Slide 55

Slide 55 text

MVVM • MvvmCross • Shared, testable view models • Improved IoC support

Slide 56

Slide 56 text

MVVM • MvvmCross • Shared, testable view models • Improved IoC support • Databinding keeps views thin

Slide 57

Slide 57 text

DEMO

Slide 58

Slide 58 text

Q&A