Information Technology Reference
In-Depth Information
outage caused by a file with incorrect permissions. Now a pre-submit check prevents that
same problem from reoccurring.
9.3.3 Build
During the build step, source files are processed to generate new artifacts. This usually
means source code is compiled to produce executable files. Other tasks such as converting
images from one format to another, extracting documentation from source code, running
unit tests, and so on might also be performed during this step.
This step is gated based on whether all the build processes complete successfully. The
most important of these checks are the unit tests . Unit tests are quality assurance tests that
can run on compilation units such as function libraries and object class definitions. In con-
trast, system tests ,discussed inthenextchapter,involverunningtheservice andtesting its
complete functionality.
Unit tests often take the form of an additional executable that does nothing except call
functions in the code in many different ways, checking whether the results are as expec-
ted. For example, suppose the source code includes a library of functions for manipulating
usernames.Supposeonefunctioninthelibrarytestswhetherastringcanbeusedasavalid
username. The unit test may call that function many times, each time testing a string that is
known to be invalid a different way (too short, too long, contains spaces, contains invalid
characters) to verify that all of those cases are rejected. Another unit test may do the in-
verse for strings that are known to be valid.
Unit tests can be rather sophisticated. For example, to test functions that need access to
a database, the unit test code may set up a mini-database with sample data. Setting up a
databaseiscomplex,sotestingframeworkshavebeendevelopedthatpermitonetoreplace
functions for testing purposes. For example, suppose you are testing a function that opens
a connection to a database, sends a query, and manipulates the results. You might replace
the “connect to database” function with one that does nothing and replace the “query data-
base” function with one that always returns a particular set of results. Now you can test the
function without needing to have an actual database.
Thisstep provides uswithanopportunity toperformaggressive testing early inthepro-
cess to avoid wasted effort later.
9.3.4 Package
During the package step, the files left behind from the previous step are used to create the
installationpackages.Apackageisasinglefilethatencodesallthefilestobeinstalledplus
themachine-readable instructionsforhowtoperformtheinstallation. Because itisasingle
file, it is more convenient to transport.
Search WWH ::




Custom Search