Live data from Hacker News

Making Software Reliable: The Importance of Testability

codereliant.io

1–10 of 25 posts

Re: Making Software Reliable: The Importance of Testability

#2
I'm actually rather negative on automated testing.

Every project, that has gotten rid of the Q/A team to rely on automated tests, hasn't exactly gone well. Windows being the obvious example, but there are others. I'm not seeing the quality improvement that should be there. And even when there are tests, elementary mistakes (like the time Windows 10 would delete your Documents folder) slip through the pipeline and screw everything up. How is it that some of the most reliable software in the world (like the moon landing suite, the IRS tax system, or stock trading mainframes, or the Windows NT kernel) were written before automated tests; yet some of the buggiest software in the world is the most well-tested (like Windows 10, or Google Drive, or just about every SPA)?

In a team setting, they certainly seem to catch bugs. But is that because the tests have caught so many bugs that would've slipped into production; or is it that the team can afford to be careless now and writes sloppier code to begin with? I'm increasingly suspecting it's the latter, and while the tests catch most of the sloppiness, sometimes the slop passes...

Re: Making Software Reliable: The Importance of Testability

#3

I'm actually rather negative on automated testing. Every project, that has gotten rid of the Q/A team to rely on automated tests, hasn't exactly gone well. Windows being the obvious example, but there are others. I'm not seeing the quality improvement that should be there. And even when there are tests, elementary mistakes (like the time Windows 10 would delete your Documents folder) slip through the pipeline and scr…

I’ve worked on a large project that got more reliable after they removed the QA team. Removing the QA team was incidental to the quality improvement though — the QA team got removed because basically it was just producing a nightly report of problems that didn’t matter.

What actually improved quality on that project was, basically, architecture improvements. A major subsystem was rewritten in a way that made large classes of important bugs impossible. That rewrite was substantially supported by automated tests, though — a rather advanced simulation system IIRC.

I do agree that “automated tests” aren’t especially good at finding bugs. For that there’s really no replacement for human beings who care looking carefully at the system’s behavior, whatever title those people have. They’re mostly useful when they make it safer to make changes to the code’s design.

Re: Making Software Reliable: The Importance of Testability

#4

I'm actually rather negative on automated testing. Every project, that has gotten rid of the Q/A team to rely on automated tests, hasn't exactly gone well. Windows being the obvious example, but there are others. I'm not seeing the quality improvement that should be there. And even when there are tests, elementary mistakes (like the time Windows 10 would delete your Documents folder) slip through the pipeline and scr…

My view is that automated testing is not a substitute for QA, but an additional tool. It lets QA focus on harder to automated tasks.

For unit tests, a developer is going to try something out anyway, so capturing it in a unit test for the future should be just a little extra work. Also, writing a unit test means the developer has minimally used what they are writing.

Higher-level (system) testing, especially with GUIs, can be more work than the value added. It is a cost trade-off, but ultimately, a human adds value not matter how much automated.

AI will help too, but these are also tools. Drop QA and you are trading off costs for quality.

IMHO, not backed up by research.

Re: Making Software Reliable: The Importance of Testability

#5
post #4

I'm actually rather negative on automated testing. Every project, that has gotten rid of the Q/A team to rely on automated tests, hasn't exactly gone well. Windows being the obvious example, but there are others. I'm not seeing the quality improvement that should be there. And even when there are tests, elementary mistakes (like the time Windows 10 would delete your Documents folder) slip through the pipeline and scr…

My view is that automated testing is not a substitute for QA, but an additional tool. It lets QA focus on harder to automated tasks. For unit tests, a developer is going to try something out anyway, so capturing it in a unit test for the future should be just a little extra work. Also, writing a unit test means the developer has minimally used what they are writing. Higher-level (system) testing, especially with GUIs…

There is one programming language that fascinated me (maybe it was Ada) where it tried to have some basic tests inline with the code, by defining basic guidelines for legitimate results of the function.

For example, you could make a function called `addLaunchThrusterAndBlastRadius` (I know it make no sense, but bear with me), and then right alongside declaring it was an integer, you could put a limit saying that all results that this function can return must be greater than 5, less than 100, and not between 25 and 45. You could also do it when declaring variables - say, `blastRadius` may never be greater than 100 or less than 10, ever, without an exception.

I wish we could go further that direction. That's pretty cool. Sure, you can get that manually by throwing exceptions, but it was just so elegant that there was just no reason not to do it for every function possible.

Re: Making Software Reliable: The Importance of Testability

#6
post #4

Earlier quoted context omitted.

My view is that automated testing is not a substitute for QA, but an additional tool. It lets QA focus on harder to automated tasks. For unit tests, a developer is going to try something out anyway, so capturing it in a unit test for the future should be just a little extra work. Also, writing a unit test means the developer has minimally used what they are writing. Higher-level (system) testing, especially with GUIs…

There is one programming language that fascinated me (maybe it was Ada) where it tried to have some basic tests inline with the code, by defining basic guidelines for legitimate results of the function. For example, you could make a function called `addLaunchThrusterAndBlastRadius` (I know it make no sense, but bear with me), and then right alongside declaring it was an integer, you could put a limit saying that all…

You can do that in Swift (and, I suspect, lots of languages).

Swift has a fairly decent assertion/precondition facility, as well as reflection[0]. They also have a decent test framework[1] (and I know that some folks have extended it, to do some cool stuff).

Some of these add significant overhead, so they aren't practical for shipping runtime, but they can be quite useful for debug-mode validation.

Assertions are a very old technique. I think I first encountered them in Writing Solid Code, in the 1990s. Back then, we had to sort of "roll our own," but they have since, become integrated into languages.

Of course, all the tools in the world, are worthless, if we don't use them.

[0] https://developer.apple.com/documentation/swift/debugging-an...

[1] https://developer.apple.com/documentation/xctest/

Re: Making Software Reliable: The Importance of Testability

#7
can't access the article, but I'm big on testability. We used to have to watch each change like a hawk via monitoring and manual checks. We automated with SLO monitoring for prod and heavy use of gated builds protected behind integration and acceptance tests.

My favorite system designed and used so far:

PR -> gated integration build with docker-compose -> merge master -> async master/main re-run same test to prevent merge regression -> promote to staging -> semi-optional user test suite -> rolling deploy that will revert if error thresholds trip. This could deploy out to thousands of nodes in like 10 minutes from merge, though sometimes it would be closer to 20.

The whole team had huge confidence that anything deployed would not immediately explode. Unlocked a lot of velocity. Each team could do multiple deploys per day.

Re: Making Software Reliable: The Importance of Testability

#8

I'm actually rather negative on automated testing. Every project, that has gotten rid of the Q/A team to rely on automated tests, hasn't exactly gone well. Windows being the obvious example, but there are others. I'm not seeing the quality improvement that should be there. And even when there are tests, elementary mistakes (like the time Windows 10 would delete your Documents folder) slip through the pipeline and scr…

I tend to prefer test harnesses, over unit tests[0], but each definitely has its place.

Testing is good. Integration testing is very good. Someone posted a story, a few days back, that linked to a GIF of this video[1] (I want to go to the source -Facebook, unfortunately), with the caption: "When the unit tests pass, but the integration test does not."

[0] https://littlegreenviper.com/miscellany/testing-harness-vs-u...

[1] https://www.facebook.com/100001967368624/posts/2559941464081...

Re: Making Software Reliable: The Importance of Testability

#9

Earlier quoted context omitted.

There is one programming language that fascinated me (maybe it was Ada) where it tried to have some basic tests inline with the code, by defining basic guidelines for legitimate results of the function. For example, you could make a function called `addLaunchThrusterAndBlastRadius` (I know it make no sense, but bear with me), and then right alongside declaring it was an integer, you could put a limit saying that all…

You can do that in Swift (and, I suspect, lots of languages). Swift has a fairly decent assertion/precondition facility, as well as reflection[0]. They also have a decent test framework[1] (and I know that some folks have extended it, to do some cool stuff). Some of these add significant overhead, so they aren't practical for shipping runtime, but they can be quite useful for debug-mode validation. Assertions are a v…

> Of course, all the tools in the world, are worthless, if we don't use them.

True...

I wonder if there would be any way, to simplify the syntax, and require basic assertions to be on every function. There might be a super easy cop-out like `any`, but at least by being forced to type it, you become aware of what it means and that it exists.

Almost like:

`public any int addXandY (any int x, any int y) {`

I also wonder, if there could be such a thing as an `assertion exception` (or whatever it would be called). Maybe it would just make things a mess, but I'm just thinking out loud. Basically, you could have a function that behaves a specific way 90% of the time, but for that 10% of the time where it doesn't work, you could pass that assertion exception to override. Maybe that would just be awful... or it would keep functions much cleaner?

Maybe you wouldn't even call it an exception. You'd just have multiple sets of assertions that could be applied to each function call.

Re: Making Software Reliable: The Importance of Testability

#10
post #4

I'm actually rather negative on automated testing. Every project, that has gotten rid of the Q/A team to rely on automated tests, hasn't exactly gone well. Windows being the obvious example, but there are others. I'm not seeing the quality improvement that should be there. And even when there are tests, elementary mistakes (like the time Windows 10 would delete your Documents folder) slip through the pipeline and scr…

My view is that automated testing is not a substitute for QA, but an additional tool. It lets QA focus on harder to automated tasks. For unit tests, a developer is going to try something out anyway, so capturing it in a unit test for the future should be just a little extra work. Also, writing a unit test means the developer has minimally used what they are writing. Higher-level (system) testing, especially with GUIs…

Absolute one is not a replacement for the other.

I worked at a place that did pretty strict TDD and had a dedicated QA person embedded on each team. Our high-level systems tests severed more as a smoke tests and only ever tested the happy paths. Our integration and units tests of course covered a lot more, but QA was essential in covering corner cases we never thought about as developers.

Post reply on HN