Slide 1

Slide 1 text

© 2025 CGI Inc. 1 Exploratory unit testing Maaret Pyhäjärvi

Slide 2

Slide 2 text

© 2025 CGI Inc. 2 Took a while to see why testing != testing Testing as artifact creation Testing as perfor- mance EXAMPLES of INTENT EXPERIMENTS of IMPACT

Slide 3

Slide 3 text

© 2025 CGI Inc. 3 Test-Driven Development vs. Exploratory unit testing 3

Slide 4

Slide 4 text

© 2025 CGI Inc. 4 @maaretp @[email protected] o Who Am I? Guessing with power to accept Testing my program or the tool? Note: …pillaging digital content without consent, compensation and attribution Even if legal not ethical.

Slide 5

Slide 5 text

© 2025 CGI Inc. 5 @maaretp @[email protected] o Computer Assisted Software Authorship https://github.com/features/copil ot/

Slide 6

Slide 6 text

© 2025 CGI Inc. 6 @maaretp @[email protected] o CTRL+enter for alternatives

Slide 7

Slide 7 text

© 2025 CGI Inc. 7 @maaretp @[email protected] o CTRL+enter for alternatives

Slide 8

Slide 8 text

© 2025 CGI Inc. 8 WE are accountable 1. Intent / Implementation 2. Domain for the Layman 3. Domain for the Expert 4. Reference Implementation 5. People Filtering

Slide 9

Slide 9 text

© 2025 CGI Inc. 9 Done? Say We Have This…

Slide 10

Slide 10 text

© 2025 CGI Inc. 10 @maaretp @[email protected] o Some Tests Done?

Slide 11

Slide 11 text

© 2025 CGI Inc. 11 Asserts Approvals Shapes of Approaches

Slide 12

Slide 12 text

© 2025 CGI Inc. 12 Asserts Approvals From One to Many

Slide 13

Slide 13 text

© 2025 CGI Inc. 13 @maaretp @[email protected] o Hypothesis

Slide 14

Slide 14 text

© 2025 CGI Inc. 14 In a nutshell… 14 * Sandi Metz: The Magic Tricks of Testing https://www.youtube.com/watch?v=URSWYvyc42M

Slide 15

Slide 15 text

© 2025 CGI Inc. 15 Part I. Review for correctness and conciseness Part II. Input -> Output Part III. Rules of behavior boundaries Part IIII. Coverage Part IIIII. Sampling vs wide nets (approvals) Part VI. Properties Developer intent

Slide 16

Slide 16 text

© 2025 CGI Inc. 16 @maaretp @[email protected] o https://en.wikipedia.org/wiki/Roman_nume rals

Slide 17

Slide 17 text

© 2025 CGI Inc. 17 @maaretp @[email protected] o

Slide 18

Slide 18 text

© 2025 CGI Inc. 18 @maaretp @[email protected] o Upper Boundary?

Slide 19

Slide 19 text

© 2025 CGI Inc. 19 @maaretp @[email protected] o

Slide 20

Slide 20 text

© 2025 CGI Inc. 20 @maaretp @[email protected] o References… References…

Slide 21

Slide 21 text

© 2025 CGI Inc. 21 @maaretp @[email protected] o References…

Slide 22

Slide 22 text

© 2025 CGI Inc. 22 @maaretp @[email protected] o References…

Slide 23

Slide 23 text

© 2025 CGI Inc. 23 @maaretp @[email protected] o ApprovalTests Done?

Slide 24

Slide 24 text

© 2025 CGI Inc. 24 @maaretp @[email protected] o Domain rules: 1V à IIII in clock design as per orders of King Louis XIV of France https://www.amalgamsab.com/iiii-or-is-it- iv.html

Slide 25

Slide 25 text

© 2025 CGI Inc. 25 Part 1. Be the resident expert. Ask around. Part II. Rules. More rules. Part III. Find better experts. Part IIII. Disagreeing with boundaries. Part IIIII. Oracles. Part VI. Find better oracles. Part VII. No user would do what users would do. Domain

Slide 26

Slide 26 text

© 2025 CGI Inc. 26 Part 1. Dependencies. Part II. Interruptions. Both software and hardware. Part III. People. “People are not pure functions; they have all sorts of interesting side effects.” - Engineering Management for the Rest of Us, Sarah Drasner … nor are pure functions if you grow the boundary of what might fail. Environment

Slide 27

Slide 27 text

© 2025 CGI Inc. 27 WE are accountable 1. Intent / Implementation 2. Domain for the Layman 3. Domain for the Expert 4. Reference Implementation 5. People Filtering

Slide 28

Slide 28 text

© 2025 CGI Inc. 28 Answer key to some of the bugs 1…3999 is not the right boundary. 4 is IIII and 5 is IIIII and 50 is XXXXX with right choice of domain. Entirely different rules from classic to concise to simplified. Fractions and zero do exist. Infinite loops, miscalculation at boundaries. Unimplemented boundary checking. Reuse without license. 28

Slide 29

Slide 29 text

© 2025 CGI Inc. 29 Stakeholders happy, even delighted –Quality Information Good Team’s Output –Quality Information Less than Good Team’s Output –Quality Information Results Gap Surprise! Results Gap on a Team that thinks Testers == Testing Pick up the pizza boxes… ”Find (some of) What Others May Have Missed”

Slide 30

Slide 30 text

© 2025 CGI Inc. 30 A majority of the production failures (77%) can be reproduced by a unit test. https://www.usenix.org/system/files/conference/osdi14/osdi14-paper-yuan.pdf Through https://www.slideshare.net/Kevlin/the-error-of-our-ways

Slide 31

Slide 31 text

© 2025 CGI Inc. 31 A vocab walkthrough From Arrange-Act- Assert to Do- Verify Structure From Asserts to Approvals Timing of expected From handcrafted examples to generated Tools to do more From hard to soft Decision of fail handling Tools ideology Pandora’s box with opportunities

Slide 32

Slide 32 text

© 2025 CGI Inc. 32 32

Slide 33

Slide 33 text

© 2025 CGI Inc. 33 Unit vs. system – and knowing the intent 33

Slide 34

Slide 34 text

© 2025 CGI Inc. 34 34

Slide 35

Slide 35 text

© 2025 CGI Inc. 35 Insights you can act on Founded in 1976, CGI is among the largest IT and business consulting services firms in the world. We are insights-driven and outcomes-based to help accelerate returns on your investments. Across hundreds of locations worldwide, we provide comprehensive, scalable and sustainable IT and business consulting services that are informed globally and delivered locally. cgi.com