![](https://csdnimg.cn/release/download_crawler_static/444503/bg14.jpg)
20
Code-Generation Utilities
1. genlookup.pro : Generates a lookup procedure that returns a row in a table.
2. msginfo.pkg : Generates a package with definitions for all application-specific
exceptions.
3. genmods.pkg : Generates standard formatted functions.
DEV-06: Set up and use formal unit testing
procedures.
A unit test is a test a developer creates to ensure that his or her "unit," usually a
single program, works properly. A unit test is very different from a system or
functional test; these latter types of tests are oriented to application features or
overall testing of the system. You can't properly or effectively perform a system test
until you know that the individual programs behave as expected.
So, of course, you would therefore expect that programmers do lots of unit testing
and have a correspondingly high level of confidence in their programs. Ah, if only
that were the case! The reality is that programmers generally perform an inadequate
number of inadequate tests and figure that if the users don't find a bug, there is no
bug. Why does this happen? Let me count the ways:
The psychology of success and failure
We are so focused on getting our code to work correctly that we generally shy
away from bad news, from even wanting to take the chance of getting bad
news. Better to do some cursory testing, confirm that it seems to be working
OK, and then wait for others to find bugs, if there are any (as if there were
any doubt).
Deadline pressures
Hey, it's Internet time! Time to market determines all. We need everything
yesterday, so let's be just like Microsoft and Netscape: release pre-beta
software as production and let our users test/suffer through our applications.
Management's lack of understanding
IT management is notorious for not really understanding the software
development process. If we aren't given the time and authority to write (write,
that is, in the broadest sense, including testing, documentation, refinement,
etc.) our own code properly, we will always end up with buggy junk that no
one wants to admit ownership of.
Overhead of setting up and running tests
If it's a big deal to write and run tests, they won't get done. I don't have time,
and there is always something else to work on. One consequence of this point