Slide 1

Slide 1 text

Software testing with JavaScript_ a quick guide

Slide 2

Slide 2 text

who am I_ {twitter, youtube, linkedin…}.lsantos.dev software engineer_ [email protected]

Slide 3

Slide 3 text

software testing

Slide 4

Slide 4 text

software tests are untested software that tests your software

Slide 5

Slide 5 text

why?

Slide 6

Slide 6 text

why automated testing? ➔ Improves software quality ➔ Prevent errors before they're published ➔ Builds trust in the codebase ◆ Changes can be published faster

Slide 7

Slide 7 text

tests should be ➔ Deterministic ➔ Self-contained ➔ Predictable ➔ Small

Slide 8

Slide 8 text

What to test?

Slide 9

Slide 9 text

Functionality

Slide 10

Slide 10 text

What not to test?

Slide 11

Slide 11 text

Implementation

Slide 12

Slide 12 text

let's hack!

Slide 13

Slide 13 text

test runners_ giving us an edge on tests

Slide 14

Slide 14 text

let's hack!

Slide 15

Slide 15 text

test doubles_

Slide 16

Slide 16 text

Types of doubles ➔ Spies ◆ Adds instrumentation to a function/object ◆ Actually calls the function but gathers metadata ➔ Stubs ◆ Replaces a function for a fake implementation ◆ Adds instrumentation ◆ Returns a fixed value ➔ Mocks ◆ "Smarter" stubs ◆ Have predefined expectations on interactions ◆ Focused on the interaction, not on behaviour

Slide 17

Slide 17 text

let's hack!

Slide 18

Slide 18 text

TDD Test Driven Development

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

thank you_ lsantos.dev