White Paper on the
Importance, Techniques, and Application
of Unit Testing
Figure 1-- Unit Testing Word Cloud
1
Tariq Alharbi
IT355: Software Testing, Documentation, and Quality Assurance
Marymount University
Word Count: 2019
Dr. Murphy
October 4, 2016
I agree to uphold the principles of honor set forth by this community in the
Marymount University mission statement and the Academic Integrity Code and Community
Conduct Code, to defend these principles against abuse or misuse, and to abide by the
regulations of Marymount University
Table of Contents
Executive Summary ............................................................... 1
Problem Description and The Testing Dilemma ................... 2
The What and Why of Unit Testing ....................................... 3
The How: Unit Testing Methodology ................................... 4
When to Use Unit Testing...................................................... 6
Conclusion ............................................................................. 7
References & Citations .......................................................... 8
Notes:
[1] - Title Page word cloud generated on WordleTM on-line application
[2] - Section title graphics are original artwork create in Microsoft PowerPoint
[3] - “Coder” refers to original author of a code block (unit)
[4] - “Software Engineer” refers to anyone who codes, edits, debugs, reviews, or certifies code,
or anyone who integrates components into an overall application
White Paper: Importance, Techniques, and Applications of Unit Testing
Page: 1
Executive Summary
Software testing is the process of evaluating a system or its components with the intent to
find whether it satisfies the specified requirements or it does not. Although testing phases and
processes vary across development methodologies, an early phase is usually Unit Testing, which
leads to full Systems Testing and then User Acceptance Testing.
The goal of Unit Testing is ‘to take a small piece of testable software within an
application, isolate it from the remainder of the code, and determine whether it behaves exactly
as required and expected.’2 Unit tests are an important and cost-effect early step to insure
systems meet specifications, but also have side benefits including simplifying and better
structuring code.
This paper examines what unit testing is, how it is performed, and why it is so valuable.
Its goal is to convince the reader that a systems development approach that embeds rigorous
testing produces higher quality applications and, in the long-run, is cheaper and faster than
development without such a philosophy. Further, Unit testing should be applied broadly and
consistently within the testing processes to achieve maximum quality and benefit.
White Paper: Importance, Techniques, and Applications of Unit Testing
Page: 2
Problem Description and The Testing Dilemma
To most, the need for testing system is obvious and clear. How else can we know that a
system function as designed and desired? Do we allow an untested system to fail or deliver
incorrect result? Of course not! A website that is confusing or complex might sour customers
before it can be improved; an accounting system with a slight rounding across thousands of
transactions might add up to big money; an airline navigation system that fails could be
cataclysmic. Yet few understand the effort and discipline involved in proper testing, nor the
benefit, both obvious and unnoticed, that are gained. The need for rigorous testing and the best
ways to perform it are reasons why the field of systems testing is so extensive.
One problem in testing is that it is often not properly planned. Most knowledgeable
sources indicate that testing takes a significant amount of time, with IBM stating it should be
thirty to forty percent (30%-40%) or a development effort.3 Difficulty in planning is particularly
true for unit tests, where the effort is often dispersed across hundreds or thousands of units.
Many project plans clearly establish a systems testing phase, but often group coding and unit
testing together.
As with all testing, pressure and deadlines can cause a developer to cut corners, and here
is the basis of a developer’s dilemma. The delay and deadline pressure causes coders to program
faster, increasing the risk of defects and inefficient code, which causes more test time, which in
turn delays a project further and drives up costs. This is why it is important to set a “quality
first” attitude early in the project, aside from the benefits a unit testing discipline instills.
Other Unit Testing symptoms are the same as those that plague many other software
testing phases, but some are more specific to the Unit Testing Phase. In Unit Testing, an
White Paper: Importance, Techniques, and Applications of Unit Testing
Page: 3
individual coder often feels they have their own modules under control and, being too close,
makes assumptions about his/her own skills and his/her knowledge of what needs to be done.
They may also assume some code is trivial, when it is not. These views, whether confidence,
arrogance, or ignorance can be a trap.
Also, there is the issue of training. Developers need to know up-front individually and as
a team how to define units properly. They need to be have guidelines to determine what modules
require a unit test and education on how to develop test plans and document results. They need
to understand modular design principals including reuse and refactoring. Another issues in unit
testing include how and when to apply automated testing techniques and testing software.
The What and Why of Unit Testing
Unit testing refers to a software testing method in which the smallest testable parts of an
application (units) are individually and independently scrutinized for proper operation. 4 A unit
usually has one or a few inputs and one or a few outputs. In procedural programming, a unit
may be a program or module; in object-oriented programming, it is a method which may be part
of a class.5 Unit testing is the first line of testing. It is normally performed by software
developers themselves or their peers.
Unit testing is meant to verify that functions or code blocks work as expected. Given a
set of inputs, the tester determines if the piece of software is returning the proper values and that
it will gracefully handle failures/errors during execution. In some scientific studies, reductions
in the number of bugs found through unit testing are over 267% (i.e., over 60% of bugs are
detected).6
White Paper: Importance, Techniques, and Applications of Unit Testing
Page: 4
In addition to quality assurance, the discipline and process of unit testing drives toward
better application quality. The need to divide large systems into small discrete units itself makes
each unit smaller, self-contained, and more easily understood. This, in turn, makes corrections
and modifications simpler, faster, and cheaper. It is easier to find and fix defects, as there is less
analysis needed to locate the source of a defect and less code to traverse. In many cases the bug
can be fixed by the original coder which is less expensive than if the bug is fixed by someone
other than who coded it.7 The impact of changes to any one unit reduces the impact to any other
code. Debugging is easier, since when a test fails, only the latest changes need to be fixed where
in later testing phases (string or system) changes made over days or weeks may need to be
unraveled, removed, and re-applied. It forces code to be more modular and, therefore, easier to
reuse and/or refactor.
Shown here is a survey of
software developers and what
they believe are the greatest
benefits of unit tests. 72% see
unit test as a method to advance
quality assurance and almost
60% believe it reduces the cost
of fixing errors.8
Figure 2 -- Survey of Software Developers
The How: Unit Testing Methodology
Unit test are generally [1] conducted by a coder with sole ownership of a unit or [2] the
process begins and ends with a check-out from and check-in to a code repository by other
White Paper: Importance, Techniques, and Applications of Unit Testing
Page: 5
software engineers. A coder may also use check-in/check-out themselves. Check-in/check-out
ensures that only one person makes changes at a time to avoid conflicts, duplication, or
overwrites. The software
engineer then makes changes to
improve the quality of code. A
unit test plan is developed that
lists all conditions to test and
expected results traversing each
logic path. The unit test is
performed and defects/failures are
identified or it is verified that all
results are correct. Defects are
then corrected and the unit is reFigure 3- Unit Testing Process
tested. This is repeated until the
unit operates as required and the unit test is passed.
In the process, a tester may find ways to improve the coding, simplify the logic, combine
duplicate routines, and add more or more clear comments. As an additional safeguard, a Code
Review with peers is a best practice. Preparing for the review encourages a coder to well
organize, optimize, and document the unit and provides feedback from peers (i.e., other coders
and/or software engineers).
White Paper: Importance, Techniques, and Applications of Unit Testing
Page: 6
When to Use Unit Testing
Overall, it is a good idea to
unit test as much as possible.
However, some choose not to test
trivial code or private methods in
object oriented programming.
The more complex the code, the
more important it is to develop
Figure 4: Unit Test Use by Developers
unit tests.
In a recent survey of hundreds of developer, eighty-five percent reported that they write
unit tests. Of those that did, 65% had a positive view of their use.9 Of those that did, 65% had a
positive view of In the same
survey, almost half the
developers (47%) reported over
two thirds of the application code
was covered with unit testing,
while only 22% reported less
than a third was covered. Also
Figure 5: What is Unit Tested?
seen in Figure 4 is that about
75% of those that unit test covers all of the business logic and over 90% check all the pieces of
code they categorize as “critical.”
White Paper: Importance, Techniques, and Applications of Unit Testing
Page: 7
Conclusion
Unit testing is a technique, process, and set of activities with significant benefits not only
for quality assurance, but also for reducing costs, rework, and future maintenance. Among many
benefits, it verifies that a unit meets requirements, validates that code conforms to standards,
reduces the cost of fixes relative to later testing stages, simplifies later stages in testing,
minimizes rework, and simplifies fixes. It encourages modular design, reusability, and
refactoring, and it can improve design without breaking it. It forces a software engineer to plan
before coding, and it helps discover problems early in the development process.
Unit testing is considered a best practice by most industry experts. It is widely practiced,
with over 85% of developers engaged in this type of effort. The vast majority of developers use it
for all business logic and many use it for business, application, and all other logic.
White Paper: Importance, Techniques, and Applications of Unit Testing
Page: 8
References & Citations
1
Unit Testing Word Cloud [Original Graphic]. Generated from a word list
in on-line application WordleTM. © 2014, Jonathan Feinberg. Available at
http://www.wordle.net/
2
Microsoft Developer Network (2016). Unit Testing. © 2016, Microsoft.
Retrieved from https://msdn.microsoft.com/enus/library/aa292197%28v=vs.71%29.aspx?f=255&MSPPError=-2147217396
3
Suvarna, Vinod Kumar. Challenges of Managing a Testing Project (A
White Paper) [White Paper]. IBM, Bangalore. PDF retrieved from
http://www.qaielearning.com/KnowledgePapers/Challenges_Testing_Project.pdf
4
Rouse, Margaret (2016). Unit Testing. SearchSoftwareQuality. © 2016,
TechTarget. Retrieved from
http://searchsoftwarequality.techtarget.com/definition/unit-testing
• This source provided a concise definition of unit test in line with longer
definitions found at other sites and then provided useful links to
additional white papers, including one in the IBM DeveloperWorks
Library comparing the differences between unit testing and functional
testing and how to develop unit test plans.
5
Software Testing Fundamentals (2016). Unit Testing. © 2016, STF.
Retrieved from http://softwaretestingfundamentals.com/unit-testing/
6
Fagerburg, Paul and McInnes, Allan (2008). Develop Robust Firmware
Faster With Automated Unit Testing [White Paper]. ©, 2008, Syncroness.Inc. PDF
Retrieved from http://www.syncroness.com/wp-content/assets/pdfs/AutomatedUnit-Testing-White-Paper.pdf
• This source provided a working example of a white paper format. It
provided some general information about unit testing, although its
focus was on automated unit testing. It’s references and suggest
readings led to useful article on integration unit testing into broader
software development efforts.
7
Dutta, Sumit (2016(. White paper on unit testing [White Paper]. © 2016,
Linkedin Corporation. Retrieved from https://www.linkedin.com/pulse/whitepaper-unit-testing-sumit-dutta
8
Savvytest News (2014). Unit Test Survey Results. © 2007-2016,
Savignano Software Solutions. Retrieved from
http://www.savignano.net/en/news/newsletter/savvytest-2014-04/
9
Ben-Yehuda, Addie (2014). Survey: 85% of Developers Unit Test
[Infographic]. © 2016, The Unit Testing Blog—Typemock. Retrieved from
http://blog.typemock.com/2014/03/survey-85-of-developers-unit-testinfographics.html
White Paper: Importance, Techniques, and Applications of Unit Testing
Page: 9
Frequently used keywords: unit, test, testing, systems, software, development, methodology,
approach, phases
Frequently used modifiers: best, frequent, why use, reasons for, benefits of, issues about,
approach to, limits of
Frequently used reference sites: Bing.com, Google.com, About.com, Ask.com, Dictionary.com,
Merriam-Webster.com, Thesaurus.com
Sample searches: ‘benefits of unit testing’, ‘Microsoft testing white papers’, and ‘systems
development methodology’
Mohamed
Type to enter text
The Need for Installation Testing
Prepared for: Dr. Murphy
Prepared by: Abdullahi Mohamed
Date: February 17, 2016
Proposal Type: Final
Mohamed
Attribution Page:
Named: Abdullahi Mohamed
Institution: Marymount University
Discipline: Information Technology
Word Count: 1000
Date: February 17, 2016
Marymount Honor Pledge
I agree to uphold the principles of honor set forth by this community in the Marymount
University mission statement and the Academic Integrity Code and Community Conduct
Code, to defend these principles against abuse or misuse, and to abide by the regulations of
Marymount University.
Mohamed
Table of Contents
ABSTRACT:
1
CHALLENGE:
2
TESTING METHOD:
3
SOLVING THE CHALLENGE:
4
CONCLUSION:
LINKS:
5
6
Mohamed
Abstract:
The purpose of this white paper is to provide the reader a overview of the aspects of
software installation testing. We also cover the understanding of the procedures of installation
testing process, including the challenges that we face with our current technology relating to
installation. The purpose of installation testing is to verify if the software has been installed
correctly and the application is working. Installation testing is a key component of the
software lifecycle and the installation process goes through a beta phase to insure the the
software is functioning.
1
Mohamed
Challenge:
Installation testing is designed to help with the users first interaction with the program.
The challenge of installation testing is make sure that the software runs correctly once the
customer installs the program. Installation testing is part of the last phase of the software
development challenge. To prevent the interaction of the user of being a bad one or the
software program failing—installation testing is necessary to avoid these outcomes.
The importance of installation testing is to make a good impression on the customers’
first experience. Before starting out installation testing the tester must be aware of the
requirement of the client and the functions of the type of system the program well be running
on. Once the design team and the client team are aware of the scope of the project then the
installation testing will resolve any challenges that will occur at the users end.
2
Mohamed
Testing Method:
How does the installation testing method work? The installation test is designed to
check if the software is successfully installed and is running correctly, which is easy to do.
The testing occurs in the last phase of the software development life cycle to ensure that the
designer meets the requirements of the client and to ensure that the software is able to run
without any failures during the installation process of the customer. The tester is required to
test the software on different platforms and this is done in two ways: manual or automated
method. The phase of the installation testing is the most time consuming for the testing team
but is one of the major stages in testing.
The automated testing method uses automation tools, which run tests
that repeat predefined actions, which are parallel with the developers
program.
Manual testing is a method that is done manually and
consumes more time compared to automated testing. However, both are great
options for installation testing.
3
Mohamed
Solving the Challenge:
Before a company releases a product it must test the functions of the product and the
compatibility of it features. Installation testing solves the problem of the software from failing
once it reaches the customer. How does it solve that challenge? It solves this challenge by
testing the program before it is released. Failing to do installation testing can backfire on
companies because their product may not be compatible to their customers needs. Installation
testing saves software’s from failures by testing it on different platforms and running multiple
test cases.
Without installation testing software companies will lose on their investments. When
Apple releases new operating systems (OS) for it computers it runs installation testing to see
which products the OS can run on without affecting other applications. If the OS affects
applications and compatibility to the limited features of the computer then that computer
becomes obsolete. But if the OS has installation errors then Apple runs more test cases to
resolve the issue. Without this purpose Apple will have a lot of unhappy customers and a law
suits.
4
Mohamed
Conclusion:
For a tester to ensure software quality assurance on its software installation testing
must be done to meet the standards. Installation testing may be the most critical phase of the
software development because it is the last step before the customer interacts with your
product. This first interaction can be the last time that the customer uses another product
developed by your company or the start of trusted a relationship. When a customer makes a
purchases on a product they want it to function correctly on the first try, which is know as the
“first impression,” —this impression is the most important impression and you should ensure
that by running installation testing.
Each time development team releases software they want to be confident that their
product is working. To be certain that it will work they must run installation testing.
Installation testing is the safety net of the developers because they will be able to test and
correct errors before the customer interacts with the software and that is the goal of ever
developer.
5
Mohamed
Links:
White Papers:
Esg. The Surprising Economics of Engineered Systems for Big Data (n.d.): n. pag. Web.
White paper 1:
http://docs.media.bitpipe.com/io_12x/io_128403/item_1261736/The%20Surprising%20Economics%
20of%20Engineered%20Systems%20for%20Big%20Data.pdf
I use the above link to read up on white paper. Also, to the purpose of the white paper, which
covers big data and cost.
White paper 2:
"Open-source Software." AccessScience (n.d.): n. pag. Web.
http://docs.media.bitpipe.com/io_12x/io_127873/item_1280150/Open%20Source%20Integration%20
Software%20In%20The%20Enterprise.pdf
• I used this link to do more research on white papers and it was regards to open source
integration of software.
Work Citied:
"Top 10 Challenges Faced With Implementing Good Test Automation." 3Qi Labs. N.p., n.d. Web. 07
Feb. 2016.
Images:
http://cdn.electric-cloud.com/wp-content/uploads/installation-automation-devops.jpg
https://media.licdn.com/mpr/mpr/shrinknp_800_800/AAEAAQAAAAAAAASAAAAAJDEzZjVjY2RjLWQ3YW
MtNGM3OC04YzYzLWQzYWJiMDU2N2IwNA.jpg
http://image.slidesharecdn.com/softwaretesting-130708074539-phpapp02/95/software-testing-29638.jpg?cb=1373269709
http://cdn.softwaretestinghelp.com/wp-content/qa/uploads/2007/08/installation-testing.jpg
https://encryptedtbn2.gstatic.com/images?q=tbn:ANd9GcRUd41DchgCcNENUmhVsxB1mQGPiM1FJ0_zb7xRmyUpaau_IAkf
6
Purchase answer to see full
attachment