TeaCamp #5: Automated software testing

16
Tea camp #5 Automated software testing David Durant Greater London Authority @cholten99

Transcript of TeaCamp #5: Automated software testing

Page 1: TeaCamp #5: Automated software testing

Tea camp #5Automated software

testing

David DurantGreater London Authority

@cholten99

Page 2: TeaCamp #5: Automated software testing

Intro

Why do we test? It's about trust

Ensuring quality everyone can see, making updates faster and safer.

It’s part of the whole development narrative from business needs, coding,

testing, deployment, and iteration - part of modern fast Agile development cycles

The art of possible - GDS makes multiple zero downtime fully tested

deployments every day

Page 3: TeaCamp #5: Automated software testing

The testing pyramid

We test at lots of different levels - often defined as the following.

Unit tests

Regression tests - ensure bugs have been fixed

Integration tests

System tests

User acceptance tests (UAT)

Page 4: TeaCamp #5: Automated software testing

Some history

Testing has been around (almost) as long as software

Early testing was all manual

Later this included manual repeatable testing made up of lists of tests and test

steps in a spreadsheet - this kind of testing is slow, potentially accident prone

and takes up lots of people-time

Automated testing - driven by business needs (“happy path”), expected errors

and exploratory testing

Page 5: TeaCamp #5: Automated software testing

Early automation

Unit tests are small / fast pieces of test code that test specific blocks of system

component code - there can be 100s of 1000s of them in a big system

At this stage teams are still doing manual integration, system and UAT testing

Page 6: TeaCamp #5: Automated software testing

Modern code delivery pipeline

Automated testing is part of a full managed development pipeline using software

such an Jenkins

Team has an agreed branching / merging strategy for code

Zero downtime deployments

Page 7: TeaCamp #5: Automated software testing

Jenkins

Page 8: TeaCamp #5: Automated software testing

Testing stages

Start by developer running tests on their own machine before committing code

to integration branch

Test machine - VM or Docker clone of production

Staging - at most one update behind production

Production - could be a cluster

Page 9: TeaCamp #5: Automated software testing

Types of tests, numbers & when they are run

Unit tests - 100,000s - own machine

Integration / system tests - 1000s - own machine / test / staging

UAT - 100s - own machine / test / staging

Smoke - 10s - production

Page 10: TeaCamp #5: Automated software testing

How tests are done (1)

Integration testing - API specific ‘black box’ testing

System testing

Browser compatibility - often cloud based

Load testing (Gatling)

Security (OWASP, NCSC, etc - constant not just periodic PEN testing)

Others

Page 11: TeaCamp #5: Automated software testing

How tests are done (2)

User acceptance testing

End-to-end user journey testing - sometimes call Behaviour Driven Development

Selenium “headless” testing

Re-entrant - consistent test data

BDD test tool - Cucumber - based on acceptance criteria for user stories agreed

with the business as part of the Agile process

Based on “given / when / then” format

Page 12: TeaCamp #5: Automated software testing

Cucumber example

Scenario: Duplicate email

When someone tries to create an account for an email address that

already exists

Given I have chosen to sign up

When I enter an email address that has already been registered

Then I should be told that the email is already registered

And I should be offered an option to recover my password

Page 13: TeaCamp #5: Automated software testing

Same test, multiple data

Cucumber supports the idea of tables of data

The same test is executed with data from each row in the table

This can included testing for expected errors

Page 14: TeaCamp #5: Automated software testing

The next frontier - Test Driven Development

Test Driven Development is writing your tests for each sprint before you write

your code

Initially all your tests will fail!

But as your implement the required functionality they will start to pass

Any regressions are immediately obvious during development

Page 15: TeaCamp #5: Automated software testing

Online testing communities

Cross-government Slack : http://tiny.cc/uk-cross-gov-testers

Local government Slack : http://tiny.cc/local-gov-testers

Page 16: TeaCamp #5: Automated software testing

Any questions?

London Digital Peer Group Slack : http://tiny.cc/london-digital-peer-group

David Durant

Senior Business Analyst

Greater London Authority