Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

CMP202 Lecture 4 - Program Testing

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 18

CMP 202- COMPUTER PROGRAMMING

II
LECTURE SERIES
OVERVIEW OF THE COURSE OUTLINE
Principles of Good programming
Structured programming concepts
Errors and Debugging
Testing
Text Files and IO
PROGRAM TESTING
• A Recap of What a Program mean
• A computer program is a set of instructions that is used as a process
of creating a software program by using programming language. It is
simply the collection of instructions for a computer to perform a
specific function and achieve a particular result.
• It is developed and used by a single programmer or group of
programmers.
• A program includes fewer features and limited functionalities. The
functionality of a program is dependent on the compiler.
• The size of the program is small that exists between kilobytes (Kb) to
Megabytes (Mb).
What is a Software?
• Software is a set of programs that enables the hardware to perform a
specific task.
• All the programs that run the computer are software. It is a collection
of procedures, instructions, documentation that tells a computer
exactly what to do or allows users to interact with a computer.
• Unlike hardware, the software can be seen but cannot be touched as
it is virtual, not physical. It can be affected by viruses. The size of
software is large as compared to programs. It has more features and
functionalities.
• Unlike the programs, software requires more time to be developed.
Its features include safety, security, correctness, etc.
• Software is compiled, tested, and debugged in the development
phase. Every software has a user interface that may be in graphical
WHAT IS TESTING?
• Testing is the process of executing a program to find errors. To make
our program/software perform well it should be error-free.
• If testing is done successfully it will remove all the errors from the
program/software.
• Software testing is the process of assessing the functionality of a
software program.
• The process checks for errors and gaps and whether the outcome of
the application matches desired expectations before the software is
installed and goes live.
TESTING TECHNIQUES
• There are two main methodologies of testing: white-box and black-
box testing.
• White-box testing examines the internal structure of a program and
attempts to test each logical case. White-box testing can be thought
of as "transparent" box testing: the tester can see and test a specific
section of code. For instance, in white-box testing, an IF-THEN-ELSE
statement would be tested with both a TRUE condition and a FALSE
condition. Unfortunately, there are a few problems with white-box
testing:
• the tester often does not have access to the source code
• white-box testing can be exponentially large (for n IF-THEN-ELSE statements,
there are 2n different combinations of values)
----TESTING TECHNIQUES
• These problems with white-box testing lead to the more practical
black-box testing methodology.
• Black-box testing (also known as data-driven or input/output-driven
testing) in which the tester views the program as a black box, and as
such, the inner workings of the program are unknown.
• The main tool used in black-box testing is the specification of the
program: that is, the tester attempts to determine what input causes
the output of the program to be different from what the
specifications would require.
----TESTING TECHNIQUES
• As a general rule within black-box testing, the tester should test the
"good" input (i.e. a positive integer), "bad" input (i.e. casual mistakes,
such as 04 instead of the integer 4), and the "ugly" input (i.e.
malicious mistakes, such as the string "Hello" instead of the integer 4).
• If you view "ugly" testing as unnecessary, and feel that that "Garbage
In, Garbage Out" (GIGO) should be the motto of testing, note that
others would strongly disagree: for instance, Beizer states "[GIGO] is
one of the worst cop-outs ever invented by the computer industry“. If
a program is designed to ensure that nuclear reactors run safely, and
the user happens to type "1.0" instead of "1" (Garbage In), it would be
disastrous to have a meltdown (Garbage Out).
• In summary the motto of proper programming should be: "Garbage In,
Nice-error-message Out."
WHY IS SOFTWARE TESTING IMPORTANT?
• Software testing is the culmination of application development
through which software testers evaluate code by questioning it.
• This evaluation can be brief or proceed until all stakeholders are satisfied.
• Software testing identifies bugs and issues in the development
process so they're fixed prior to product launch.
• This approach ensures that only quality products are distributed to
consumers, which in turn elevates customer satisfaction and trust.
REASONS FOR SOFTWARE TESTING
• The following are important reasons why software testing should be
incorporated into application development:
• Identifies defects early: Developing complex applications can leave room for
errors. Software testing is imperative, as it identifies any issues and defects
with the written code so they can be fixed before the software product is
delivered.
• Improves product quality: When it comes to customer appeal, delivering a
quality product is an important metric to consider. An exceptional product
can only be delivered if it's tested effectively before launch. Software testing
helps the product pass quality assurance and meet the criteria and
specifications defined by the users.
• Increases customer trust and satisfaction. Testing a product throughout its
development lifecycle builds customer trust and satisfaction, as it provides
visibility into the product's strong and weak points. By the time customers
---- REASONS FOR SOFTWARE TESTING
• Detects security vulnerabilities. Insecure application code can leave
vulnerabilities that attackers can exploit. Since most applications are
online today, they can be a leading vector for cyber attacks and should
be tested thoroughly during various stages of application
development.
• For example, a web application published without proper software
testing can easily fall victim to a cross-site scripting attack where the
attackers try to inject malicious code into the user's web browser by
gaining access through the vulnerable web application.
• The nontested application thus becomes the vehicle for delivering the
malicious code, which could have been prevented with proper
software testing.
---- REASONS FOR SOFTWARE TESTING
• Helps with scalability. A type of nonfunctional software testing
process, scalability testing is done to gauge how well an application
scales with increasing workloads, such as user traffic, data volume
and transaction counts. It can also identify the point where an
application might stop functioning and the reasons behind it, which
may include meeting or exceeding a certain threshold, such as the
total number of concurrent app users.
• Saves money. Software development issues that go unnoticed due to
a lack of software testing can haunt organizations later with a bigger
price tag. After the application launches, it can be more difficult to
trace and resolve the issues, as software patching is generally more
expensive than testing during the development stages.
STEPS IN SOFTWARE TESTING
• 1. Verification: it refers to the set of tasks that ensure that the
software correctly implements a specific function.
• “Are we building the product right?”
• 2. Validation: it refers to a different set of tasks that ensure that the
software that has been built is traceable to customer requirements.
• “Are we building the right product?”
CLASSIFICATION OF SOFTWARE TESTING
Software Testing can be broadly classified into two types:
• 1. Manual Testing: Manual testing includes testing software manually, i.e., without using
any automation tool or any script. In this type, the tester takes over the role of an end-
user and tests the software to identify any unexpected behavior or bug. There are
different stages for manual testing such as unit testing, integration testing, system testing,
and user acceptance testing.
• Testers use test plans, test cases, or test scenarios to test software to ensure the
completeness of testing. Manual testing also includes exploratory testing, as testers
explore the software to identify errors in it.
• 2. Automation Testing: Automation testing, which is also known as Test Automation, is
when the tester writes scripts and uses another software to test the product. This process
involves the automation of a manual process. Automation Testing is used to re-run the
test scenarios quickly and repeatedly, that were performed manually in manual testing.
• Apart from regression testing, automation testing is also used to test the application from
a load, performance, and stress point of view. It increases the test coverage, improves
accuracy, and saves time and money when compared to manual testing.
LEVELS OF SOFTWARE TESTING
Software level testing can be majorly classified into 4 levels:
• Unit Testing: A level of the software testing process where individual
units/components of a software/system are tested. The purpose is to
validate that each unit of the software performs as designed.
• Example: For example, there is a straightforward calculator program.
The unit test can be written by the developer to determine whether
the user enters two numbers and obtains the correct total for the
additional capability.
---- LEVELS OF SOFTWARE TESTING
• Integration Testing: A level of the software testing process where
individual units are combined and tested as a group. The purpose of
this level of testing is to expose faults in the interaction between
integrated units.
• Example: When an airline's website is used by a user to purchase a
ticket, compatibility testing should be conducted when integrating an
airline website with a payment processing system.
---- LEVELS OF SOFTWARE TESTING
• System Testing: A level of the software testing process where a
complete, integrated system/software is tested. The purpose of this
test is to evaluate the system’s compliance with the specified
requirements.

• Acceptance Testing: A level of the software testing process where a


system is tested for acceptability. The purpose of this test is to
evaluate the system’s compliance with the business requirements and
assess whether it is acceptable for delivery.
How to Achieve Effective Software Testing
• Produce thorough bug reports - Document thorough bug reports of
the program after the testing process so that the bugs can be fixed
accordingly.
• Produce concise test cases - Work and produce concise test cases to
refer to them during future testing.
• Participate and talk - Participate in team discussions and meetings
and talk about your test findings to find easy solutions.
• Pose inquiries to yourself - Question yourself about certain doubts
and try to find answers for the same.
• Be optimistic - Always maintain a positive attitude and optimism
while finding a solution for the problems found in the programs.

You might also like