Latest / CyberSecurity Summary / Software Testing: A Craftsman's Approach
Transcript
- 0:00Speaker 1: Welcome to the deep dive, your shortcut to truly understanding
- 0:04Speaker 1: complex topics. Today we're taking a fresh look at something
- 0:08Speaker 1: often dismissed as well tedious, maybe just a box checking activity.
- 0:13Speaker 1: Software testing.
- 0:14Speaker 2: Yeah, it definitely gets that reputation sometimes.
- 0:17Speaker 1: But what if I told you it's actually a deeply creative,
- 0:20Speaker 1: intricate craft, almost like what a skilled artisan brings to
- 0:24Speaker 1: their masterpiece.
- 0:25Speaker 2: It's absolutely true. Software testing is far more than just
- 0:28Speaker 2: you know, finding bugs. It's really about understanding the very
- 0:31Speaker 2: fabric of how software is built, how it behaves, and
- 0:35Speaker 2: ultimately how it's validated for quality.
- 0:37Speaker 1: That's exactly right. Today we're going to pull back the
- 0:39Speaker 1: layers on the craft of software testing, drawing insights from
- 0:43Speaker 1: Pusey Jorgensen's Software Testing a crafts Fund's approach.
- 0:46Speaker 2: It's a foundational text in the field.
- 0:48Speaker 1: Our goal here is to unpack the fundamental concepts, the
- 0:51Speaker 1: diverse techniques, and maybe some surprising real world applications, so
- 0:55Speaker 1: you walk away with a much richer understanding and maybe
- 0:58Speaker 1: even a new appreciation for this qui discipline that really
- 1:02Speaker 1: underpins almost everything digital around us.
- 1:04Speaker 2: Sounds like a great plan. Where should we start?
- 1:06Speaker 1: So let's start right at the beginning, what testing really is.
- 1:10Speaker 1: Jorgensen gives us this clear progression of terms that are fundamental.
- 1:16Speaker 1: It all begins with a human error, a.
- 1:19Speaker 2: Mistake, right, someone makes a mistake while coding.
- 1:21Speaker 1: That's the error, and that human error then shows up
- 1:24Speaker 1: in the software as.
- 1:25Speaker 2: A fault, which is the bug or defect people talk about. Yeah,
- 1:29Speaker 2: it's a representation of that mistake in the code.
- 1:31Speaker 1: And it's crucial to remember this human element, isn't it.
- 1:35Speaker 1: We test because we know that we're fallible.
- 1:37Speaker 2: Especially in something as complex as software.
- 1:39Speaker 1: We make mistakes, and it continues from there. When that
- 1:42Speaker 1: code containing the fault actually gets executed.
- 1:45Speaker 2: That's when you get a failure. The software doesn't do
- 1:47Speaker 2: what it's supposed to do.
- 1:48Speaker 1: Okay, And finally, the incident is what the user actually
- 1:51Speaker 1: sees exactly.
- 1:52Speaker 2: It's the symptom, the alert, the thing that makes someone say, hey,
- 1:55Speaker 2: something went wrong here. So it's this chain reaction.
- 1:58Speaker 1: Error leads to fault, leads to failure, leads to incident.
- 2:02Speaker 2: You got it, human mistake, bugging code, wrong behavior, user notices.
- 2:08Speaker 1: So given that chain, a test becomes this deliberate act
- 2:12Speaker 1: right exercising the software with specific.
- 2:14Speaker 2: Test cases, right and it has two main goals. Either
- 2:17Speaker 2: you're trying to find those failures hut them down, or
- 2:20Speaker 2: you're trying to demonstrate confidently that the software is working
- 2:25Speaker 2: correctly under certain conditions.
- 2:27Speaker 1: And a test case. It's not just throwing random stuff
- 2:30Speaker 1: at the program.
- 2:31Speaker 2: No, no, not at all. A craftsman builds a test
- 2:34Speaker 2: case carefully. It needs an identity, a clear purpose like
- 2:39Speaker 2: testing a specific business rule. Okay, it needs to find preconditions,
- 2:43Speaker 2: specific inputs, and crucially the exact expected outputs.
- 2:47Speaker 1: You need to know what right looks.
- 2:49Speaker 2: Like absolutely, and even the expected state of the system
- 2:51Speaker 2: after the test runs. Plus you keep track of its
- 2:54Speaker 2: execution history. It's a complete, thoughtful construction.
- 2:57Speaker 1: So that's the what and why. Now how does a
- 2:59Speaker 1: craftsman actually approach testing? Jorgensen highlights too sort of fundamental philosophies.
- 3:04Speaker 2: Yeah, specification based testing versus code based testing.
- 3:07Speaker 1: Let's unpack specification based first. That's also known as black
- 3:10Speaker 1: box testing.
- 3:11Speaker 2: Right, or functional testing. The core idea is you're designing
- 3:14Speaker 2: your tests based purely on the software's requirements the specs,
- 3:19Speaker 2: without looking at the internal code.
- 3:21Speaker 1: Like testing a car, you use the steering wheel of
- 3:23Speaker 1: the pedals, check the.
- 3:25Speaker 2: Lights, But you don't need to know how the engine
- 3:27Speaker 2: or the wiring actually works inside. You just know what
- 3:30Speaker 2: it should do based on the user manual. Basically, that sounds.
- 3:33Speaker 1: Really useful during development. What are the big advantages there?
- 3:37Speaker 2: Well, A huge one is that the test cases are
- 3:39Speaker 2: independent of the actual implementation, meaning even if the developers
- 3:44Speaker 2: completely rewrite a section of code, as long as it's
- 3:47Speaker 2: supposed to do the same thing according to the spec,
- 3:50Speaker 2: your test case is still valid.
- 3:52Speaker 1: Oh okay, that's powerful.
- 3:53Speaker 2: And it also means testing can start earlier, maybe even
- 3:56Speaker 2: happen in parallel with development, which can speed things up.
- 4:00Speaker 1: But I'm guessing there's a downside.
- 4:02Speaker 2: I catch there is because you're not looking inside, you
- 4:05Speaker 2: can end up with redundant tests, multiple tests checking the
- 4:08Speaker 2: same underlying logic without realizing it wasted effort, and more critically,
- 4:13Speaker 2: you can have gaps, big blind spots where parts of
- 4:16Speaker 2: the software might just never get tested because the spec
- 4:20Speaker 2: didn't explicitly cover some weird internal case.
- 4:23Speaker 1: Okay, So that leads us to the other side. Code
- 4:25Speaker 1: based testing right.
- 4:27Speaker 2: Sometimes called white box testing. Here you are looking at
- 4:30Speaker 2: the source code. The tests are designed based on the
- 4:33Speaker 2: program's structure, its paths its conditions.
- 4:37Speaker 1: What's the main limitation there? Then it sounds more thorough.
- 4:40Speaker 2: It can be for certain things, but its main weakness
- 4:43Speaker 2: is identifying behaviors that were never programmed at all but
- 4:46Speaker 2: should have been.
- 4:47Speaker 1: Ah omissions, things missing from the requirements in the code exactly.
- 4:51Speaker 2: Or think about something malicious like a trojan warp someone
- 4:54Speaker 2: slipped in if it wasn't in the spec and it's
- 4:57Speaker 2: just extra code doing bad stuff. Spec based won't find it,
- 5:01Speaker 2: and code based testing might just test the paths through
- 5:03Speaker 2: it without realizing its malicious intent. It struggles with things
- 5:07Speaker 2: that aren't there but should be, or things that are
- 5:09Speaker 2: there but shouldn't be if they weren't specified.
- 5:11Speaker 1: So this sounds like a classic debate, black box versus
- 5:13Speaker 1: white box? Is one just better?
- 5:15Speaker 2: Well, if you step back, you see pretty quickly that
- 5:18Speaker 2: neither one alone is really sufficient.
- 5:19Speaker 1: Why not?
- 5:20Speaker 2: Code based testing, like we said, won't find requirements that
- 5:24Speaker 2: were completely missed in the lamentation, and spec based testing
- 5:27Speaker 2: won't find extra, maybe unwanted behaviors that got coded in
- 5:31Speaker 2: but weren't in the spec.
- 5:33Speaker 1: So the craftsman's approach isn't about picking a side in
- 5:36Speaker 1: this great debate.
- 5:38Speaker 2: Exactly, it's not either. The real answer, the craftsman's answer
- 5:42Speaker 2: is a smart combination.
- 5:43Speaker 1: Okay, how does that work?
- 5:45Speaker 2: You use both You design tests based on the specification
- 5:48Speaker 2: to ensure functionality, and you use code based techniques, especially
- 5:52Speaker 2: coverage metrics, to see what parts of the actual code
- 5:55Speaker 2: those tests are exercising.
- 5:57Speaker 1: Ah, So the code coverage tells you about the gaps
- 5:59Speaker 1: and redencies in your spec based tests.
- 6:02Speaker 2: Precisely, it gives you that measurement, that confidence. You get
- 6:05Speaker 2: the functional assurance from spec based testing and the structural
- 6:09Speaker 2: assurance and efficiency check from code based testing. It's about
- 6:12Speaker 2: blending the strengths of both views.
- 6:14Speaker 1: That makes a lot of sense, combining perspectives for a
- 6:17Speaker 1: fuller picture. Okay, So with these foundational ideas, the error chain,
- 6:23Speaker 1: the two approaches, how does the craftsmen apply this in
- 6:26Speaker 1: a real project. Jorgensen talks about levels of testing often
- 6:31Speaker 1: shown using the V model.
- 6:33Speaker 2: Right. The V model is a variation of the older
- 6:35Speaker 2: Waterfall model, but it's really useful because it visually emphasizes
- 6:39Speaker 2: how testing activities should mirror development activities. How So, well,
- 6:43Speaker 2: on the left side of the V you have the
- 6:45Speaker 2: development phases going down requirements high level design, detailed design
- 6:49Speaker 2: coding okay, and on the right side. Going up, you
- 6:52Speaker 2: have the corresponding testing levels. Unit testing validates the code
- 6:56Speaker 2: from detailed design, Integration testing validates the interfaces from high
- 7:00Speaker 2: level design, and system testing validates the whole thing against
- 7:03Speaker 2: the initial requirements.
- 7:05Speaker 1: So each test level connects back to a design level exactly.
- 7:08Speaker 2: It builds in quality checks at each stage rather than
- 7:11Speaker 2: waiting until the very end. The idea is to catch
- 7:14Speaker 2: faults as close as possible to where they.
- 7:16Speaker 1: Were introduced, cheaper to fix them earlier, much much cheaper. Okay,
- 7:19Speaker 1: So let's dive into that first level unit testing. This
- 7:23Speaker 1: is where the craftsman is working on individual components, right,
- 7:26Speaker 1: like a single function or class.
- 7:28Speaker 2: Yep, the smallest testable pieces of the software. And there's
- 7:31Speaker 2: a whole toolbox of techniques.
- 7:33Speaker 1: For this level. Let's start with boundary value testing. You
- 7:36Speaker 1: called these the off by one detectives earlier.
- 7:38Speaker 2: Ah, yeah, that's a good way to think about it.
- 7:40Speaker 2: The core idea is simple. Experience shows that programmers often
- 7:43Speaker 2: make mistakes right at the edges the boundaries of input ranges,
- 7:47Speaker 2: like using when.
- 7:48Speaker 1: They meant or starting a loop counter at one instead
- 7:50Speaker 1: of zero.
- 7:51Speaker 2: Exactly those kinds of things off by one errors. So
- 7:54Speaker 2: boundary value testing says, Okay, if an input is valid
- 7:57Speaker 2: between one and one hundred, don't just test fifty.
- 8:00Speaker 1: Test the edges.
- 8:00Speaker 2: Test the minimum one, minimum plus one two a nominal
- 8:04Speaker 2: value like fifty, maximum one ninety nine, and the maximum
- 8:08Speaker 2: one hundred.
- 8:09Speaker 1: Makes sense, and what about robust testing?
- 8:11Speaker 2: Robust boundary value testing goes one step further. It says,
- 8:14Speaker 2: let's also test values just outside the valid range, so
- 8:17Speaker 2: minimum one zero in our example, and maximum plus one
- 8:20Speaker 2: one oh one.
- 8:21Speaker 1: Why test invalid inputs.
- 8:23Speaker 2: Because that's often where unexpected crashes or even security vulnerabilities happen.
- 8:27Speaker 2: How does the system handle bad data? Robust testing checks that.
- 8:31Speaker 2: There's also worst case testing, which gets pretty complex testing
- 8:35Speaker 2: combinations of boundary values.
- 8:37Speaker 1: Okay, boundaries are critical. Yeah, but testing every boundary for
- 8:40Speaker 1: every variable sounds like it could create a lot of tests.
- 8:43Speaker 2: It can't, And that leads nicely into the next technique,
- 8:46Speaker 2: equivalence class testing.
- 8:48Speaker 1: Oh did that help?
- 8:49Speaker 2: It's all about smart simplification. It tackles the potential redundancy
- 8:54Speaker 2: you might get from just boundary testing. The idea comes
- 8:57Speaker 2: from math, from partitions. Okay, you try to identify groups
- 9:01Speaker 2: or classes of inputs that the program should treat exactly
- 9:04Speaker 2: the same way. If you put in three, four, or five,
- 9:08Speaker 2: and the code follows the exact same logic path for
- 9:10Speaker 2: all of them, they form an equivalence class.
- 9:12Speaker 1: Ah, so you don't need to test all three exactly.
- 9:14Speaker 2: The assumption is if you test one representative value from
- 9:17Speaker 2: that class, say four, it tells you how the program
- 9:21Speaker 2: behaves for all the other values in that class three
- 9:23Speaker 2: and five.
- 9:23Speaker 1: That sounds much more efficient.
- 9:25Speaker 2: Hugely efficient. It aims for completeness. Every possible input belongs
- 9:29Speaker 2: to some class, and non redundancy no input belongs to
- 9:32Speaker 2: more than one class. Ideally you get great coverage with
- 9:36Speaker 2: fewer tests.
- 9:37Speaker 1: Are there different types like with boundary testing.
- 9:40Speaker 2: Yes, similar ideas. Weak normal tests one value from each
- 9:44Speaker 2: valid class, Strong normal tests combinations of valid classes, and
- 9:49Speaker 2: then weak robust and strong robust ad testing for the
- 9:52Speaker 2: invalid equivalence classes inputs that should cause an error.
- 9:55Speaker 1: So boundary values handle the edges. Equivalence classes handle the
- 9:59Speaker 1: broad range efficiently. What if the logic itself is really complicated,
- 10:03Speaker 1: lots of nested if statements or complex conditions.
- 10:06Speaker 2: That's where decision table based testing shines. It's a very
- 10:09Speaker 2: rigorous logical way to approach complex decision logic.
- 10:12Speaker 1: How does it work? You literally build a.
- 10:14Speaker 2: Table you do you list all the conditions, the inputs
- 10:17Speaker 2: or system states that affect the decision, and all the
- 10:19Speaker 2: possible actions what the software should do. Then you systematically
- 10:23Speaker 2: map out every possible combination of condition outcomes true, false,
- 10:27Speaker 2: and the corresponding action.
- 10:29Speaker 1: Sounds like it could get huge.
- 10:30Speaker 2: It can initially, but the real power comes when you
- 10:34Speaker 2: analyze the table. You often find don't care conditions, situations
- 10:39Speaker 2: where the outcome of one condition doesn't actually matter if
- 10:42Speaker 2: another condition is met.
- 10:43Speaker 1: Ah, So you can simplify the.
- 10:45Speaker 2: Table exactly you collapse rules. Jorgensen uses the next date
- 10:49Speaker 2: function exam, a function to calculate the date after a
- 10:53Speaker 2: given date. The initial table might seem to have hundreds
- 10:56Speaker 2: of rules when you consider day, month, year, leap yer rules.
- 10:59Speaker 1: Yeah yeah, that sounds complicated.
- 11:01Speaker 2: But by using decision tables and identifying those don't care
- 11:04Speaker 2: conditions they could reduce it down to just a handful
- 11:07Speaker 2: of essential test cases that covered all the logic. It
- 11:10Speaker 2: shows how testing can actually improve the program's design by
- 11:13Speaker 2: clarifying the logic.
- 11:15Speaker 1: Pesting clarifying the code, not just finding bugs. I like that. Okay,
- 11:19Speaker 1: so we've looked at inputs in logic. What about the
- 11:22Speaker 1: actual flow of the code, the paths.
- 11:24Speaker 2: It takes, right, that's path testing here. The graftsmanship's focus
- 11:28Speaker 2: to the control flow through the program.
- 11:30Speaker 1: How do you visualize that?
- 11:31Speaker 2: You often use program graphs. Think of nodes as chunks
- 11:35Speaker 2: of code like statement fragments, and edges as the flow
- 11:38Speaker 2: of control between them, like an if statement creating a branch.
- 11:42Speaker 2: We often look at ddpaths decision to decision.
- 11:45Speaker 1: Paths, okay, paths between decisions.
- 11:47Speaker 2: The goal is to design tests that exercise different paths
- 11:50Speaker 2: through this graph. There are different levels of coverage you
- 11:53Speaker 2: might aim for, Like what the simplest is node coverage
- 11:58Speaker 2: or statement coverage. Just make making sure every single statement
- 12:01Speaker 2: in the code gets executed at least once by some.
- 12:04Speaker 1: Test seems like a minimum baseline.
- 12:06Speaker 2: It is stronger is edge coverage or branch coverage. Making
- 12:10Speaker 2: sure every possible outcome of every decision, like the shrewd
- 12:15Speaker 2: and false branches of an if statement, gets executed at
- 12:18Speaker 2: least once.
- 12:19Speaker 1: That sounds more thorough it generally is.
- 12:21Speaker 2: And this is where we often hear about cyclomatic complexity
- 12:24Speaker 2: right VG.
- 12:24Speaker 1: What does that number actually tell us?
- 12:26Speaker 2: It's a metric calculated from the program graph number of
- 12:29Speaker 2: edges minus number of nodes plus one. Essentially, it gives
- 12:32Speaker 2: you the number of independent paths through the code. The
- 12:35Speaker 2: independent paths basically the minimum number of paths you'd need
- 12:38Speaker 2: to test to ensure you've covered every edge at least once.
- 12:42Speaker 2: It's a measure of the code's structural complexity.
- 12:45Speaker 1: Is there a rule of thumb for it?
- 12:47Speaker 2: A common guideline is that if the cyclomatic complexity HERMBG
- 12:51Speaker 2: gets above ten for a single function or module, that
- 12:54Speaker 2: code is getting pretty complex. It'll likely be harder to understand,
- 12:58Speaker 2: harder to test, and potentially more prone to errors.
- 13:02Speaker 1: So it's a warning sign for developers and testers exactly.
- 13:06Speaker 2: It suggests maybe breaking the code down into smaller, simpler pieces.
- 13:10Speaker 1: But wait, can you have paths in the graph that
- 13:12Speaker 1: look possible but you can't actually execute them?
- 13:15Speaker 2: Absolutely? Those are called infeasible paths. It's a major headache
- 13:18Speaker 2: in path testing. Why way happen because the structure of
- 13:21Speaker 2: the graph doesn't always capture the semantic dependencies. Maybe path
- 13:25Speaker 2: A set's a variable to true and path B requires
- 13:29Speaker 2: that variable to be false. You can draw the path,
- 13:31Speaker 2: but you can never actually make the program follow it.
- 13:34Speaker 2: Designing tests for infeasible path is wasted effort.
- 13:37Speaker 1: Tricky, and you mentioned something even more rigorous for critical systems.
- 13:41Speaker 2: Yes, for safety critical stuff like aviation software level A,
- 13:45Speaker 2: they often require modified condition decision coverage or MCDC.
- 13:50Speaker 1: What does that involved.
- 13:51Speaker 2: It's pretty intense. For every decision with multiple conditions like
- 13:55Speaker 2: A and B or C, you need test cases that
- 13:57Speaker 2: show that each individual condition A, B, and C can
- 14:01Speaker 2: independently affect the outcome of the entire decision, while the
- 14:05Speaker 2: other conditions are held constant.
- 14:06Speaker 1: Wow, that's ensuring every part of the logic really matters precisely.
- 14:10Speaker 2: It's about preventing situations where a condition seems to be
- 14:13Speaker 2: tested but its effect is masked by other conditions. Extremely thorough.
- 14:18Speaker 1: Okay, so path testing covers the flow, but what about
- 14:21Speaker 1: the data itself? What happens to variables is they move
- 14:24Speaker 1: along these paths?
- 14:24Speaker 2: Excellent question. That brings us to data flow testing. This
- 14:28Speaker 2: technique shifts the focus from just the control flow paths
- 14:32Speaker 2: to the life cycle of variables within those paths.
- 14:34Speaker 1: LIFECYC.
- 14:35Speaker 2: Yeah, where does a variable get defined, get a value,
- 14:38Speaker 2: and where does it get used? Its value is read.
- 14:41Speaker 2: Data flow testing looks for paths between a definition of
- 14:44Speaker 2: a variable and a subsequent use of that same variable.
- 14:47Speaker 2: These are called definition use.
- 14:48Speaker 1: Paths or do paths. Why is that important?
- 14:51Speaker 2: Well, it helps catch errors like using a variable before
- 14:54Speaker 2: it's been initialized, or defining a variable and then never
- 14:57Speaker 2: actually using its value. It acts as a kind of
- 15:00Speaker 2: reality check on pure path.
- 15:02Speaker 1: Testing, so it connects the control flow with what's actually
- 15:05Speaker 1: happening to the data exactly.
- 15:07Speaker 2: There's a whole hierarchy of dataflow coverage criteria like all
- 15:11Speaker 2: deaths tests at least one path from every definition, all
- 15:14Speaker 2: uses test paths to every use. All the upaths test
- 15:18Speaker 2: every simple definition use path. It's particularly good for object
- 15:21Speaker 2: oriented code where data interactions can be complex.
- 15:24Speaker 1: Makes sense, okay? One more in the unit testing toolbox
- 15:27Speaker 1: program slicing. This sounds different.
- 15:29Speaker 2: It is a bit different, but incredibly useful, especially for
- 15:32Speaker 2: debugging and understanding code. A slice of a program relative
- 15:37Speaker 2: to a specific variable at a specific point is the
- 15:39Speaker 2: subset of program statements that could possibly affect the value
- 15:43Speaker 2: of that variable at that point.
- 15:45Speaker 1: So it's like highlighting only the relevant code exactly.
- 15:48Speaker 2: You can do a backward slice starting from a vary goal,
- 15:52Speaker 2: trace back everything that could have influenced its value, or
- 15:56Speaker 2: a forward slice starting from where a variable is defined,
- 15:59Speaker 2: see everything that it could possibly influence later on.
- 16:01Speaker 1: I can see how that would help with debugging. Focuses
- 16:04Speaker 1: your attention tremendously.
- 16:05Speaker 2: It helps eliminate all the irrelevant detail and lets the
- 16:08Speaker 2: craftsmen focus precisely where the problem might be. Jorgensen even
- 16:12Speaker 2: suggests that developing programs in terms of compilable slices could
- 16:15Speaker 2: be a powerful way to build and understand complex software.
- 16:19Speaker 1: Interesting idea. Okay, so that's a lot of techniques just
- 16:21Speaker 1: for unit testing, boundary values, equivalence classes, decision tables, path testing,
- 16:26Speaker 1: data flow slicing. How does the craftsmen put it all together?
- 16:30Speaker 1: You mentioned Jorgensen's testing pendulum earlier, right.
- 16:32Speaker 2: Let's bring that back. It's that metaphor of testing swinging
- 16:35Speaker 2: between the specification based view, the black box.
- 16:39Speaker 1: High level functional requirement.
- 16:41Speaker 2: Focused and the code based view, the white box.
- 16:44Speaker 1: Low level structural implementation focused.
- 16:47Speaker 2: And the pendulum highlights that neither extreme is sufficient on
- 16:50Speaker 2: its own. The real skill the craft lies in the combination.
- 16:55Speaker 1: How does that play out.
- 16:56Speaker 2: Practically, A common approach is to start by choosing a
- 16:59Speaker 2: specification based technique, maybe equivalence classes or boundary values, to
- 17:04Speaker 2: define an initial set of tests based on what the
- 17:07Speaker 2: system should do.
- 17:08Speaker 1: Okay, get the functional coverage first.
- 17:10Speaker 2: Then you run those tests and use code coverage tools
- 17:13Speaker 2: which come from the code based world, to measure which
- 17:16Speaker 2: parts of the code were actually executed.
- 17:18Speaker 1: Ah, And that measurement reveals the gas exactly.
- 17:21Speaker 2: It shows you the parts of the code your spec
- 17:23Speaker 2: based tests didn't reach. It might also reveal redundancies. If
- 17:27Speaker 2: multiple tests exercise the exact same code path, then you
- 17:30Speaker 2: can design additional tests, perhaps using path or data flow
- 17:33Speaker 2: ideas specifically to fill those gaps.
- 17:36Speaker 1: So it's an iterative refinement using both perspectives.
- 17:38Speaker 2: Precisely, you leverage the strengths of both. Jorgensen uses an
- 17:42Speaker 2: insurance premium case study to show this how you'd pick
- 17:45Speaker 2: different techniques based on whether variables are physical quantities or
- 17:49Speaker 2: logical flags, whether faults are likely independent or interacting, and
- 17:53Speaker 2: how to handle exceptions. It really emphasizes choosing the right
- 17:57Speaker 2: tool or combination of tools for this job.
- 18:01Speaker 1: The hallmark of a craftsman. Okay, let's zoom out. Now
- 18:04Speaker 1: we've covered the unit level in detail. How does testing
- 18:06Speaker 1: fit into the bigger picture across different software development life cycles?
- 18:10Speaker 1: Good question.
- 18:11Speaker 2: The traditional waterfall model, as we touched on with the
- 18:14Speaker 2: V model, was very linear. Design everything first, then build it,
- 18:17Speaker 2: then test it in stages unit integrash system. It kind
- 18:21Speaker 2: of assumed you could know everything perfectly upfront.
- 18:23Speaker 1: Which rarely happens in reality.
- 18:25Speaker 2: Exactly, so iterative models emerge, things like incremental development, evolutionary prototyping,
- 18:30Speaker 2: the spiral model. The big shift there was moving away
- 18:33Speaker 2: from doing everything in one big chunk to doing things
- 18:36Speaker 2: in smaller cycles, building and testing parts of the system,
- 18:39Speaker 2: getting feedback, and then.
- 18:40Speaker 1: Iterating more flexible, more adaptive.
- 18:43Speaker 2: Much more. And this really paved the way for agile testing.
- 18:47Speaker 1: What are the key characteristics of testing in an agile world?
- 18:50Speaker 2: Agile testing is fundamentally driven by customer needs and feedback.
- 18:54Speaker 2: It's typically bottom up, focusing on delivering working software components
- 18:58Speaker 2: early and often, and it absolutely embraces changing requirements.
- 19:03Speaker 1: Flexibility is key.
- 19:05Speaker 2: Absolutely. Two big examples you hear about are Extreme Programming
- 19:09Speaker 2: XP and Test driven development TDDDDD.
- 19:13Speaker 1: That's the one where we write the test first.
- 19:14Speaker 2: Right that's the one. It sounds backward, but it's powerful.
- 19:18Speaker 2: In TDD, developers work in very short cycles. First, write
- 19:23Speaker 2: an automated test case for a tiny piece of functionality
- 19:26Speaker 2: that doesn't exist yet. The test will obviously.
- 19:29Speaker 1: Fail because the code isn't there right.
- 19:31Speaker 2: Then write the minimum amount code needed to make that
- 19:34Speaker 2: test pass okay, and then importantly refactor the code, clean
- 19:38Speaker 2: it up, improve its design, while continually rerunning all the
- 19:41Speaker 2: tests to make sure nothing broke.
- 19:43Speaker 1: So the tests act like a specification in a safety
- 19:46Speaker 1: net precisely.
- 19:47Speaker 2: It requires good automated testing frameworks like JUnit for Java,
- 19:51Speaker 2: for instance, and it really keeps the focus on building
- 19:54Speaker 2: exactly what's needed and keeping the code based clean.
- 19:57Speaker 1: What about Scrum? How does testing fit in there?
- 20:00Speaker 2: Rum organizes work into sprints, usually two four weeks long.
- 20:03Speaker 2: Teams have daily stand up meetings to coordinate, and the
- 20:07Speaker 2: goal is to produce a potentially shippable increment of software
- 20:10Speaker 2: at the end of each sprint. Testing is integrated throughout
- 20:13Speaker 2: the sprint, often with continuous integration and automated builds happening.
- 20:17Speaker 1: Daily, so very rapid cycles and feedback very rapid.
- 20:20Speaker 2: Some say scrum is mostly new names for old ideas,
- 20:23Speaker 2: but that intense focus on short intervals and daily integration
- 20:27Speaker 2: really forces testing to be a continuous activity, not an afterthought.
- 20:31Speaker 1: Beyond specific methodologies, there's also model based testing MBT. What's
- 20:36Speaker 1: the idea there?
- 20:36Speaker 2: NBT takes a more abstract approach. Instead of deriving tests
- 20:40Speaker 2: directly from requirements, text, or code, you first build a
- 20:43Speaker 2: formal model of the system's.
- 20:44Speaker 1: Behavior, like a flow chart or a state machine.
- 20:47Speaker 2: Could be finite state machines, petri nets, state charts. There
- 20:51Speaker 2: are various modeling languages. The key advantage, Jorgensen argues is
- 20:55Speaker 2: that the act of building the model forces you to
- 20:58Speaker 2: gain deeper insights and understanding of the system. You have
- 21:01Speaker 2: to really think through the state's transitions and behaviors.
- 21:04Speaker 1: Now the model itself is valuable immensely.
- 21:07Speaker 2: Then you use algorithms or heuristics to automatically or semi
- 21:10Speaker 2: automatically generate test cases from the model. You run the tests,
- 21:15Speaker 2: analyze results, and potentially refine the model or the system.
- 21:19Speaker 2: Some models are more powerful than others. Peterson's lattice shows
- 21:23Speaker 2: a hierarchy where things like beatri nets can express concurrency
- 21:26Speaker 2: that simpler finite state machines can't.
- 21:29Speaker 1: Interesting okay, moving up the V model. Let's top integration
- 21:33Speaker 1: testing you mentioned earlier. This is often seen as tricky.
- 21:36Speaker 2: Yeah. It's often called the lyst well understood, and most
- 21:38Speaker 2: poorly done phase. This is where you start combining those
- 21:42Speaker 2: units that were tested individually, and you're looking for problems
- 21:44Speaker 2: at the interfaces between them where things connect exactly. Maybe
- 21:48Speaker 2: Unit A passes data incorrectly to unit B, or they
- 21:51Speaker 2: make different assumptions about shared data. These kinds of issues
- 21:55Speaker 2: only appear when you put them together.
- 21:57Speaker 1: How did people traditionally approach this?
- 22:00Speaker 2: Strategies were often decomposition based, like top down integration, where
- 22:04Speaker 2: you start with the main module and use stubs dummy
- 22:07Speaker 2: modules to simulate the ones it calls, or bottom up
- 22:11Speaker 2: where you start with the lowest level units and use
- 22:14Speaker 2: drivers to call them, building upwards or sandwich a mix
- 22:17Speaker 2: of both. What was the problem with those A key
- 22:19Speaker 2: issue is that the decomposition tree used for planning might
- 22:22Speaker 2: not match the actual call structure of the program. This
- 22:25Speaker 2: could lead you to design tests for interactions between units
- 22:29Speaker 2: that never actually call each other directly impossible.
- 22:32Speaker 1: Test pair wasted effort again, right.
- 22:34Speaker 2: So a better approach is call graph based integration. You
- 22:37Speaker 2: look at the real call graph units or nodes, calls
- 22:39Speaker 2: or edges and base your integration tests on actual feasible
- 22:43Speaker 2: paths between units.
- 22:45Speaker 1: Makes more sense. What about for object oriented systems?
- 22:48Speaker 2: For UVO software, the concept of MM paths method message
- 22:52Speaker 2: paths is useful. An MM path represents a sequence of
- 22:55Speaker 2: method executions within a single object, interspersed with messages sent
- 23:00Speaker 2: to other objects, which in turn trigger their methods. It
- 23:03Speaker 2: helps trace feasible execution flows across object boundaries during integration.
- 23:07Speaker 1: Okay, ensuring those interactions work. Finally, we reached the top
- 23:11Speaker 1: of the v system, testing the whole show bang.
- 23:13Speaker 2: Yep, testing the entire integrated system as a black box.
- 23:16Speaker 2: Usually from the end user's perspective. Here, we often think
- 23:20Speaker 2: in terms of atomic system functions ASFS. It's basically the
- 23:25Speaker 2: smallest observable interaction a user can have with the system
- 23:28Speaker 2: that accomplishes something meaningful, like inserting your card at an ATM,
- 23:33Speaker 2: entering your PI, requesting a balance. Each of those is
- 23:36Speaker 2: an ASF.
- 23:37Speaker 1: Got it and we also use use cases here right heavily.
- 23:40Speaker 2: Use cases describe sequences of actions involving the user and
- 23:43Speaker 2: the system to achieve a specific goal. They can be
- 23:46Speaker 2: high level user stories or very detailed step by step
- 23:49Speaker 2: real use cases specifying inputs, outputs, preconditions, post conditions. They
- 23:54Speaker 2: really define the system's behavior from that user viewpoint.
- 23:57Speaker 1: So system testing is very much about does it do
- 23:59Speaker 1: with the user needs exactly?
- 24:01Speaker 2: And to prioritize system testing, we often use operational profiles.
- 24:06Speaker 1: What do those tell you?
- 24:07Speaker 2: An operational profile tries to estimate how frequently different features
- 24:11Speaker 2: or sequences of actions threads will actually be used in
- 24:15Speaker 2: the real world. You gather statistics or make educated guesses
- 24:18Speaker 2: about usage.
- 24:19Speaker 1: Patterns that it's so useful.
- 24:21Speaker 2: It allows you to focus your testing effort on the
- 24:23Speaker 2: high traffic areas, the parts of the system that users
- 24:26Speaker 2: will interact with most often. Finding and fixing bugs there
- 24:29Speaker 2: gives you the biggest quality improvement for the user experience.
- 24:33Speaker 2: It's based on probabilities, often derived from models like finite
- 24:37Speaker 2: state machines representing usage smart prioritization.
- 24:40Speaker 1: Yeah, and system testing isn't just about function right, there's
- 24:43Speaker 1: non functional testing.
- 24:44Speaker 2: Too, absolutely crucial. This includes things like performance testing, security testing,
- 24:49Speaker 2: usability testing, and stress testing.
- 24:51Speaker 1: Pushing the system to its limit.
- 24:53Speaker 2: Yeah, seeing how it behaves under extreme load or adverse conditions.
- 24:56Speaker 2: How many users can handle concurrently? What happened when the
- 25:00Speaker 2: database gets huge? How does it recover from network failures?
- 25:04Speaker 2: Craftsmen use strategies like compression simulating large loads with smaller
- 25:10Speaker 2: representative test sets, or replication simulating potentially destructive tests in
- 25:15Speaker 2: a controlled environment.
- 25:16Speaker 1: Okay, that covers the main levels. Let's shift to some
- 25:19Speaker 1: more advanced perspectives. How do we even test systems made
- 25:22Speaker 1: of other systems? Systems of systems sos?
- 25:26Speaker 2: AH? Yes, SOS testing is a huge challenge. These are
- 25:29Speaker 2: systems built by integrating large scale, often independently managed, constituent
- 25:33Speaker 2: systems think air traffic control or complex financial networks.
- 25:38Speaker 1: They weren't necessarily designed to work together initially.
- 25:40Speaker 2: Often not. Jorgensen describes different types based on how much
- 25:43Speaker 2: central control exists. Directed sos are built for a specific purpose,
- 25:48Speaker 2: like a smart home system. Acknowledged sos have independent systems
- 25:51Speaker 2: that know about each other and work together loosely, like
- 25:54Speaker 2: maybe coordinating traffic lights across the city. Collaborative sos have
- 25:58Speaker 2: systems that volunteer to work together for a shared goal,
- 26:00Speaker 2: maybe during an emergency response. And virtual sos have no
- 26:04Speaker 2: central authority at all. They just interoperate dynamically when needed.
- 26:08Speaker 1: Like parts of the Internet, testing those interactions must be
- 26:11Speaker 1: incredibly complex.
- 26:12Speaker 2: It is you have to understand the communication protocols, the
- 26:15Speaker 2: potential emergent behaviors that arise from the interactions. Techniques involve
- 26:19Speaker 2: modeling the communications, perhaps using things like Petree nets mapped
- 26:23Speaker 2: to interface specifications, to understand how these independent giants influence
- 26:28Speaker 2: each other.
- 26:28Speaker 1: A whole other level of complexity. Now, let's come back
- 26:31Speaker 1: to something fundamental, evaluating our own tests. After all this effort,
- 26:36Speaker 1: how does a craftsmen know if their test cases are
- 26:38Speaker 1: actually any good?
- 26:39Speaker 2: That's the million dollar question, isn't it? How good are
- 26:41Speaker 2: my tests? You need ways to assess their effectiveness. One classic,
- 26:46Speaker 2: powerful technique is mutation testing.
- 26:49Speaker 1: You mentioned this briefly. How does it work again?
- 26:51Speaker 2: You take the original program that presumably passes all your
- 26:55Speaker 2: current tests. Then you automatically introduce lots of small, single
- 26:59Speaker 2: chain mutants. Each mutant version of the program has one
- 27:03Speaker 2: tiny fault deliberately inserted.
- 27:05Speaker 1: Like changing a plus to a flaint or to a frame.
- 27:08Speaker 2: Exactly simple syntactic changes. Then you rerun your entire test
- 27:13Speaker 2: suite against each mutant program.
- 27:14Speaker 1: What are you looking for?
- 27:15Speaker 2: You're looking for your test suite to kill the mutant,
- 27:18Speaker 2: meaning at least one test case fails when run against
- 27:21Speaker 2: that mutated code. If a mutant runs through your entire
- 27:24Speaker 2: test suite and doesn't cause any test to fail, it's
- 27:27Speaker 2: called a live mutant.
- 27:28Speaker 1: Yeah, that's bad.
- 27:29Speaker 2: That's bad. It means your test suite has a blind spot.
- 27:32Speaker 2: It wasn't sensitive enough to detect that specific small change,
- 27:36Speaker 2: which might represent a real potential bug. The ratio of
- 27:39Speaker 2: killed mutants to total mutants gives you a mutation score,
- 27:43Speaker 2: a quantitative measure of your test suite's thoroughness.
- 27:46Speaker 1: That urban legend about the mariner I probe.
- 27:48Speaker 2: Yeah, the story goes it failed due to a single
- 27:50Speaker 2: character typo in the code. Something. Mutation testing is designed
- 27:54Speaker 2: to catch. Whether the legend is perfectly accurate or not,
- 27:58Speaker 2: It highlights the principle small mistakes can have huge consequences,
- 28:03Speaker 2: and mutation testing helps find weaknesses and tests that might
- 28:06Speaker 2: miss them, so.
- 28:07Speaker 1: It tests the tests. What about fuzzing? That sounds less systematic.
- 28:11Speaker 2: It is less systematic, but surprisingly effective, especially for finding
- 28:14Speaker 2: security vulnerabilities and robustness issues. Fuzzing basically involves throwing large
- 28:20Speaker 2: amounts of random, semi random or malformed data out of
- 28:24Speaker 2: program's inputs.
- 28:25Speaker 1: Just trying to break it pretty much.
- 28:27Speaker 2: You're hoping that some unexpected inport combination will trigger a crash,
- 28:30Speaker 2: an assertion failure, a memory leak, or some other vulnerability.
- 28:34Speaker 2: It was famously discovered by accident when random noise on
- 28:37Speaker 2: a modem line caused Unix utilities to crash. The noise
- 28:41Speaker 2: was effectively fuzzing them.
- 28:42Speaker 1: Accidental discovery. Okay, And then there's that analogy for ecology, phishing,
- 28:46Speaker 1: creole counts, or fault insertion.
- 28:48Speaker 2: Right. This is another way to estimate test effectiveness, or
- 28:51Speaker 2: rather estimate the number of remaining faults. The analogy is
- 28:55Speaker 2: wildlife managers tagging some fish, releasing them, and then using
- 28:59Speaker 2: the portion of tagged fish caught later to estimate the
- 29:03Speaker 2: total fish population.
- 29:04Speaker 1: How does that apply to software?
- 29:06Speaker 2: You tag the software by intentionally inserting a known number
- 29:10Speaker 2: of representative faults seated faults. These should ideally be similar
- 29:14Speaker 2: in nature to the kinds of real faults you expect.
- 29:17Speaker 2: Then you run your test suite.
- 29:18Speaker 1: And see how many of the seated faults it finds.
- 29:21Speaker 2: Exactly. If your tests find, say eighty percent of the faults,
- 29:24Speaker 2: you deliberately inserted. You might infer that they've also likely
- 29:27Speaker 2: found about eighty percent of the original wild false that
- 29:30Speaker 2: were already in the code. It gives you a statistical
- 29:33Speaker 2: estimate of the remaining defects.
- 29:34Speaker 1: Clever, very clever. Okay, Finally, let's talk of the human
- 29:37Speaker 1: side of quality software. Technical reviews. Are these really a
- 29:41Speaker 1: form of testing?
- 29:42Speaker 2: Jorgenson argues strongly that they are. They're a form of
- 29:45Speaker 2: static testing without executing the code. Reviews aim to find
- 29:49Speaker 2: faults errors in code design documents, requirements before they have
- 29:54Speaker 2: a chance to become failures during execution.
- 29:57Speaker 1: And the economics are compelling, right.
- 29:59Speaker 2: Hugely compelling. Barry Boehm's classic research showed graphically that the
- 30:03Speaker 2: cost to fix a fault increases exponentially the later in
- 30:07Speaker 2: the development cycle.
- 30:08Speaker 1: It's found.
- 30:09Speaker 2: Finding a fault in a requirements document during a review
- 30:12Speaker 2: might cost pennies compared to finding the same underlying misunderstanding
- 30:15Speaker 2: after the system is deployed. It's the ultimate stitch in
- 30:18Speaker 2: time saves nine.
- 30:19Speaker 1: So what kinds of reviews are there?
- 30:21Speaker 2: There is a spectrum of formality. Walkthroughs are usually the
- 30:24Speaker 2: least formal, often led by the author of the work product,
- 30:28Speaker 2: code design doc their effectiveness can vary a lot depending
- 30:31Speaker 2: on the author's goals. At the other end is the
- 30:34Speaker 2: technical inspection, pioneered by Michael Fagan at IBM in the seventies.
- 30:38Speaker 2: These are highly structured and generally considered the most effective
- 30:42Speaker 2: type of review.
- 30:43Speaker 1: What makes them so.
- 30:43Speaker 2: Formal inspections involve documented processes, specific roles aither producer, moderator, leader, reader,
- 30:50Speaker 2: recorder inspectors, formal training for participants, budgeted time, detailed checklists
- 30:56Speaker 2: based on common error types, and a focus on finding
- 30:59Speaker 2: and logging defects, not fixing them during the meeting. Places
- 31:03Speaker 2: like telephone switching Labs developed incredibly rigorous inspection processes over
- 31:07Speaker 2: decades to achieve near fault free systems.
- 31:10Speaker 1: It sounds like a very disciplined process. What does it
- 31:12Speaker 1: take to make reviews work well in an organization? It's
- 31:15Speaker 1: not just process, is it?
- 31:17Speaker 2: Definitely not? Reviews are a deeply social process. For them
- 31:20Speaker 2: to be effective, the culture has to support them as
- 31:23Speaker 2: they need to be seen as valuable, a worthwhile investment
- 31:26Speaker 2: of time, not just overhead. Time needs to be budgeted
- 31:29Speaker 2: for preparation and participation. There needs to be clear etiquette.
- 31:33Speaker 2: You review the product, not the producer, the goal is
- 31:35Speaker 2: defect detection, not solution brainstorming or blaming. Keep it constructive, absolutely,
- 31:41Speaker 2: and generally it's best of direct managers don't participate in
- 31:44Speaker 2: the actual review meeting itself. That helps create a psychologically
- 31:48Speaker 2: safer environment where people feel more comfortable pointing out potential
- 31:52Speaker 2: issues without fear of evaluation.
- 31:54Speaker 1: Makes sense, create the right environment for finding faults. So
- 32:00Speaker 1: this up, What does this whole deep dive mean for you,
- 32:03Speaker 1: our listener? We've journeyed through this intricate world of software testing.
- 32:08Speaker 2: Yeah, from the basic definitions of errors and failures, through
- 32:11Speaker 2: all those unit testing techniques, the different life cycle approaches, integration,
- 32:16Speaker 2: system testing.
- 32:17Speaker 1: And finally looking at advanced topics like systems of systems,
- 32:20Speaker 1: evaluating our tests, and the critical role of technical reviews.
- 32:24Speaker 2: And throughout it all we've seen that software testing, when
- 32:27Speaker 2: done well, really is a craft.
- 32:28Speaker 1: What does that mean?
- 32:29Speaker 2: Ultimately, it means it requires deep knowledge of the principles
- 32:32Speaker 2: and techniques. It requires this skill to choose the right
- 32:34Speaker 2: tools for the job, just like any artisan, It requires
- 32:37Speaker 2: extensive experience to build intuition, and fundamentally, it requires a
- 32:41Speaker 2: dedication to high quality work, a sense of pride in
- 32:44Speaker 2: doing the job well.
- 32:46Speaker 1: Well said, it's about building confidence and quality through skill
- 32:50Speaker 1: and diligence. So for your provocative thought this week, step
- 32:54Speaker 1: back and consider how these principles of software testing might
- 32:56Speaker 1: apply beyond just code. Think about identifying folds early, rigorously
- 33:01Speaker 1: evaluating the effectiveness of your methods, or understanding complex systems
- 33:05Speaker 1: through their inputs, outputs, and interactions. Where in your own work,
- 33:08Speaker 1: or even your life might you benefit from applying a
- 33:11Speaker 1: bit of this craftsmanlike testing mindset. Where could a deep
- 33:15Speaker 1: dive using some of these concepts reveal ways to improve
- 33:18Speaker 1: quality or prevent problems?
- 33:20Speaker 2: Something to think about