unit testing in swift 2 - the before & after story

Post on 15-Apr-2017

637 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Unit Testing in Swift 2: The Before & After

StoryJorge D. Ortiz-Fuentes

@jdortiz

#Swift2Testing

A Canonical Examples

production

#Swift2Testing

#Swift2Testing

Agenda

★Using testable

★Testing error handling

★Measuring test coverage

#Swift2Testing

Agenda

★Using testable

★Testing error handling

★Measuring test coverage

Using testable

Swift Modules

Test Bundle = Module

App / Framework = Module

Internal x

Testable

https://github.com/jdortiz/EvilTalentSwift2

Demo

BeforeMake everything public

or Include the classes in

testing target

Detestable

After@testable import Module

provides access to everything internal

Testable

#Swift2Testing

Agenda

★Using testable

★Testing error handling

★Measuring test coverage

Testing error handling

Always Look at the Bright Side

Don’t

https://github.com/jdortiz/EvilTalentSwift2

Demo

BeforeDeal with pointers to

references and put the data in there in order to

mock the behavior

AfterJust implement a test for the case when it fails and

mock the failure

#Swift2Testing

Agenda

★Using testable

★Testing error handling

★Measuring test coverage

Test coverage

The importance of Unit Testing

https://github.com/jdortiz/EvilTalentSwift2

Demo

BeforeNo idea about how much code is actually tested

AfterPer method/class coverage information

Thank you!

@jdortiz #Swift2Testing

top related