Slide 1

Slide 1 text

Automated Testing Lunch n Learn @incuna

Slide 2

Slide 2 text

What is it? • Unit tests • Integration tests • Functional/acceptance tests • Visual tests • Regression tests

Slide 3

Slide 3 text

Why? • Trust in the code • Freedom to refactor • Reduce number of bugs

Slide 4

Slide 4 text

What is it not? • A complete replacement for QA, a useful tool for doing QA • For content

Slide 5

Slide 5 text

Types of test

Slide 6

Slide 6 text

Unit tests • Test small specific pieces of functionality • Cover as many cases as possible • (Should be) quick and easy • Fragile but isolated • Mock out other layers • Coverage

Slide 7

Slide 7 text

Integration tests • Work across multiple layers of the program • Ensure all the individual pieces fit together • Simulate real requests • Test only “normal” things • Should break less often

Slide 8

Slide 8 text

Functional or Acceptance tests • Test the whole system • Test user stories • “Open up browser, go to home page, click on login link, fill in correct information, redirects to profile page, click on forum navigation, make a post, post appears on page...”

Slide 9

Slide 9 text

Functional or Acceptance tests • SLOW, and harder to write • More likely part of the QA process than the development process • Immensely useful for front end logic

Slide 10

Slide 10 text

Visual tests • Does this page look like this screenshot? • Cross browser • Needs research...

Slide 11

Slide 11 text

Regression testing

Slide 12

Slide 12 text

Regression tests • “AAAA this is broken we must fix it now” • “I’ll write a test for it” • A bug is not a bug, it’s a missing test • Makes sure the bug doesn’t come back

Slide 13

Slide 13 text

Regression tests • Could be any one of the other kinds of test • Never get written if the project didn’t have tests to start with

Slide 14

Slide 14 text

Continuous integration

Slide 15

Slide 15 text

Continuous integration • Runs test suite against changes and pull requests • Warns us if someone breaks things • Runs in a production-like setting

Slide 16

Slide 16 text

Test driven development

Slide 17

Slide 17 text

Test driven development • Write the tests first • Add code afterwards • (Refactor) • Check tests still pass • Repeat

Slide 18

Slide 18 text

Test driven development • Feels slower to start with • More reliable than “refreshing the page to see if it worked” • Requires good tools • Saves time (and face) in the long run

Slide 19

Slide 19 text

Live demo time!