Software testing overview
— with mparker17
Speaker notes
0/26 - (prep)
- Screensaver off on computer, phone?
- Slides working?
- Speaker notes open on phone?
- Wireless presenter working?
- Mute slides, if applicable.
1/26 - (title)
- Unmute slides, if applicable.
- Can everyone hear me?
- Shout-out to co-workers in the audience.
- Start recording, if applicable.
- Thank everyone for coming.
- Thank hosts, if applicable.
- ¤
2/26 - Who am I?
- mparker17; but not on social media
- I work for a web development firm…
- … of about 80 people
- … in London Ontario,
- … called Digital Echidna,
- … that focuses on open-source technologies… mostly Drupal.
- … and offers professional software development, digital strategy, UX research, and support services.
- Echidna’s clients are mostly North American, and in the healthcare, higher education, and large scale non-profit sectors
- What is an “Echidna”?
- It’s an Australian, egg-laying mammal related to the platypus, but looks more like a hedgehog, with spiky quills.
- Echidnas - both the animals and my co-workers - are unique, resourceful, and adaptive.
- You might remember us from conventions because we wear brightly-coloured hockey jerseys and give away cute plush Echidnas as convention booth swag.
- ¤
3/26 - Who am I? (ctd.)
- (see slide)
- ¤
4/26 - Why test?
- So this presentation is about software testing.
- But you might ask “why should I care? I’m just making a small website, so there’s no need to make any formal tests.”
- This may be true, but we’re being paid to make software that works correctly, and tests are the only way we can be confident of that.
- ¤
5/26 - Tests tell us that…
- Plus, there’s an increasing body of evidence that it takes less time to develop software when you build tests into it from the beginning.
- Tests tell us that we’re done implementing a feature because it works - we spend less time engineering stuff that the customer will never use
- And they tell us that we haven’t broken anything by working in that new feature.
- And they tell us that our system can handle edge cases that the users of the system can throw at it.
- ¤
6/26 - Dictionary definitions
- So let’s start by defining testing…
- As a verb, it’s evauating a software system for correctness
- As a noun, it’s a procedure leading to us accepting or rejecting that the software system is correct
- However, keep in mind that testing won’t prove your code is free from all bugs; just the ones you’re checking for.
- This is why we call it “computer science” as opposed to “computer mathematics”
- This is a whole other conversation
- ¤
7/26 - Approaching tests
- So how should we approach software tests?
- One approach is to run them manually
- The other approach is to get the computer to test itself
- We want to automate as many tests as possible to save time and money…
- … we don’t want to end up with a 500-page manual test plan that requires 10 people and several hours to run, because that would be very expensive…
- …but it’s also not practical to automate everything…
- … and it’s not possible to automate certain types of testing - like user experience testing
- ¤
8/26 - Classifying tests
- So… software development is still a relatively new discipline.
- Other disciplines have been around longer, and they had their own jargon and classification for testing.
- So if you’re confused about the jargon around software testing, that’s because we often end up using terms imported from other disciplines, which don’t quite fit what we do.
- Fortunately, due to the work of people like Kent Beck and Robert C. Martin (aka Uncle Bob), we have…
- ¤
9/26 - (testing automation pyramid)
- … the testing pyramid.
- Note that I’m going to mostly go with Uncle Bob and Kent Beck’s definitions, because they’ve done a lot of thinking about testing, and their way of classifying tests seem to be gaining traction.
- The testing pyramid has unit tests on the bottom; acceptance tests in the middle, and exploratory tests on the top.
- And we sub-divide acceptance tests into Component tests, Integration tests, and System tests.
- ¤
10/26 - Classifying tests (ctd.)
- We will go over all these terms and their synonyms in a bit.
- ¤
11/26 - Classifying tests (ctd.)
- Why a pyramid?
- It serves to illustrate that we can/should build a testing system…
- … with a lot of low-level tests at the bottom
- … and use the confidence that gives us…
- … so we only need a few high-level tests at the top
- ¤
12/26 - Unit tests
- At the bottom of the testing pyramid are unit tests…
- … which test code paths
- They’re usually written by developers, for developers
- … in the same programming language as the “System Under Test”
- Interaction tests, integration tests, and the term “integration and testing” often refer to unit tests of interactions between an object and its immediate neighbours
- Unit tests are part of functional and regression testing
- ¤
13/26 - Unit tests (ctd.)
- If you’ve heard of PHPUnit, Hamcrest, Drupal 8’s UnitTestCase, Jest, Jasmine, Mocha, Ava - the software not the record label - Unexpected, QUnit, or Unit.js, those are all used in unit testing.
- ¤
14/26 - Acceptance tests
- We’ll break this down later; but in the middle of the pyramid are acceptance tests
- Acceptance tests exist to communicate and clarify requirements, and understand when development is done
- Business analysts usually write the first acceptance test cases, because they describe business value.
- “Happy path” refers to the “expected” or “ideal” workflow
- QA analysts and UX designers usually write the next acceptance test cases, because they’re specialists in thinking about how things can go wrong
- Developers can usually think of more ways for things to go wrong, and can add to those acceptance tests
- Note that “acceptance tests” is generally a really overloaded and overused term.
- And recall we’re going with Uncle Bob and Kent Beck’s definitions here.
- ¤
15/26 - Exploratory tests
- At the top of the pyramid are exploratory tests
- We use them to discover new “unhappy paths”, confirm behaviors of both the system and the users, and evaluate if the system works as well as it can under human operation.
- Pretty much any stakeholder can and do perform exploratory tests, even if they’re not always formalized.
- If you’ve heard of “field testing”, “refinement testing”, or “bug hunting”, those often refer to exploratory tests.
- Some types of exploratory tests are, A/B testing, accessibility testing, end-user testing, pentesting aka security testing, usability testing, and UX testing.
- ¤
16/26 - Acceptance/Component
- Let’s break down Acceptance testing. A lower-level type of acceptance testing is “Component testing”.
- Component testing tests individual features
- Like other types of acceptance testing, they’re often written by QA and business, and test business value
- You might have heard of “behavioral testing”, “confidence testing”, “validation testing”, or “verification & validation”
- Testing features is important for functional and regression testing.
- ¤
17/26 - Acceptance/Component (ctd.)
- Some tools for component testing are…
- …the “Gherkin” domain-specific-language (which you might know as Cucumber, or the Given/When/Then syntax)
- …also Behat, D8 Kernel tests, cucumber-js, and Chai.
- …D7’s SimpleTest, and D8’s Browser/JS tests can be considered component tests; but they also overlap a bit with system tests which we’ll talk about in a minute
- ¤
18/26 - Acceptance/Integration
- Integration testing is only meaningful in larger systems with independent parts - like…
- headless Drupal,
- Create-Once-Publish-Everywhere (COPE) strategies where an app accesses the data in your Drupal website,
- or where you need other tools to put data from non-Drupal sources into your search index so you can perform federated searchings
- Interaction tests cover how the independent parts act together
- ¤
19/26 - Acceptance/Integration (ctd.)
- Interaction tests are usually written by people who put together the plan for how these independent parts talk amongst themselves
- You might have heard of “contract testing”, “choreography testing”, “conformance testing”, “testing a system’s plumbing”, or “integration and testing” and these often refer to Integration tests.
- Performance testing, and throughput testing often cover some parts of interaction testing
- ¤
20/26 - Acceptance/Integration (ctd.)
- If you’ve heard of Janus, Pact, Pacto, Apiary, API Blueprint, Hoverfly, Swagger, mount-e-bank, in-proc-tester, plasma, or vcr, these are all used in integration testing
- ¤
21/26 - Acceptance/System
- Finally, system tests. They cover the working system as a whole.
- They’re also known as “end-to-end” testing
- Accessibility testing, functional testing, load testing, performane testing, regression testing, throughput testing, user acceptance testing (UAT), alpha testing, beta testing, verification, validation testing, and ISVV testing all overlap with system testing in some way
- ¤
22/26 - Acceptance/System (ctd.)
- D7’s Simpletest, D8 Browser/JS tests, Nightwatch, Selenium, Wraith, AChecker, the “axe” accessibility scanner, the WAVE toolbar, Capybara, flood.io, I think there’s a load tester called “locust” or something like that… valgrind, webprofile, jtest, metasploit, parasoft, and zee-map can all be used for various forms of system testing
- ¤
23/26 - Other terms
- We’re almost done, but here are some other terms often associated with testing…
- Continuous Delivery, and Continuous Integration are related disciplines that really benefit from automated testing
- …so sometimes test runners aka task runners, are called “CI / CD” tools
- Regression testing is essentially a way to see if your changes broke something; and tests in most layers of the testing pyramid function as regression tests
- ¤
24/26 - Other terms (ctd.)
- Sanity tests can refer to two things…
- … either that a workflow makes sense and can be completed
- … or whether further testing is needed
- … sanity tests are usually ad-hoc, i.e.: rarely formalized
- Smoke tests are also ad-hoc, and come from electrical engineering, where one informal way of testing what you just built is to plug it in to see if it catches fire
- Test coverage is a measurement of how much of your software system can be verified by tests
- Test Driven Development is the discipline, pioneered by Kent Beck, of writing tests before you write the code to make those tests pass.
- Unit and Component tests (and some System tests) can often be written first as per TDD
- Benefits include certainty (that a change didn’t bgit reak anything), defect reduction, courage (to make changes), documentation (by test), and (better) design
- Uncle Bob (Robert C. Martin) says the high cycle time stimulates productivity and reminds him of programming video games as a kid
- A “test fixture” is something you have to set up in order to test something - in software development, this usually involves test doubles like mocks, stubs, fakes, and test harnesses
- And finally, a “test suite” is just some grouping of tests
- ¤
25/26 - Works cited
- Whew, that was a lot of jargon to cover. Hopefully your eyes haven’t glazed over.
- Here’s some of the resources I used while putting together this presentation
- ¤
26/26 - Thanks!
- Thanks for sticking though this with me.
- Thanks also to Digital Echidna, without whom I wouldn’t have been able to complete this talk on time
- Thanks also to my previous employer, OpenConcept, for whom I wrote a blog post a couple of years ago that covered some of this information.
- Thanks also to Albert Albala, and Andrew Lindsay, whom I both worked with at the Linux Foundation, who patiently walked me through implementing TDD in Drupal.