Test Smarter Not Harder - how to design tests for continuous delivery

MelissaBenua 31 views 52 slides Jul 10, 2024
Slide 1
Slide 1 of 52
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52

About This Presentation

Imagine: as soon as any developed functionality is submitted into the code repository, it is automatically subjected to the appropriate battery of tests and then released straight into the wild. Setting up the pipeline to do just that has become commonplace, but most organizations hit the same stumb...


Slide Content

Test smarter, not harder! how to design test suites for continuous delivery STAREAST 2024 Melissa Benua / Head of Platform Engineering, mParticle

About Me Melissa Benua Sr Director of Engineering, Platform mParticle Get in touch! [email protected] @ queenofcode Follow my work! https://www.linkedin.com/in/mbenua/ https://www.slideshare.net/MelissaBenua/ https://github.com/queen-of-code/ https://www.queenofcode.net @ queenofcode

Imagine: as soon as any developed functionality is submitted into the code repository, it is automatically subjected to the appropriate battery of tests and then released straight into the wild. Setting up the pipeline to do just that has become commonplace, but most organizations hit the same stumbling block: just what IS the appropriate battery of tests? Automated build pipelines don't always lend themselves well to the traditional stages of testing. In this hands-on tutorial, Melissa will introduce testers to the key principles of test case and test suite design that apply to organizations big and small to allow them to take full advantage of the pipeline's capabilities without introducing unnecessary bottlenecks. Testers will learn how to make highly reliable tests that run fast and preserve just enough information to let the team determine exactly what went wrong and how to reproduce the error locally. They will also explore how to reduce overlap while still maintaining adequate test coverage, about what test areas might be most beneficial to combine into a single suite, and what areas might benefit most from being completely broken out. @queenofcode

Navigation @ queenofcode

continuous delivery what is it and why does it matter? @queenofcode

@ queenofcode PRE-MERGE POST-MERGE Code & Test Deploy & Test Deploy & Test Peer Review Monitor & Alert

@ queenofcode PRE-MERGE POST-MERGE Code & Test Deploy & Test Deploy & Test Peer Review Monitor & Alert Local Dev Env / Ephemeral QA Env Pre-Production / Production

@queenofcode

@ queenofcode PRE-MERGE POST-MERGE Code & Test Deploy & Test Deploy & Test Peer Review Monitor & Alert Local Dev Env / Ephemeral QA Env Pre-Production / Production

Introducing: MyPhotoApp Gallery Site! @queenofcode

Check Categorization what kind of tests do we have here?

@queenofcode Functional Tests Non-Functional Tests Automated Tests Manual Tests

Definitions @queenofcode

Automated vs Manual Tests @queenofcode

01 Unit Tests 02 Automated Tests 03 Manual Tests Functional Test Case Pyramid @queenofcode

Unit Test Guidelines @queenofcode Does not cross application boundaries Should support parallelism Textual `Input -> Output` validation Does NOT leave the box

Beyond Unit Tests @queenofcode Build Compile change against main Execute unit tests Deploy Deploy change to testing environment Execute integration tests Validate Execute UI + load tests Manual signoff Monitoring signoff Project structure? Moving parts? Functional boundaries? Shared resources? Mocking potential?

Automated Test Guidelines (Integration) @queenofcode Crosses application boundaries Does not require manual intervention Simple `Input -> Output` validation Follows user application flow

Semi-Automated to Manual Test Guidelines @queenofcode Crosses many boundaries Requires manual intervention or setup Difficult validation (not pass/fail) Validates complex scenarios

More Definitions @queenofcode

Exercise: Test Cases @queenofcode How should we test our photo gallery? All ideas are good ideas!

Smart Test Case Principles what makes a test case ‘smart’?

Test Case principles @queenofcode

Speed @queenofcode

Speed @queenofcode Build Failure? UI Test Failure?

Reliability @queenofcode

Reliability @queenofcode

Specificity @queenofcode

Specificity @queenofcode

Proceed With Caution @queenofcode

Exercise: Smart Test Cases @queenofcode Out of all our test ideas, which ones aren’t specific, speedy, or repeatable? Are there some we just shouldn’t do?

Monitoring and reporting what just happened?

Code Health @queenofcode

If your site crashes on the internet but isn’t monitored, is it really down??? @queenofcode

Pillars of Observability @queenofcode

Logging vs Metrics @queenofcode Text Log File? Graph?

Metric Types @queenofcode Rate Success Requests Per Second Failure Requests Per Second Events Per Second Histogram Request Latency Database Latency 60 75 50 90 Gauge Max items in queue Bytes in use

Using Metrics @queenofcode

Metrics and Alerts @queenofcode

Metrics and Automation @queenofcode void Call(ref int A, ref int B) { A = DoWork (); B = DoOtherWork (); CallsCounter.Increment (); }

Exercise: Monitoring @queenofcode How should we monitor our photo gallery? What should we focus on to backstop our testing efforts?

Smart Test Pipeline design what kind of tests are successful in cd?

Example Service Architecture @queenofcode

Test Flow @queenofcode Build Change 01 Compile Code Run Unit Tests Create Code Package 02 Deploy Package 03 Validate Product 04 Package code Create Docker image Deploy app / start Docker container Run Auto Tests Run Manual Tests Validate monitors

@queenofcode

Example suite breakdown @queenofcode

Example Suite Breakdown @queenofcode

Pair code changes to appropriate tests! @queenofcode

Integration Test Matrix – Login SCENARIO @queenofcode

Integration Test Matrix – API Scenario @queenofcode

Tips and Tricks @queenofcode

Exercise: Mapping Cases to Categorized Suites @queenofcode What should we run? When should we run it? How long should we wait?