New Chaps Qa
New Chaps Qa
In structural testing, the software is viewed as a white box and test cases are
determined from the implementation of the software.
Structural testing techniques include control flow testing and data flow testing
Control Flow Testing
Control flow testing uses the control structure of a program to develop the test
cases for the program.
The test cases are developed to sufficiently cover the whole control structure of
the program.
The control structure of a program can be represented by the control flow graph
of the program.
Control Flow Testing
1 3 3 50%
2 7 21 50%
Control Flow Testing
Path Coverage testing
It is a structured testing technique for designing test cases with intention to examine all
possible paths of execution at least once.
Creating and executing tests for all possible paths results in 100% statement coverage
and 100% branch coverage.
In this type of testing every statement in the program is guaranteed to be executed at
least one time. Flow Graph, Cyclomatic Complexity are used to arrive at basis path
int a = 10; • Branch coverage requires that the condition a > 0 is executed
if (a > 0) at least once.
{ • Condition coverage requires that both the outcomes a > 0 =
cout<<"a is positive"; True and a > 0 = False of the condition a > 0 are executed at
} least once.
Control Flow Testing
int num1 = 0; The condition coverage testing of the code above will be
if(num1>0){ as follows:
Test case number
cout<<"valid input"; num1>0 Final output
}
4 False True False False
Case 1:
• If A = 7, B= 3
• No of statements Executed= 5
e.g. 1: • Total statements= 7
• Statement coverage= 5 / 7 * 100
Read A • = 71.00 %
Read B
if A > B Case 2:
Print “A is greater than B” • If A = 4, B= 8
else • No of statements Executed= 6
Print “B is greater than A” • Total statements= 7
End if • Statement coverage= 6 / 7 * 100
• = 85.20 %
Control Flow Testing
Example 2: Case 1:
• If A = 4, B= 8
print (int a, int b)
• No of statements Executed= 6
{ • Total statements= 8
int sum = a + b; • Statement coverage= 6 / 8 * 100
• = 75.00 %
if (sum > 0)
print (“Result is positive”)
else
print (“Result is negative”)
Case 2:
} If A = 4, B= -8
No of statements Executed= 7
Total statements= 8
Statement coverage= 7 / 8 * 100
= 87.50 %
Control Flow Testing
In the internal code structure, there are Why is statement coverage used?
loops, arrays, methods, exceptions, and
control statements. • To check the quality of the code.
Some code would be executed based on • To determine the flow of different paths of
input while some may not. the program.
Statement coverage will execute all • Check whether the source code expected to
possible paths and statements of the code perform is valid or not.
Statement coverage covers: • Tests the software’s internal coding and
Dead code. infrastructure.
Unused statements. Drawback of Statement Coverage:
Unused branches. • Cannot check the false condition.
Missing statements.
• Different input values to check all the
conditions.
• More than one test case may be required to
cover all the paths with a coverage of 100%.
What is Data Flow Testing:
It is a method that is used to find the test paths of a program according to the locations of definitions
and uses of variables in the program.
It has nothing to do with data flow diagrams. Furthermore, it is concerned with:
Statements where variables receive values,
Statements where these values are used or referenced.
To illustrate the approach of data flow testing, assume that each statement in the program assigned a
unique statement number.
For a statement number S-
DEF(S) = {X | statement S contains the definition of X}
USE(S) = {X | statement S contains the use of X}
If a statement is a loop or if condition then its DEF set is empty and USE set is based on the condition
of statement s.
Data Flow Testing uses the control flow graph to find the situations that can interrupt the flow of the
program.
What is Data Flow Testing
Reference or define anomalies in the flow of the data are detected at the time of associations
between values and variables.
These anomalies are:
Using a variable without declaration
Deleting a variable without declaration
Defining a variable two times
Deleting a variable without using it in the code
Deleting a variable twice
Using a variable after deleting it
Not using a variable after defining itAn anomaly is denoted by a two character sequence
of actions
Example: 'ku' means that the object is killed and then used, where as 'dd' means that the
object is defined twice without an intervening usage
What is Data Flow Testing
Types of Data Flow Testing:
Testing for All-Du-Paths:
It Focuses on “All Definition-Use Paths.
All-Du-Paths is an acronym for “All Definition-Use Paths.”
Using this technique, every possible path from a variable’s definition to every usage
point is tested.
All-Du-Path Predicate Node Testing:
This technique focuses on predicate nodes, or decision points, in the control flow
graph.
All-Uses Testing:
This type of testing checks every place a variable is used in the application.
All-Defs Testing:
This type of testing examines every place a variable is specified within the
application’s code.
What is Data Flow Testing
Testing for All-P-Uses:
All-P-Uses stands for “All Possible Uses.” Using this method, every potential use of a variable is tested.
All-C-Uses Test:
It stands for “All Computation Uses.”
Testing every possible path where a variable is used in calculations or computations is the main goal of this
technique.
Testing for All-I-Uses:
All-I-Uses stands for “All Input Uses.”
With this method, every path that uses a variable obtained from outside inputs is tested.
Testing for All-O-Uses:
It stands for “All Output Uses.”
Using this method, every path where a variable has been used to produce output must be tested.
Testing of Definition-Use Pairs:
It concentrates on particular pairs of definitions and uses for variables.
Testing of Use-Definition Paths:
This type of testing examines the routes that lead from a variable’s point of use to its definition.
What is Data Flow Testing
x 1 2, 3
y 1 2, 4
a 3, 4 5
What is Data Flow Testing
Data flow testing criteria
Control flow diagrams are a keystone in testing the structure of software programs.
By examining the flow of control between the various components, we can design and select test cases.
Data-flow testing is a control-flow testing technique which also examines the lifecycle of data variables.
Techniques of data flow testing
Data flow testing can be done using one of the following two techniques:
Control flow graph
Making associations between data definition and usages
Control flow graph
A control flow graph is a graphical representation of the flow of control, i.e., the order of statements in which they will
be executed.
Consider the following piece of pseudo-code:
What is Data Flow Testing
1, 4, 5, 6
What is Data Flow Testing
Making associations
In this technique, we make associations between two kinds of statements:
Where variables are defined
Where those variables are used
An association is made with this format:
(line number where the variable is declared, line number where the variable is used, name of the
variable)
For example, (1, 3, x) would mean that the variable ‘x’ is defined on line 1 and used on line 3.
Now, consider the following piece of pseudo-code:
1. input(x)
2. if(x>5)
3. z = x + 10
4. else
5. z=x-5
6. print("Value of Z: ", z)
What is Data Flow Testing
For the above snippet of pseudo-code, we will make the following associations:
(1, (2,t), x): for the true case of IF statement in line 2
(1, (2,f), x): for the false case of IF statement in line 2
(1, 3, x): variable x is being used in line 3 to define the value of z
(1, 5, x): variable x is being used in line 5 to define the value of z
(3, 6, z): variable z is being used in line 6, which is defined in line 3
(5, 6, z): variable z is being used in line 6, which is defined in line 5
The first two associations are for the IF statement on line 2. #
One association is made if the condition is true, and the other is for the false case.
What is Data Flow Testing
Now, there are two types of uses of a variable:
predicate use: the use of a variable is called p-use. Its value is used to decide the flow of the
program, e.g., line 2.
computational use: the use of a variable is called c-use when its value is used compute another
variable or the output, e.g., line 3.
After the associations are made, these associations can be divided into these groups:
All definitions coverage
All p-use coverage
All c-use coverage
All p-use, some c-use coverage
All c-use, some p-use coverage
All uses coverage
Once the associations are divided into these groups, the tester makes test cases and examines each
point.
The statements and variables which are found to be extra are removed from the code.
Domain Testing
Domain testing is a testing process where the software is tested to ensure it doesn't accept invalid or
out-of-range values.
The output is tested against a minimum number of inputs to see whether the system is accepting the
input within the required range or not.
The white box testing is a perfect example of domain testing.
What is White Box Testing?
In this process, testing engineers test the internal structure, coding, and software design, making sure it goes
with the input-output flow.
It also determines the design, usability, and overall security of the software.
Since the code is visible to the testers, white box testing is also called the clear box, transparent box, glass box,
and code-based testing.
This is because white box testing allows testers to penetrate the outer shell of an application and look at its
inner structure.
White box testing and black box testing both come under software testing.
The difference is that in a black box, the software is tested based on its external and end-user perspective.
However, in the white box, testing is done to analyze the inner structure of the product.
Domain Testing
Domain Testing Strategy
A specific boundary defines every domain.
During the test, testers analyse each point nearby those boundaries.
Each testing process starts with a question, and the purpose of domain testing is to find solutions
to these questions.
What domains to choose for the testing process?
What values should one choose for the test?
How do you group values into classes?
How do you get the results?
Example of Domain testing
Let's say there is a group of students in a hall.
They have been given a set of tasks based on their age and gender inputs.
Here, you can consider the hall as the test, age groups as boundary values with numerous
possible scenarios.
Domain Testing
Tasks are given to students in the following ways −
Students under ten are asked to draw.
Boys 10 >= 15 are asked to compete in a race
Girls 10 >= 15 are asked to participate in a sport
Boys > 15 are asked to dance
Girls > 15 are asked to sing
Reaming > 15 students are asked to give a presentation
After having the above algorithms, testers need to group the values into classes.
One can classify students into age groups, then set boundary values such as highest and lowest age values.
What domains are tested in Domain Testing?
You can test any domains containing input and output functionality.
First, one needs to enter the input value and verify the output.
How do you group values into classes?
For grouping values into classes, you need to partition the values into subsets.
Domain Testing
You can partition values in two ways −
Equivalence Partitioning
In this process, you have to divide a set of test conditions into groups or set in a way
that the system handles them equivalently.
In short, the system should consider these partitions as the same.
Variable Valid Class Invalid Class Boundaries &
Equivalence Equivalence Special cases
Class Class
X 0-20 0
20
<0 -1
>20 21
Domain Testing
Explanation −
If a field accepts ranges between 0-20, then it should not accept invalid entries and out of
boundaries entries like -1 and 21.
The field should only accept values 0, 20, and any number in between them.
Boundary Testing
Boundary testing analysis or BVA is a process to test boundaries between partitions.
In this process, you will have to test both valid and invalid input values from the partition.
Example − Let's say you are ordering a sandwich through an online platform, and you are asked
to enter the number of sandwiches you are intended to order.
Now, it's a rule that a single customer can only order up to 10 sandwiches.
So, when you enter the value 1 to 10, it is considered valid.
A success message will be displayed.
If you choose 11 to 99, it will be considered invalid, leading to an error message.
Domain Testing
Which values of the classes were tested in domain testing?
You need the boundary values to test the values of the class.
Example derived from the previous case.
Test condition −
Number > 10 in the sandwich field is invalid.
Number < 1 is considered invalid.
Number 1 to 10 is valid.
Three-digit numbers are invalid.
Domain Testing
How to determine the result?
The output results are determined through domain knowledge.
How to formulate a domain testing structure?
Analyze beforehand what can go wrong while setting boundaries
Prepare strategies to handle each case
Checkpoints to conduct error testing
Use one test point to evaluate adjacent domains
Check off unnecessary test points
Run the test
Check for errors in boundaries
Verify every boundary are free from defects
Domain Testing
Is it important to have domain knowledge for domain testing?
It is highly important to have at least basic domain knowledge for an expert to
conduct domain testing.
Domain knowledge is crucial as each industry or field is unique and has specific
requirements.
Retail − In retail domains, the workflow runs at different levels. Therefore, testing
engineers looking forward to running domain testing in retail must know how
things work in warehouse management, in-store solutions, and so on.
Online Banking − Online backing consists of several crucial internet-dependent
activities such as login, money transfer, bill payment, etc., which is quite different
than retails.
Healthcare − Handling healthcare domains is quite critical as it holds a huge risk to
someone's life. Besides, it includes numerous menial yet time-consuming tasks like
patient's entry, health history, prescriptions, setting & modifying schedules,
insurance, etc.
System Integration
Testing
The Concept of Integration Testing
The problem arises when we “put modules together” because of interface errors
Interface errors
Interface errors are those that are associated with structures existing outside the
local environment of a module, but which the module uses
Types
Construction
Some programming languages, such as C, generally separate the interface
specification from the implementation code
Different Types of Interfaces
In a C program, programmers can write a statement
#include header.h where header.h contains an interface specification.
Since the interface specification lies somewhere away from the actual code,
programmers overlook the interface specification while writing code.
Therefore, inappropriate use of #include statements cause construction errors.
Inadequate functionality
These are errors caused by implicit assumptions in one part of a system that
another part of the system would perform a function.
However, in reality, the “other part” does not provide the expected functionality –
intentionally or unintentionally by the programmer who coded the other part.
Different Types of Interfaces
Location of Functionality
Disagreement on or misunderstanding about the location of a functional capability within the
software leads to this sort of error.
The problem arises due to the design methodology, since these disputes should not occur at the
code level.
It is possible that inexperienced personnel contribute to the problem.
Changes in Functionality
Changing one module without correctly adjusting for that change in other related modules
affects the functionality of the program.
Added Functionality:
A completely new functional module, or capability, was added as a system modification.
Any added functionality after the module is checked in to the version control system without a
CR is considered to be an error.
Different Types of Interfaces
Misuse of Interface
One module makes an error in using the interface of a called module.
Interface misuse can take the form of wrong parameter type, wrong parameter
order, or wrong number of parameters passed.
Inadequate Error Processing
A called module may return an error code to the calling module.
However, the calling module may fail to handle the error properly.
Violation of Data Constraints
A specified relationship among data items was not supported by the
implementation.
Top-down
Bottom-up
Sandwich
Big-bang
Incremental
The number of SIT cycles and the total integration time are determined by the
following parameters:
Number of modules in the system
Relative complexity of the module (cyclomatic complexity)
Relative complexity of the interfaces between the modules
Number of modules needed to be clustered together in each test cycle
Whether the modules to be integrated have been adequately tested before
Turnaround time for each test-debug-fix cycle
Incremental
A test strategy is created for each new build and the following issues are
addressed while planning a test strategy
What test cases need to be selected from the SIT test plan?
What previously failed test cases should now be re-executed in order to
test the fixes in the new build?
How to determine the scope of a partial regression tests?
What are the estimated time, resource demand, and cost to test this build?
Incremental
Advantages
One designs the behaviour of a test driver by simplifying the behaviour of the actual
module
If the low-level modules and their combined functions are often invoked by other modules,
then it is more useful to test them first so that meaningful effective integration of other
modules can be done
Disadvantages
Discovery of major faults are detected towards the end of the integration process, because
major design decision are embodied in the top-level modules
Test engineers can not observe system-level functions from a partly integrated system.
In fact, they can not observe system-level functions until the top-level test driver is in place
Big-bang and Sandwich
Big-bang Approach
First all the modules are individually tested
Next all those modules are put together to construct the entire system which is tested as a whole
Sandwich Approach
In this approach a system is integrated using a mix of top-down, bottom-up, and big-bang
approaches
A hierarchical system is viewed as consisting of three layers
The bottom-up approach is applied to integrate the modules in the bottom-layer
The top layer modules are integrated by using top-down approach
The middle layer is integrated by using the big-bang approach after the top and the bottom
layers have been integrated
Software and Hardware Integration
Thermal Test
Environment Test
Safety Test
Reliability Test
Hardware and Software Compatibility Matrix
Test Title
Introduction
Test Objective
Acceptance Test Category
Test Procedure
Operation Environment
Test Schedule
Test case ID
Resources
Acceptance Testing
The acceptance test activities are designed to reach at one of the conclusions
Accept the system as delivered
Accept the system after the requested modifications have been made
Do not accept the system
Acceptance Test Report - Attributes
The Acceptance test Report has the following attributes
Report Identifier
Summary of Results
Variations
Recommendations
Summary of To-DO List
Approval Decision
Types of Acceptance Testing
Advantages of Acceptance Testing
This testing helps the project team to know the further requirements from the users directly as it involves the
users for testing.
Automated test execution.
It brings confidence and satisfaction to the clients as they are directly involved in the testing process.
It is easier for the user to describe their requirement.
It covers only the Black-Box testing process and hence the entire functionality of the product will be tested.
Disadvantages of Acceptance Testing
Users should have basic knowledge about the product or application.
Sometimes, users don’t want to participate in the testing process.
The feedback for the testing takes a long time as it involves many users and the opinions may differ from one
user to another user.
Development team is not participated in this testing process.
Unit-5 Topics
Legal, Ethical, and Professional Aspects of Testing
Outline
Legal, Ethical, and Professional Aspects of Testing
The Ethical Software Tester
Professional Responsibility of Software Tester
ACM Code of Professional Conduct and Ethics
Ethics is a practical branch of philosophy that deals with moral questions such as what is right or
wrong, and how a person should behave in a given situation in a complex world.
Ethics explore what actions are right or wrong within a specific context or within a certain
society and seek to find satisfactory answers to moral questions.
Cultural relativism argues that the particular society determines what is right or wrong based
upon its cultural values.
Deontological ethics argues that there are moral laws to guide people in deciding what is right or
wrong.
Utilitarianism which argues that an action is right if its overall affect is to produce more
happiness than unhappiness in society.
Professional ethics are a code of conduct that governs how members of a profession deal with each other and with third
parties.
A professional code of ethics expresses ideals of human behaviour, and it defines the fundamental principles of the
organization and is an indication of its professionalism.
Business ethics define the core values of the business and are used to guide employee behaviour.
Business ethics (also called corporate ethics) are concerned with ethical principles and moral problems that arise in a
business environment
Business ethics refers to the core principles and values of the organization and apply throughout the organization.
Business ethics guide individual employees in carrying out their roles and ethical issues include the rights and duties
between a company and its employees, customers, and suppliers.
Human resource function in a company plays an important role in promoting ethics
and in putting internal HR policies in place relating to the ethical conduct of the
employees.
Companies are expected to behave ethically and not exploit its workers.
What is Computer Ethics?
Computer ethics are a set of principles that guide the behaviour of individuals when using
computer resources.
Several ethical issues that may arise include intellectual property rights, privacy concerns, and the
impacts of computer technology on wider society.
Computer Ethics Institute (CEI) Ten commandments on computer ethics
1. Not use a computer to harm other people
2. Not interfere with other people’s computer work.
3. Not snoop around in other people’s computer files
4. Not use a computer to steal
5. Not use a computer to bear false witness
6. Not copy or use proprietary software for which you have not paid
7. Not use other people’s computer resources without authorization or proper compensation.
8. Not appropriate other people’s intellectual output
9. Think about the social consequences of the program you are writing or the system you are designing
10. Always use a computer in ways that ensure consideration and respect for your fellow humans
The Ethical Software Tester
Certified software testers shall act consistently in the public interest
They shall act in the best interests of their client and employer
Certified software testers shall ensure that their deliverables meet the highest professional standards
They shall maintain independence and integrity in professional judgments
Certified software test managers and leaders shall promote an ethical approach to the management of software testing
They shall advance the integrity and reputation of the profession
Certified software testers shall be supportive of their colleagues and promote cooperation with software developers
They shall participate in lifelong learning regarding the practice of their profession and promote an ethical approach to the
practice of their profession.
Professional responsibilities of software engineers and testers