Software Testing Unit2
Software Testing Unit2
Software Testing Unit2
Equivalence Partitioning
Hence, instead of using each and every input value, we can now use any one value
from the group/class to test the outcome. This way, we can maintain test coverage
while we can reduce the amount of rework and most importantly the time spent.
For Example:
As present in the above image, the “AGE” text field accepts only numbers from 18 to
60. There will be three sets of classes or groups.
We have thus reduced the test cases to only 3 test cases based on the formed classes
thereby covering all the possibilities. So, testing with any one value from each set of
the class is sufficient to test the above scenario.
Boundary Value Analysis
The name itself defines that in this technique, we focus on the values at boundaries as
it is found that many applications have a high amount of issues on the boundaries.
Boundary refers to values near the limit where the behavior of the system changes. In
boundary value analysis, both valid and invalid inputs are being tested to verify the
issues.
For Example:
If we want to test a field where values from 1 to 100 should be accepted, then we
choose the boundary values: 1-1, 1, 1+1, 100-1, 100, and 100+1. Instead of using all
the values from 1 to 100, we just use 0, 1, 2, 99, 100, and 101.
As the name itself suggests, wherever there are logical relationships like:
If
{
(Condition = True)
then action1 ;
}
else action2; /*(condition = False)*/
Then a tester will identify two outputs (action1 and action2) for two conditions (True
and False). So based on the probable scenarios a Decision table is carved to prepare a
set of test cases.
For Example:
Take an example of XYZ bank that provides an interest rate for the Male senior
citizen as 10% and 9% for the rest of the people.
In this example condition, C1 has two values as true and false, C2 also has two values
as true and false. The total number of possible combinations would then be four. This
way we can derive test cases using a decision table.
State Transition Testing is a technique that is used to test the different states of the
system under test. The state of the system changes depending upon the conditions or
events. The events trigger states which become scenarios and a tester needs to test
them.
A systematic state transition diagram gives a clear view of the state changes but it is
effective for simpler applications. More complex projects may lead to more complex
transition diagrams thereby making it less effective.
For Example:
In this technique, the tester can use his/her experience about the application behavior
and functionalities to guess the error-prone areas. Many defects can be found using
error guessing where most of the developers usually make mistakes.
Divide by zero.
Handling null values in text fields.
Accepting the Submit button without any value.
File upload without attachment.
File upload with less than or more than the limit size.
Example 2:
Let us consider an example of an online shopping site. In this site, each of products
has a specific product ID and product name. We can search for product either by
using name of product or by product ID. Here, we consider search field that accepts
only valid product ID or product name.
Let us consider a set of products with product IDs and users wants to search for
Mobiles. Below is a table of some products with their product Id.
Product Product ID
Mobiles 45
Laptops 54
Pen Drives 67
Keyboard 76
Headphone
34
s
If the product ID entered by user is invalid then application will redirect customer or
user to error page. If product ID entered by user is valid i.e. 45 for mobile, then
equivalence partitioning method will show a valid product ID.
Example-3 :
Let us consider an example of software application. There is function of software
application that accepts only particular number of digits, not even greater or less
than that particular number.
Consider an OTP number that contains only 6 digit number, greater and even less
than six digits will not be accepted, and the application will redirect customer or
user to error page. If password entered by user is less or more than six characters,
that equivalence partitioning method will show an invalid OTP. If password entered
is exactly six characters, then equivalence partitioning method will show valid
OTP.
2.3 Cause Effect Graphing
2.
3. NOT Function: if c is 1, then e is 0. Else e is 1.
4.
5. OR Function: if c1 or c2 or c3 is 1, then e is 1. Else e is 0.
6.
To represent some impossible combinations of causes or impossible combinations of
effects, constraints are used. The following constraints are used in cause-effect
graphs:
1. Exclusive constraint or E-constraint: This constraint exists between causes. It
states that either c1 or c2 can be 1, i.e., c1 and c2 cannot be 1 simultaneously.
2.
3. Inclusive constraint or I-constraint: This constraint exists between causes. It
states that atleast one of c1, c2 and c3 must always be 1, i.e., c1, c2 and c3
cannot be 0 simultaneously.
4.
5. One and Only One constraint or O-constraint: This constraint exists between
causes. It states that one and only one of c1 and c2 must be 1.
6.
7. Requires constraint or R-constraint: This constraint exists between causes. It
states that for c1 to be 1, c2 must be 1. It is impossible for c1 to be 1 and c2 to
be 0.
8.
9. Mask constraint or M-constraint: This constraint exists between effects. It
states that if effect e1 is 1, the effect e2 is forced to be 0.
In software testing error guessing is a method in which experience and skill play an
important role. As here possible bugs and defects are guessed in the areas where
formal testing would not work. That’s why it is also called experience-based testing
which has no specific method of testing. This is not a formal way of performing
testing still it has importance as it sometimes solves many unresolved issues also.
Identify Input Domains: Begin by identifying the input domains of the software.
These are the sets of valid and invalid inputs that the software can accept.
Partition the Input Domains: Divide the input domains into meaningful partitions.
Each partition represents a subset of inputs that should exhibit similar behavior. For
example, if an input field accepts integers, partitions could include positive integers,
negative integers, and zero.
Exercise Each Partition: Design test cases to exercise each partition of the input
domain. This ensures that the software behaves correctly for different categories of
input data. For example, if testing a function that calculates the square root of a
number, test cases might include valid inputs such as positive numbers and invalid
inputs such as negative numbers.
Boundary Value Analysis (BVA): Apply boundary value analysis to the partitions
to identify critical boundary values. Test cases should include inputs at the boundaries
of each partition as well as values immediately above and below these boundaries. For
example, if testing a function that accepts integers from 1 to 100, test cases might
include inputs such as 1, 50, 100, and 101.
Examine Code Paths: Analyze the internal structure of the software to identify code
paths that correspond to different input domains. Ensure that each code path is
exercised by at least one test case.
Use Control Flow Testing: Use control flow testing techniques, such as statement
coverage or branch coverage, to ensure that each statement and branch of the code is
executed during testing. This helps uncover any logic errors or inconsistencies in the
code.
Apply Data Flow Analysis: Analyze how data flows through the software and design
test cases to ensure that data is processed correctly at each step. This involves tracing
the flow of data from input to output and verifying that it is transformed and
manipulated as expected.