Unit1 Notes
Unit1 Notes
Introduction
Define software testing.
Software Testing is the process of executing a program with the intent of finding errors.
1
Chapter-1 Basics of Software Testing and Testing Methods
Testing Principles
#1) Testing Shows the Presence of Defects
Testing can show the defects are present, but cannot prove that there are no defects.
Even after testing the application thoroughly we cannot say that the product is 100%
defect free.
The objective of testing is to find more and more hidden defects using different techniques
and methods.
Testing can reveal undiscovered defects and if no defects are found then it does not mean
that the software is defect free.
Example 1:
Consider a Banking application, this application is thoroughly tested and undergoes different
phases of testing like SIT, UAT etc. and currently no defects are identified in the system.
However, there might be a possibility that in the production environment, the actual customer
tries a functionality which is rarely used in the banking system and the testers overlooked that
functionality, hence no defect was found till date or the code has never been touched by
developers.
Example 2:
We have seen several advertisements for soaps, toothpaste, handwash or disinfectant sprays etc
on television.
Consider a handwash advertisement which says on the television that 99% germs can be
removed if that specific handwash is used. This clearly proves that the product is not 100%
germ-free. Thus in our testing concept, we can say that no software is defect free.
2
Chapter-1 Basics of Software Testing and Testing Methods
3
Chapter-1 Basics of Software Testing and Testing Methods
In order to overcome this the set of test cases needs to be regularly reviewed and
revised.
Testing Terminologies
Failure : A failure is the inability of a software system or component to perform its required
functions within specified performance requirements. When a defect reaches the end customer it
is called a Failure.
4
Chapter-1 Basics of Software Testing and Testing Methods
Fault : It is an anomaly in the software that may cause it to behave incorrectly, and not
according to its specification.
Defect : It can be simply defined as a variance between expected and actual result. It is the
deviation of the customer requirement.
Bug : A bug is the result of a coding error. An Error found in the development environment
before the product is shipped to the customer. A bug is the terminology of Tester.
Testing is the process of identifying defects, where a defect is any variance between actual
and expected results.
Communication skills
Domain knowledge
Desire to learn
Technical skills
Analytical skills
Planning
Integrity
Curiosity
Think from users perspective
Be a good judge for product
Management decision.
Verification Phase:
1. Overall Business Requirement: In this first phase of the development cycle, the product
requirements are understood from customer perspective. This phase involves detailed
communication with the customer to understand his expectations and exact requirements.
2. Software Requirement: Once the product requirements are clearly known, the system can be
designed. The system design comprises of understanding & detailing the complete hardware,
software & communication set up for the product under development.
3. High level design: High level specification are understood & designed in this phase. Usually
more than one technical approach is proposed & based on the technical & financial feasibility,
the final decision is taken.
7
Chapter-1 Basics of Software Testing and Testing Methods
4. Low level design: In this phase the detailed integral design for all the system modules is
specified.
5. Coding:. A suitable programming language is decided based on requirements. Coding is done
based on the coding guidelines & standards.
Validation:
Unit Testing: Unit tests designed in the module design phase are executed on the code during
this validation phase. This helps to eliminate bugs at an early stage.
Components testing: This is associated with module design helps to eliminate defects in
individual modules.
Integration Testing: It is associated with high level design phase & it is performed to test the
coexistence & communication of the internal modules within the system
System Testing: It is associated with system design phase. It checks the entire system
functionality & the communication of the system under development with external systems.
Most of the software & hardware compatibility issues can be uncovered using system test
execution.
Acceptance Testing: It is associated with business requirement analysis and involves testing the
product in user environment.
8
Chapter-1 Basics of Software Testing and Testing Methods
Advantages of V-model:
Simple and easy to use.
Testing activities like planning, test designing happens well before coding.
Saves a lot of time.
Higher chance of success over the waterfall model.
Proactive defect tracking – that is defects are found at early stage.
Avoids the downward flow of the defects.
Works well for small projects where requirements are easily understood.
Disadvantages of V-model:
Very rigid and least flexible.
Software is developed during the implementation phase, so no early prototypes of
the software are produced.
If any changes happen in midway, then the test documents along with requirement
documents has to be updated.
When to use the V-Model
The V-shaped model should be used for small to medium sized projects where
requirements are clearly defined and fixed.
The V-shaped model should be chosen when ample technical resources are available with
needed technical expertise.
High confidence of customer s required for choosing the V-Shaped model approach.
Since, no prototypes are produced, there is a very high risk involved in meeting customer
expectations.
Difference between Verification & Validation
Verification Validation
1. Are you building it right? 1. Are you building the right thing?
2. Ensure that the software system 2. Ensure that functionalities meet the
meets all the functionality. intended behavior.
3. Verification takes place first and 3. Validation occurs after verification
includes the checking for and mainly involves the checking
documentation, code etc. of the overall product.
9
Chapter-1 Basics of Software Testing and Testing Methods
Give any four differences between Quality Assurance and Quality Control.
Quality Assurance Quality Control
1) Process oriented activities. 1) Product oriented activities.
2) QA is the process of managing for 2) QC is used to verify the quality of
quality. the output
3) They measure the process, identify 3) They measure the product, identify
the deficiencies/weakness and the deficiencies/weakness and
suggest improvements. suggest improvements.
4) Relates to all products that will ever 4) Relates to specific product
be created by a process
10
Chapter-1 Basics of Software Testing and Testing Methods
Methods of Testing
There are two methods of testing
1. Static testing
2. Dynamic testing
What is static testing
Static testing involves in reviewing the documents to identify the defects in the early stages of
SDLC.
Example : if you go to a car showroom to buy a car. What do you do? You take a look at the
color, interiors and exteriors of the car. You have not started or taken a test drive yet but you have
done some kind of testing . That would be an example of static testing.
What is dynamic testing.
Dynamic testing involves in the execution of code. It validates the output with the expected
outcome.
Example : Once you take a look at the car now you do the test drive so you can see how it
performed and is everything working well, as expected. That kind of testing would be an
example of dynamic testing
11
Chapter-1 Basics of Software Testing and Testing Methods
7. A failure of a white box test may result in a change that requires all black box testing to
be repeated and white box testing paths to be reviewed and possibly changed.
The goal of White Box testing is to verify all the decision branches, loops, statements in
the code.
To exercise the statements in the above code, White Box test cases would be
• A = 1, B = 1
13
Chapter-1 Basics of Software Testing and Testing Methods
• A = -1, B = -3
White Box Testing Tools
Below is a list of top white box testing tools.
• Veracode
• EclEmma
• RCUNIT
• NUnit
• JSUnit
• JUnit
• CppUnit
Each is tasked with reviewing the code from a different perspective, such as a User, a
tester, or a product support person.
This helps bring different views of the product under review and very often Identifies
different bugs.
One inspector is even tasked with reviewing the code backward—that is, from the end
to the beginning—to make sure that the material is covered evenly and completely.
15
Chapter-1 Basics of Software Testing and Testing Methods
2) In a walkthrough, the programmer who wrote the code formally presents (walks
through) it to a small group of five or so other programmers and testers.
3) The reviewers should receive copies of the software in advance of the review so
they can examine it and write comments and questions that they want to ask at the
review.
4) Having at least one senior programmer as a reviewer is very important.
3.Technical Review:
Describe technical review under static testing
i. Formal Review
ii. Peer Reviews
16
Chapter-1 Basics of Software Testing and Testing Methods
17
Chapter-1 Basics of Software Testing and Testing Methods
To assure that the review is highly effective all the participants need to make sure that the
four key elements of a formal review are in place: Look for problems , follow rules,
prepare for the review, and write a report.
Peer reviews are informal.
2. Code Coverage Testing: Code coverage determines which statements in a body of code have
been executed through a test run and which statements have not.
Code Coverage testing is determining how much code is being tested. It can be calculated
using the formula: Code Coverage = (Number of lines of code exercised)/(Total Number of
lines of code) * 100%
3. Code Complexity Testing : used for measuring the complexity of a software program.
Functional testing
18
Chapter-1 Basics of Software Testing and Testing Methods
• FUNCTIONAL TESTING is a type of software testing that validates the software system
against the functional requirements/specifications. ... Functional testing mainly involves black
box testing and it is not concerned about the source code of the application.
• It uses black-box testing techniques, in which the tester has no knowledge of the internal system
logic.
Functional Testing Types
• Unit Testing.
• Integration Testing.
• System Testing.
• Regression Testing.
• Smoke Testing.
• Acceptance Testing.
How is functional testing carried out?
Functions (or features) are tested by feeding them input and examining the output.
Functional testing ensures that the requirements are properly satisfied by the application. This
type of testing is not concerned with how processing occurs, but rather, with the results of
processing.
Functional testing is important because it always verifies that your system is fixed for release.
19
Chapter-1 Basics of Software Testing and Testing Methods
Decision Coverage
Branch Coverage
Condition Coverage
Statement Coverage
• Statement Coverage is a white box testing technique in which all the executable statements in
the source code are executed at least once.
• It is used for calculation of the number of statements in source code which have been executed.
• The main purpose of Statement Coverage is to cover all the possible paths, lines and statements in
source code.
Scenario 1:
If A = 3, B = 9
The statements marked in blue color are those which are executed as per the scenario
Number of executed statements = 5,
Total number of statements = 7
Statement Coverage: 5/7 = 71%
Scenario 2:
If A = -3, B = -9
20
Chapter-1 Basics of Software Testing and Testing Methods
The statements marked in blue color are those which are executed as per the scenario.
Number of executed statements = 6
Total number of statements = 7
21
Chapter-1 Basics of Software Testing and Testing Methods
Scenario 1:
Value of a is 2
The code highlighted in yellow will be executed. Here the "No" outcome of the decision If (a>5) is
checked.
Decision Coverage = 50%
Scenario 2:
Value of a is 6
The code highlighted in yellow will be executed. Here the "Yes" outcome of the decision If (a>5) is
checked.
Decision Coverage = 50%
1 2 2 50%
2 6 18 50%
Branch Coverage
Branch Coverage is a white box testing method in which every outcome from a code
module(statement or loop) is tested.
The purpose of branch coverage is to ensure that each decision condition from every branch is
executed at least once.
22
Chapter-1 Basics of Software Testing and Testing Methods
It helps to measure fractions of independent code segments and to find out sections having no
branches.
For example, if the outcomes are binary, you need to test both True and False outcomes.
The formula to calculate Branch Coverage:
Scenario : 1
Test case : 1
A=7
B=5
23
Chapter-1 Basics of Software Testing and Testing Methods
Branch covered = 1
Branch coverage = no of branches executed / total number of branches
= ½ = 50%
Scenario 2:
Test case 2:
A=5
B=7
Branch covered = 1
Branch coverage = no of branches executed / total number of branches
= ½ = 50%
24
Chapter-1 Basics of Software Testing and Testing Methods
25
Chapter-1 Basics of Software Testing and Testing Methods
This method is named so because the software program, in the eyes of the tester, is like a
black box; inside which one cannot see.
Black Box Testing is a software testing technique in which functionality of the software
under test is tested without looking at the internal coding structure.
The tester would only know the “legal” inputs and what the expected outputs should be,
but not how the program actually arrives at those outputs.
Also known as functional testing, behavioral testing, or specification-based testing.
Black box testing, which is also known as behavioral, opaque-box, closed-box,
specification-based, is a Software Testing method that analyses the functionality of a
26
Chapter-1 Basics of Software Testing and Testing Methods
software/application without knowing about the internal structure/design of the item that
is being tested
It compares the input value with the output value.
The main focus in black box testing is on the functionality of the system as a whole.
Steps :
Tester chooses some valid i/p's and checks whether S/W under test process them
correctly.
Tester chooses some invalid i/p's and checks whether S/W under test process
them correctly.
Tester determines expected O/P's for all those I/P's
Tester compares actual O/P's with expected O/P's.
Defects if any are fixed and retested.
27
Chapter-1 Basics of Software Testing and Testing Methods
28
Chapter-1 Basics of Software Testing and Testing Methods
other numbers are invalid values. Under this technique, boundary values 0, 1,2, 9,10,11 can be
tested.
Boundary values are validated against both the valid boundaries and invalid boundaries.
The Invalid Boundary Cases for the above example can be given as follows
0 - for lower limit boundary value
11 - for upper limit boundary value
Equivalence partitioning
In equivalence partitioning the range is divided into various classes and from each class
you test a single value, if it is pass the full class is pass and if it is fail the full class is
fail.
It saves time.
Examples of Equivalence Partitioning technique
Assume that there is a function of a software application that accepts a particular number of
digits, not greater and less than that particular number. For example, an OTP number which
contains only six digits, less or more than six digits will not be accepted, and the application will
redirect the user to the error page.
1. 1. OTP Number = 6 digits
29
Chapter-1 Basics of Software Testing and Testing Methods
30
Chapter-1 Basics of Software Testing and Testing Methods
In both examples, we can see that there is a partition of two equally valid and invalid partitions,
on applying valid value such as OTP of six digits in the first example and mobile number of 10
digits in the second example, both valid partitions behave same, i.e. redirected to the next page.
Another two partitions contain invalid values such as 5 or less than 5 and 7 or more than 7 digits
in the first example and 9 or less than 9 and 11 or more than 11 digits in the second example, and
on applying these invalid values, both invalid partitions behave same, i.e. redirected to the error
page.
We can see in the example, there are only three test cases for each example and that is also the
principal of equivalence partitioning which states that this method intended to reduce the number
of test cases.
Negative Testing:
Negative Testing is testing process where the system is validated against the invalid input data. A
negative test checks if a application behaves as expected with its negative inputs.
Such testing is to be carried out keeping negative point of view & only execute the test cases for
only invalid set of input data.
• Positive testing is carried out against the valid inputs,
31
Chapter-1 Basics of Software Testing and Testing Methods
32
Chapter-1 Basics of Software Testing and Testing Methods
Checks for valid set of values Checks for invalid set of values
Its done by giving the positive point of Its done by keeping the negative point
view Eg: Numbers like 9999999999 of view Eg: 99999abcde
Done to identify known set of test Done with unknown set of test
conditions conditions
In positive test scenarios, password test Password test box should not exceed
should accept 6- 20 characters more than 20 characters
Distinguish between white box testing and black box testing.(any six) 6M
1.This needs the knowledge of software in 1. This does not need the knowledge of
detail. software in detail
2. It is also called as transparent box or 2.It is also called as opaque box, dark box
glass box testing. testing
33
Chapter-1 Basics of Software Testing and Testing Methods
3.This can be performed by only developers 3. This can be performed by end users or
and professional testers. anyone.
4. The testing is proper here with respect to 4. The testing is only by trial and error
the domain ,data etc. methods.
MSBTE Questions
1. Define software testing.
2. List the objectives of software testing.
3. Describe the roles and responsibilities of a Test Leader.
4. Define following terms-Failure, Error, Defect and Bug.
5. Explain when to start and stop testing.
6. Explain verification and validation with neat diagram
7. Differentiate between Verification and Validation.
8. Define software Quality Assurance and software Quality Control.
9. Give any four differences between Quality Assurance and Quality Control.
10. Define Static testing and Dynamic testing.
11. Difference between Static testing and Dynamic testing.
12. Explain white box testing with example ?
13. Describe Inspection under static testing.
14. Describe technical review under static testing
i. Formal Review
ii. Peer Reviews
15. What is Formal Review? List four essential elements to a Formal Review.
16. Describe BLACK BOX TESTING
34
Chapter-1 Basics of Software Testing and Testing Methods
17. What is Requirement based testing. What are the Stages in Requirements based Testing:
18. Describe Boundary Value Analysis . What are three guidelines for boundary value
analysis
19. What is Equivalence partitioning .Explain with example
20. Describe positive testing & negative testing. Also write test cases for them.
21. Positive testing is carried out against the valid inputs,
22. In negative testing the application is validated against the invalid inputs.
23. Name some Positive Test Scenarios:
24. Name some Negative Test Scenarios:
25. Compare Positive and negative testing
26. Distinguish between white box testing and black box testing.(any six)
35