There are methods of writing (and executing) structured test plans. Usually, these test plans are written parallel to and in conjunction with the code specification. These include vectors that test for allowed/disallowed inputs, all possible conditions and branches, and tests for common errors such as null pointers and buffer overflows.That every system should be designed and tested until it is error-free and 100% reliable?
This stuff wasn't taught in engineering school (I studied for a Computer Engineering track EE degree). I learned one of the methods on my first job.
Testing needs to be a large part of software development. The metric we used was 40% time on code, 60% on testing, and 100% coverage of code in the test plan. And no excuses.
Good code and good testing is possible. With the ease of transmitting patches and updates via the internet, I think the emphasis on testing has waned.
But the importance of testing is finding a resurgence: IoT can make for lots of little evil bots that can do lots of damage very quickly.