Software Testing Material
Software Testing Material
Introduction:
What is testing?
Testing is the process of evaluating a system components by manual or automated means
to verify that it satisfies specified requirements.
2. Dichotomies:
Testing Debugging
Testing starts with known conditions, Debugging starts from possibly unknown
uses predefined procedures and has intial conditions and the end can not be
predictable outcomes. predicted except statistically.
Testing can and should be planned, Procedure and duration of debugging cannot
designed and scheduled. be so constrained.
Testing is a demonstration of error or
Debugging is a deductive process.
apparent correctness.
Debugging is the programmer's vindication
Testing proves a programmer's failure.
(Justification).
Testing, as executes, should strive to
Debugging demands intutive leaps,
be predictable, dull, constrained, rigid
experimentation and freedom.
and inhuman.
Much testing can be done without Debugging is impossible without detailed
design knowledge. design knowledge.
Testing can often be done by an
Debugging must be done by an insider.
outsider.
Much of test execution and design can
Automated debugging is still a dream.
be automated.
Above figure is a model of testing process. It includes three models: A model of the
environment, a model of the program and a model of the expected bugs.
ENVIRONMENT:
o A Program's environment is the hardware and software required to make
it run. For online systems, the environment may include communication
lines, other systems, terminals and operators.
o The environment also includes all programs that interact with and are
used to create the program under test - such as OS, linkage editor,
loader, compiler, utility routines.
o Because the hardware and firmware are stable, it is not smart to blame
the environment for bugs.
PROGRAM:
o Most programs are too complicated to understand in detail.
o The concept of the program is to be simplified inorder to test it.
o If simple model of the program doesnot explain the unexpected
behaviour, we may have to modify that model to include more facts and
details. And if that fails, we may have to modify the program.
BUGS:
o Bugs are more insidious (deceiving but harmful) than ever we expect
them to be.
o An unexpected test result may lead us to change our notion of what a
bug is and our model of bugs.
o Some optimistic notions that many programmers or testers have about
bugs are usually unable to test effectively and unable to justify the dirty
tests most programs need.
o OPTIMISTIC NOTIONS ABOUT BUGS:
1. Benign Bug Hypothesis: The belief that bugs are nice, tame
and logical. (Benign: Not Dangerous)
2. Bug Locality Hypothesis: The belief that a bug discovered
with in a component effects only that component's behaviour.
3. Control Bug Dominance: The belief that errors in the
control structures (if, switch etc) of programs dominate the
bugs.
4. Code / Data Separation: The belief that bugs respect the
separation of code and data.
5. Lingua Salvator Est: The belief that the language syntax and
semantics (e.g. Structured Coding, Strong typing, etc)
eliminates most bugs.
6. Corrections Abide: The mistaken belief that a corrected bug
remains corrected.
7. Silver Bullets: The mistaken belief that X (Language, Design
method, representation, environment) grants immunity from
bugs.
8. Sadism Suffices: The common belief (especially by
independent tester) that a sadistic streak, low cunning, and
intuition are sufficient to eliminate most bugs. Tough bugs
need methodology and techniques.
9. Angelic Testers: The belief that testers are better at test
design than programmers are at code design.
TESTS:
o Tests are formal procedures, Inputs must be prepared, Outcomes should
predicted, tests should be documented, commands need to be executed,
and results are to be observed. All these errors are subjected to error
o We do three distinct kinds of testing on a typical software system.
They are:
1. Unit / Component Testing: A Unit is the smallest testable
piece of software that can be compiled, assembled, linked,
loaded etc. A unit is usually the work of one programmer and
consists of several hundred or fewer lines of code. Unit
Testing is the testing we do to show that the unit does not
satisfy its functional specification or that its implementation
structure does not match the intended design structure.
A Component is an integrated aggregate of one or more
units. Component Testing is the testing we do to show that
the component does not satisfy its functional specification or
that its implementation structure does not match the intended
design structure.
2. Integration Testing: Integration is the process by which
components are aggregated to create larger
components. Integration Testing is testing done to show that
even though the componenets were individually satisfactory
(after passing component testing), checks the combination of
components are incorrect or inconsistent.
3. System Testing: A System is a big component. System
Testing is aimed at revealing bugs that cannot be attributed to
components. It includes testing for performance, security,
accountability, configuration sensitivity, startup and recovery.
Role of Models: The art of testing consists of creating , selecting, exploring, and
revising models. Our ability to go through this process depends on the number of
different models we have at hand and their ability to express a program's
behaviour.
4.Levels Of Testing:
7.Consequences of Bugs:
Here are the consequences of bugs in software testing in simple words:
1. System Crash: Software stops working completely.
2. Data Loss: Important data is deleted or corrupted.
3. Security Risks: Hackers can exploit bugs to steal sensitive information.
4. Financial Loss: Bugs can cause monetary losses due to system downtime or incorrect
calculations.
5. Reputation Damage: Bugs can harm a company's reputation and erode customer trust.
6. Time and Resource Waste: Debugging and fixing bugs can be time-consuming and
costly.
7. User Frustration: Bugs can cause frustration and annoyance for end-users.
8. Compliance Issues: Bugs can lead to non-compliance with regulatory requirements.
9. Maintenance Challenges: Bugs can make software maintenance and updates more
difficult.
10. Business Disruption: Bugs can disrupt business operations and impact revenue.
8. Taxonomy of Bugs:
Here's a simple taxonomy of bugs in software testing methodologies:
Functional Bugs
Non-Functional Bugs
Environmental Bugs
1. Compatibility Issues: Problems with different hardware, software, or browsers.
2. Configuration Errors: Mistakes in system configuration or setup.
3. Network Issues: Problems with network connectivity or communication.
Data Bugs
This taxonomy helps testers categorize and prioritize bugs based on their severity and impact
on the software system.
Basis Path Testing is a white-box testing technique based on the control structure of a
program or a module. Using this structure, a control flow graph is prepared and the various
possible paths present in the graph are executed as a part of testing. Therefore, by
definition, Basis path testing is a technique of selecting the paths in the control flow graph,
that provide a basis set of execution paths through the program or module. Since this testing
is based on the control structure of the program, it requires complete knowledge of the
program’s structure. To design test cases using this technique, four steps are followed :
1. Construct the Control Flow Graph
2. Compute the Cyclomatic Complexity of the Graph
3. Identify the Independent Paths
4. Design Test cases from Independent Paths
Let’s understand each step one by one. 1. Control Flow Graph – A control flow graph (or
simply, flow graph) is a directed graph which represents the control structure of a program
or module. A control flow graph (V, E) has V number of nodes/vertices and E number of
edges in it. A control graph can also have :
Junction Node – a node with more than one arrow entering it.
Decision Node – a node with more than one arrow leaving it.
Region – area bounded by edges and nodes (area outside the graph is also counted as a
region.).
If – Then – Else –
Do – While –
While – Do –
Switch – Case –
Predicates:
A predicate is a logical expression that evaluates to true or false.
- Simple predicate: A predicate that involves a single variable or constant.
- Compound predicate: A predicate that involves multiple variables or constants.
Path Instrumentation:
Path instrumentation is the process of modifying a program to collect data about the paths
that are executed.
- Path instrumentation: Modifying a program to collect data about the paths that are executed.
UNIT-02
1.Transaction Flows:
Transaction flow testing is a method used in software testing that aims to verify each stage of
a transaction within a system, particularly in applications with payment processes. These
stages usually are data entry, processing, output generation, and validation.
2.Transaction Flow Techniques:
Transaction flow testing is a method used in software testing that aims to verify each stage
of a transaction within a system, particularly in applications with payment processes. These
stages usually are data entry, processing, output generation, and validation. It helps
developers identify design flaws, coding errors, and system-level issues, helping prevent
potential issues with the software.
Transaction Flow Testing Techniques
Transaction flows are like control flow graphs, and consequently, we should
expect to have them in increasing levels of details
Make transaction flow testing the corner stone of system functional testing, just as path testing is the
corner stone of unit testing
Select additional flow paths for loops, extreme values, and domain boundaries
Design more test cases to validate all births and deaths
Publish and distribute the selected test paths through the transaction flows as early as possible, so that
they will exert the maximum beneficial effect on the project
Path Selection
Select a set of covering paths (C + C ) using the analogous criteria you used for structural
1 2
path testing
Select a covering set of paths based on functionally sensible transactions as you would for
control flow graphs
Try to find most tortuous, longest, strongest path from the entry to the exit of the
transaction flow
Path Sensitization
Most of the normal paths are very easy to sensitize. 80% - 95% transaction flow coverage (C 1 + C2) is
usually easy to achieve
Path Instrumentation
Instrumentation plays a bigger role in transaction flow testing than in unit path testing
The information of the path taken for a given transaction must be kept with that transaction
and can be recorded by a central transaction dispatcher or by the individual processing
modules
In some systems, such traces are provided by the operating systems or a running log
Design and maintenance of the test databases constitute about 30% to 40% of the effort in
transaction flow test design
It requires talented, matured, and diplomatic designers who are experienced in both system
design and test design
Test Execution:
Commit to automation of test execution if you want to do transaction flow testing for a
system of any size
If the numbers of test cases are limited, you need not worry about test execution automation
If the number of test cases run into several hundred, performing transaction flow testing to
achieve (C1 + C2) needs execution automation without which you cannot get it right.
Referal
Link:https://csestudyzone.blogspot.com/2015/06/transaction-flow-
testing-techniques-in.html
For Variable z
The situation for variable z (image) is more complicated because the
variable is redefined in many places
For the definition on link (1, 3) we must exercise paths that include sub
paths (1, 3, 4) and (1, 3, 5)
The definition on link (4, 5) is covered by any path that includes (5, 6)
such as sub path (1, 3, 4, 5, 6 ....)
The (5, 6) definition requires paths that include sub paths (5, 6, 7 and 4)
and (5, 6, 7 and 8)
For variable v
Variable V (image) is defined only once on link (1, 3)
Because V has a predicate use at node 12 and the subsequent path to the
end must be forced for both directions at node 12, the all-du-paths
strategy for this variable requires that we exercise all loop-free entry/exit
paths and at least one path that includes the loop caused by (11, 4)
Note that we must test paths that include both sub paths (3, 4, 5) and (3,
5) even though neither of these has V definition
In image, ADUP requires that we include sub paths (3,4,5) and (3,5) in
some tests because subsequent uses of V, such as on link (5,6) can be
reached by either alternative
In AU, either (3,4,5) or (3,5) can be used to start paths, but we don't have
to use both
Similarly, we can skip the (8,10) link if we've included the (8,9,10) sub
path
Note the hole, we must include (8,9,10) in some test cases because that's
the only way to reach the c use at link (9,10-) but suppose our bug for
variable V is on link (8,10) after all? Find a covering set of paths under AU
for the image shown below
If there are definitions of the variables that are not covered by the above
prescription, and then add computational use test cases as required to
cover every definition
For variable Z
In image for APU + C we can select paths that all take the upper link (12,
13) and therefore we do not cover the c-use of Z but that's okay according
to the strategy's definition because every definition is covered
Links (1,3), (4,5), (5,6) and (7,8) must be included because they contain
definitions for variable z
Links (3,4), (3,5), (8,9) (8,10), (9,6) and (9,10) must be included because
they contain predicate uses of Z
Find a covering set of test cases under APU + C for a ll variables in this
example - it only takes two test
For variable V
Note that the c-use at (9,10) need not be included under the APU + C
criterion
If any definition is not covered by the previously selected paths, add such
predicate use cases as are needed to assure that every definition is
included in some test
For variable z
Specifically, the (1,3) definition is not covered for the (3,5) p-use, the (7,8)
definition is not covered for the (8,9), (9,6) and (9,10) p-uses
The above examples imply that APU+C is stronger than branch coverage,
but ACU+P may be weaker than, or incomparable to branch coverage
UNIT-03
FIRST PART LINK: https://www.recw.ac.in/v1.8/wp-content/uploads/2021/03/unit-4-
ST.pdf
Syntax Testing:
Syntax Testing is a type of black box testing technique which is used to examine the format
and the grammar of the data inputs used in the software application, either external or input,
which may be formally described in technical or established & specified notations such as
BNF and could be used to design input ...
Grammar Formats:
Gherkin: A plain text language used to describe application behavior in a
concise and readable way.
Cucumber: A testing framework that uses Gherkin to define test
scenarios.
TestNG XML: A standard format for defining test suites and test cases in
Java-based testing.
JUnit: A popular testing framework for Java that uses a specific XML
format for test cases.
Test Case Generation:
What is a Test Case Generator?
Test Case Generators are vital for quality software. They make testing
efficient and thorough. This is key for any software project.
How a Test Case Generator works is key in software testing. It's a tool that
automates and simplifies the process. Here's a breakdown:
By following these steps, you can efficiently create comprehensive test cases
with the Onethread Generator. This tool simplifies and streamlines the test
case creation process.
Test cases are vital in software development. They ensure the software works
well. Here's why they are important:
Test cases are essential for creating reliable, user-friendly software. They are
a key part of the software development and maintenance process.
Syntax testing is a systematic approach to testing software systems by validating the input
format and structure. It ensures that the system correctly processes both valid and invalid
inputs based on a predefined syntax. Here’s a simplified explanation of its implementation,
application, and testability tips:
4. Security Testing:
o Identifies potential vulnerabilities by testing malformed inputs
to ensure the system rejects them gracefully.
UNIT-04
Logic Based Testing: Logic-based testing is a method of designing
software tests using logical expressions found in software artifacts.
Decision Tables:
Decision tables are used in various engineering fields to represent
complex logical relationships. This testing is a very effective tool in testing
the software and its requirements management. The output may be
dependent on many input conditions and decision tables give a tabular
view of various combinations of input conditions and these conditions are
in the form of True(T) and False(F). Also, it provides a set of conditions
and its corresponding actions required in the testing.
Parts of Decision Tables :
In software testing, the decision table has 4 parts which are divided into
portions and are given below :
1. Condition Stubs : The conditions are listed in this first upper left part
of the decision table that is used to determine a particular action or set
of actions.
2. Action Stubs : All the possible actions are given in the first lower left
portion (i.e, below condition stub) of the decision table.
3. Condition Entries : In the condition entry, the values are inputted in
the upper right portion of the decision table. In the condition entries
part of the table, there are multiple rows and columns which are known
as Rule.
4. Action Entries : In the action entry, every entry has some associated
action or set of actions in the lower right portion of the decision table
and these values are called outputs.
Types of Decision Tables :
The decision tables are categorized into two types and these are given
below:
1. Limited Entry : In the limited entry decision tables, the condition
entries are restricted to binary values.
2. Extended Entry : In the extended entry decision table, the condition
entries have more than two values. The decision tables use multiple
conditions where a condition may have many possibilities instead of
only ‘true’ and ‘false’ are known as extended entry decision tables.
Applicability of Decision Tables :
The order of rule evaluation has no effect on the resulting action.
The decision tables can be applied easily at the unit level only.
Once a rule is satisfied and the action selected, n another rule needs to
be examined.
The restrictions do not eliminate many applications.
Example of Decision Table Based testing :
Below is the decision table of the program for determining the largest
amongst three numbers in which its input is a triple of positive integers
(x,y, and z) and values are from the interval [1, 300].
Table 1 : Decision Table of largest amongst three numbers :
Conditi R R R R R R R R R R1 R1 R1 R1 R1
ons 1 2 3 4 5 6 7 8 9 0 1 2 3 4
c1: x >
F T T T T T T T T T T T T T
= 1?
c2: x <=
F T T T T T T T T T T T T
300?
c3: y >
F T T T T T T T T T T T
= 1?
c4: x <=
F T T T T T T T T T T
300?
c5: z >
F T T T T T T T T T
= 1?
c6: z <=
F T T T T T T T T
300?
c7:
T T T T F F F F
x>y?
c8:
T T F F T T F F
y>z?
c9:
T F T F T F T F
z>x?
Rule 25 12 6 3 1
8 1 1 1 1 1 1 1 1
Count 6 8 4 2 6
a1 :
Invalid X X X X X X
input
a2 : x is
X X
largest
a3 : y is
X X
largest
a4 : z is
X X
largest
a5 :
Impossi X X
ble
KV CHARTS: https://youtu.be/0BsmlNCFe8g?si=hk7xJcvhSGn3JY1w
State Graphs and Transition Testing: State Graphs, Good & Bad State
Graphs:
A state graph, also known as a state diagram or state machine diagram, is a visual
representation of a system's behavior over time. It's a powerful tool for modeling and
analyzing complex systems, especially those with discrete states and transitions.
Consistent Symbols: Use consistent symbols for states (e.g., rounded rectangles) and
transitions (e.g., arrows) to enhance readability.
Meaningful Labels: Label states and transitions with clear and concise names that
accurately reflect their meaning.
Avoid Clutter: Keep the diagram uncluttered by avoiding excessive details and
unnecessary elements.
2. Well-Defined States:
Distinct States: Each state should represent a unique condition or mode of the
system.
Mutually Exclusive: States should be mutually exclusive, meaning the system cannot
be in multiple states simultaneously.
Complete Coverage: The state graph should cover all possible states of the system.
1. Initial state
We use a black filled circle represent the initial state of a System or a Class.
2. Transition
We use a solid arrow to represent the transition or change of control from one state to
another. The arrow is labelled with the event which causes the change in state.
3. State
4. Fork
We use a rounded solid rectangular bar to represent a Fork notation with incoming arrow
from the parent state and outgoing arrows towards the newly created states. We use the fork
notation to represent a state splitting into two or more concurrent states.
5. Join
We use a rounded solid rectangular bar to represent a Join notation with incoming arrows
from the joining states and outgoing arrow towards the common goal state. We use the join
notation when two or more states concurrently converge into one on the occurrence of an
event or events.
6. Self transition
We use a solid arrow pointing back to the state itself to represent a self transition. There
might be scenarios when the state of the object does not change upon the occurrence of an
event. We use self transitions to represent such cases.
7. Composite state
We use a rounded rectangle to represent a composite state also. We represent a state with
internal activities using a composite state.
8. Final State
We use a filled circle within a circle notation to represent the final state in a state machine
diagram.
4. Hierarchical Structure:
Substate Diagrams: Complex state machines can be broken down into smaller, more
manageable substate diagrams.
Orthogonal Regions: Multiple state machines can be combined into a single diagram
to model concurrent behavior.
5. Effective Visualization:
Layout: The state graph should be laid out in a clear and organized manner, with
states and transitions arranged to minimize crossing lines and improve readability.
Color Coding: Use color coding to differentiate between different types of states or
transitions, enhancing visual clarity.
Annotations: Add annotations or comments to explain complex parts of the diagram.
UNIT-05
Automation Testing:
Automated Testing means using special software for tasks that
people usually do when checking and testing a software product.
Nowadays, many software projects use automation testing from start to
end, especially in agile and DevOps methods. This means
the engineering team runs tests automatically with the help of software
tools . It will help to keep the testing team to make the process faster.
Continuous delivery (CD) and quickly sends the new code to users.
It is used to automate the testing tasks that are difficult to perform
manually.
Automation tests can be run at any time of the day as they use scripted
sequences to examine the software.
Automation tests can also enter test data compare the expected result
with the actual result and generate detailed test reports.
The goal of automation tests is to reduce the number of test cases to
be executed manually but not to eliminate manual testing.
It is possible to record the test suit and replay it when required.
Automated Testing uses specialized software to replace manual testing
tasks, speeding up the process and integrating seamlessly with CI/CD
pipelines. It allows for continuous code verification and quicker
deployment. To master automation testing and streamline your processes,
check out the Complete Guide to Software Testing & Automation by
GeeksforGeeks . This course offers essential insights and techniques to
optimize your automated testing approach.
Table of Content
Why Transform From Manual to Automated Testing?
What kinds of software tests should be automated first?
What kinds of software tests should be done manually?
Difference between Manual Testing vs Automated Testing
Automation Testing Types
Test Automation Frameworks
Which Tests to Automate?
Automation Testing Process
Criteria to Select Automation Tool
Best Practices for Test Automation
Popular Automation Tools
Advantages of Automation Testing
Disadvantages of Automation Testing
Why Transform From Manual to Automated Testing?
In 1994, an aircraft completing its routine flight crashed just before
landing. This was due to a bug or defect in their software. The testers
didn’t even care about the final testing, so this accident happened. In such
high-priority cases, accurate automation testing becomes critical to
replace a few manual tests. Automation testing tools
like BrowserStack can help teams thoroughly test and speed up the
execution time of test suites. Below are some of the reasons for using
automation testing:
Quality Assurance: Manual testing is a tedious task that can be
boring and at the same time error-prone. Thus, using automation
testing improves the quality of the software under test as more test
coverage can be achieved.
Error or Bug-free Software: Automation testing is more efficient for
detecting bugs in comparison to manual testing.
No Human Intervention: Manual testing requires huge manpower in
comparison to automation testing which requires no human
intervention and the test cases can be executed unattended.
Increased test coverage: Automation testing ensures more test
coverage in comparison to manual testing where it is not possible to
achieve 100% test coverage.
Testing can be done frequently: Automation testing means that the
testing can be done frequently thus improving the overall quality of the
software under test.
For more refer – Manual Testing to Automated Testing
What Kinds of Software Tests Should Be Automated First?
1. End-to-End tests
End-to-end testing is a type of software testing used to test whether the
flow of software from the initial stage to the final stage is behaving as
expected. The purpose of end-to-end testing is to identify system
dependencies and to make sure that the data integrity is maintained
between various system components and systems. End-to-end testing:
End-to-end testing, also known as end-to-end functional testing, is a type
of testing that validates the flow of a system from start to finish.
2. Unit tests
Unit testing is automated and is run each time the code is changed to
ensure that new code does not break existing functionality. Unit tests are
designed to validate the smallest possible unit of code, such as a function
or a method, and test it in isolation from the rest of the system.
3. Integration tests
Integration testing is the process of testing the interface between two
software units or modules. It focuses on determining the correctness of
the interface. The purpose of integration testing is to expose faults in the
interaction between integrated units. Once all the modules have been
unit-tested, integration testing is performed.
4. Performance tests
Performance Testing is a type of software testing that ensures software
applications perform properly under their expected workload. It is a testing
technique carried out to determine system performance in terms of
sensitivity, reactivity, and stability under a particular workload.
What Kinds of Software Tests Should Be Done Manually?
Automating tests will save the time and speed up the productivity, but not
every test needs automation. sometime the investment in creating
automated tests the benefits of manual testing.
1. Exploratory testing
Exploratory Testing is a type of software testing in which the tester is
free to select any possible methodology to test the software. It is an
unscripted approach to software testing. In exploratory testing, software
developers use their learning, knowledge, skills, and abilities to test the
software developed by themselves. Exploratory testing checks the
functionality and operations of the software as well as identify the
functional and technical faults in it.
2. Visual Regression Testing
Visual regression testing is a software development technique for
identifying unintentional visual modifications made to the user interface
(UI) of a web application. To find any differences, screenshots of the user
interface (UI) of the application are compared before and after code
changes. Developers can guarantee that changes to the coding don’t
bring about unexpected visual changes that could degrade the user
experience by automating this process.
3. Building a test automation framework for your DevOps
team
Automated testing do not have one is not fit for all. When setting up
automated testing for your team, consider a few important things.
4. Frequency of release
For software that releases regular, like in every month or week, manual
testing is might be okay. But for faster purpose, the automated testing is a
more helpful because it is need for the continuous integration and
delivery.
5. Available tools and ecosystem
Every programming language it has been its own set of tools and utilities
that work well with it. with the same, each type of automated testing has
its own tools for testing, which may not be available for every
programming language. for successfully implement automated testing,
you need tools which match the both the programming language and the
testing pattern you are using.
6. Product market fit and code base maturity
Product-market fit refers to the alignment between a product or service
and the market it serves. It signifies the degree to which a product
satisfies strong market demand and effectively addresses the needs or
problems of a specific market segment. Product market fit means being
in a good market with a product that can satisfy that market.
Difference Between Manual Testing vs Automated Testing
Below are some of the differences between manual testing and automated
testing:
Parameters Manual Testing Automated Testing
Investment in tools
Heavy investment in
rather than human
human resources.
Investment resources.
Parameters Manual Testing Automated Testing
Automation testing is
Manual testing is time-
time-saving as due to
consuming due to
the use of the tools the
human intervention
execution is faster in
where test cases are
comparison to manual
generated manually.
Time efficiency testing.
There is a possibility
When there are
that the test cases
changes in the code,
executed the first time
regression testing is
will not be able to catch
done to catch the bugs
the regression bugs
due to changes in the
due to the frequently
code.
Regression testing changing requirements.