0% found this document useful (0 votes)
3 views

stmmod2

Dynamic testing is a software testing method that evaluates software behavior during execution, focusing on functionality under various conditions. It includes techniques such as black box testing, white box testing, boundary value analysis, equivalence partitioning, state transition testing, decision table testing, and error guessing. Each technique has its own objectives, advantages, and disadvantages, contributing to a comprehensive testing strategy.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

stmmod2

Dynamic testing is a software testing method that evaluates software behavior during execution, focusing on functionality under various conditions. It includes techniques such as black box testing, white box testing, boundary value analysis, equivalence partitioning, state transition testing, decision table testing, and error guessing. Each technique has its own objectives, advantages, and disadvantages, contributing to a comprehensive testing strategy.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 22

Mod-2

Dynamic Testing – Software Testing


Dynamic testing is a type of software testing that involves executing the software and
evaluating its behavior during runtime. It is also known as functional testing, as it focuses on
testing the software’s functionality and how it behaves under different inputs and
conditions. In this article, we’ll learn about its objectives, levels, processes, advantages, and
disadvantages.

Black Box Testing White Box Testing

It is a software testing technique that


examines the functionality of software In white-box testing, the internal structure of the
without knowing its internal structure software is known to the tester.
or coding.

Black Box Testing is also known as It is also known as structural testing, clear box
functional testing, data-driven testing, testing, code-based testing, and transparent
and closed-box testing. testing.

In black-box testing, there is less In white-box testing, there is a requirement of


programming knowledge is required. programming knowledge.

It is not well suitable for algorithm It is well suitable and recommended for algorithm
testing. testing.

It is done at higher levels of testing that


It is done at lower levels of testing that are unit
are system testing and acceptance
testing and integration testing.
testing.

It is hard to automate black-box testing


due to the dependency of testers and It is easy to automate the white-box testing.
programmers on each other.

It is mainly performed by the software


It is mainly performed by developers.
testers.

It is less time-consuming. In Black box


testing, time consumption depends It is more time-consuming. It takes a long time to
upon the availability of the functional design test cases due to lengthy code.
specifications.

The base of this testing is external The base of this testing is coding which is
expectations. responsible for internal working.

It is less exhaustive than White Box testing. It is more exhaustive than Black Box testing.
In black-box testing, there is no In white-box testing, there is a requirement of
implementation knowledge is required. implementation knowledge.

The main objective of implementing black


box testing is to specify the business needs Its main objective is to check the code quality.
or the customer's requirements.

In black-box testing, defects are identified Whereas, in white-box testing, there is a


once the code is ready. possibility of early detection of defects.

It can be performed by trial and error It can test data domain and data boundaries in
technique. a better way.

Mainly, there are three types of black-box


The types of white box testing are – Path
testing: functional testing, Non-Functional
testing, Loop testing, and Condition testing.
testing, and Regression testing.

In white-box testing, there is the detection of


It does not find the errors related to the
hidden errors. It also helps to optimize the
code.
code.

Boundary Value Analysis


Boundary value analysis is one of the widely used case design technique for black box
testing. It is used to test boundary values because the input values near the boundary have
higher chances of error.
Whenever we do the testing by boundary value analysis, the tester focuses on, while
entering boundary value whether the software is producing correct output or not.
Boundary values are those that contain the upper and lower limit of a variable. Assume that,
age is a variable of any function, and its minimum value is 18 and the maximum value is 30,
both 18 and 30 will be considered as boundary values.
The boundary values include the values present on the boundary, the values just above the
boundary (lower range), and values just below the boundary (upper range).
Let us take an example of a variable x having values from 1 to 10.
So the values of x are in the range of 1 ≤ x ≤ 10. Its boundary values which should be tested
are 1,10, 2, and 9. Moreover, it is a good idea to include one intermediate value in a
boundary. In this example, we can include the value 5. The final values which are considered
for valid test cases are 1, 2, 5, 9, and 10. The values which are considered for invalid test
cases can be 0 and 11.
For each variable, the below values should be considered for testing −
 Minimum value or lower value.
 Just above the minimum value.
 Nominal value or middle value.
 Just below maximum value.
 Maximum value or upper boundary.
Disadvantages of Boundary Value Analysis
The disadvantages of BVA are listed below −
 It works well when the software is still under development.
 It does not take into account the nature of the functional characteristics of the
variables.
 It is only a basic level of testing.
Equivalence Partitioning
Equivalence Partitioning or Equivalence Class Partitioning is type of black box testing
technique which can be applied to all levels of software testing like unit, integration, system,
etc. In this technique, input data units are divided into equivalent partitions that can be used
to derive test cases which reduces time required for testing because of small number of test
cases.
 It divides the input data of software into different equivalence data classes.
 You can apply this technique, where there is a range in the input field.
Example 1: Equivalence and Boundary Value
 Let’s consider the behavior of Order Pizza Text Box Below
 Pizza values 1 to 10 is considered valid. A success message is shown.
 While value 11 to 99 are considered invalid for order and an error message will
appear, “Only 10 Pizza can be ordered”
What is State Transition Testing?
State Transition Testing is a black box testing technique in which changes made in input
conditions cause state changes or output changes in the Application under Test(AUT). State
transition testing helps to analyze behaviour of an application for different input conditions.
Testers can provide positive and negative input test values and record the system behavior.
It is the model on which the system and the tests are based. Any system where you get a
different output for the same input, depending on what has happened before, is a finite
state system.
Four Parts Of State Transition Diagram
There are 4 main components of the State Transition Model as below
1) States that the software might get

2) Transition from one state to another

3) Events that origin a transition like closing a file or withdrawing money


4) Actions that result from a transition (an error message or being given the cash.)

State Transition Diagram and State Transition Table


There are two main ways to represent or design state transition, State transition diagram,
and state transition table.
In state transition diagram the states are shown in boxed texts, and the transition is
represented by arrows. It is also called State Chart or Graph. It is useful in identifying valid
transitions.
In state transition table all the states are listed on the left side, and the events are described
on the top. Each cell in the table represents the state of the system after the event has
occurred. It is also called State Table. It is useful in identifying invalid transitions.
How to Make a State Transition (Examples of a State Transition)
Example 1:
Let’s consider an ATM system function where if the user enters the invalid password three
times the account will be locked.
In this system, if the user enters a valid password in any of the first three attempts the user
will be logged in successfully. If the user enters the invalid password in the first or second try,
the user will be asked to re-enter the password. And finally, if the user enters incorrect
password 3rd time, the account will be blocked.
RELATED ARTICLES
 What is Regression Testing?
 GUI Testing – UI Test Cases (Examples)
 Software Testing Methodologies: QA Models
 Differences Between Verification and Validation
State transition diagram
In the diagram whenever the user enters the correct PIN he is moved to Access granted
state, and if he enters the wrong password he is moved to next try and if he does the same
for the 3rd time the account blocked state is reached.
State Transition Table

Correct PIN Incorrect PIN

S1) Start S5 S2

S2) 1st attempt S5 S3

S3) 2nd attempt S5 S4

S4) 3rd attempt S5 S6

S5) Access Granted – –

S6) Account blocked – –

In the table when the user enters the correct PIN, state is transitioned to S5 which is Access
granted. And if the user enters a wrong password he is moved to next state. If he does the
same 3rd time, he will reach the account blocked state.
Decision Table Based Testing in Software Testing
What is a Decision Table :
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.
Example 1: How to make Decision Base Table for Login Screen
Let’s create a decision table for a login screen.
The condition is simple if the user provides the correct username and password the user will
be redirected to the homepage. If any of the input is wrong, an error message will be
displayed.

Conditions Rule 1 Rule 2 Rule 3

Username (T/F) F T F

Password (T/F) F F T

Output (E/H) E E E

Legend:
 T – Correct username/password
 F – Wrong username/password
 E – Error message is displayed
 H – Home screen is displayed
Interpretation:
 Case 1 – Username and password both were wrong. The user is shown an error
message.
 Case 2 – Username was correct, but the password was wrong. The user is shown an
error message.
 Case 3 – Username was wrong, but the password was correct. The user is shown an
error message.
 Case 4 – Username and password both were correct, and the user navigated to the
homepage

 Cause Effect Graphing in Software


Engineering
Cause Effect Graphing based technique is a technique in which a graph is used to represent
the situations of combinations of input conditions. The graph is then converted to a decision
table to obtain the test cases. Cause-effect graphing technique is used because boundary
value analysis and equivalence class partitioning methods do not consider the combinations
of input conditions. But since there may be some critical behaviour to be tested when some
combinations of input conditions are considered, that is why cause-effect graphing
technique is used.
Steps used in deriving test cases using this technique are:
1. Division of specification:
Since it is difficult to work with cause-effect graphs of large specifications as they are
complex, the specifications are divided into small workable pieces and then
converted into cause-effect graphs separately.
2. Identification of cause and effects:
This involves identifying the causes(distinct input conditions) and effects(output
conditions) in the specification.
3. Transforming the specifications into a cause-effect graph:
The causes and effects are linked together using Boolean expressions to obtain a
cause-effect graph. Constraints are also added between causes and effects if
possible.
4. Conversion into decision table:
The cause-effect graph is then converted into a limited entry decision table. If you’re
not aware of the concept of decision tables, check out this link.
5. Deriving test cases:
Each column of the decision-table is converted into a test case.
Basic Notations used in Cause-effect graph:
Here c represents cause and e represents effect.
The following notations are always used between a cause and an effect:
1. Identity Function: if c is 1, then e is 1. Else e is 0.

2. NOT Function: if c is 1, then e is 0. Else e is 1.

3. OR Function: if c1 or c2 or c3 is 1, then e is 1. Else e is 0.

4. AND Function: if both c1 and c2 and c3 is 1, then e is 1. Else e is 0.


Error Guessing Technique
Error guessing is a technique in which there is no specific method for identifying the error. It
is based on the experience of the test analyst, where the tester uses the experience to guess
the problematic areas of the software. It is a type of black box testing technique which does
not have any defined structure to find the error.
The accomplishment of the error guessing technique is dependent on the ability and
product knowledge of the tester because a good test engineer knows where the bugs are
most likely to be, which helps to save lots of time.
The main purpose of this technique is to identify common errors at any level of testing by
exercising the following tasks:
o Enter blank space into the text fields.
o Null pointer exception.
o Enter invalid parameters.
o Divide by zero.
o Use maximum limit of files to be uploaded.
o Check buttons without entering values.
Example1
A function of the application requires a mobile number which must be of 10 characters.
Now, below are the techniques that can be applied to guess error in the mobile number
field:
o What will be the result, if the entered character is other than a number?
o What will be the result, if entered characters are less than 10 digits?
o What will be the result, if the mobile field is left blank?
After implementing these techniques, if the output is similar to the expected result, the
function is considered to be bug-free, but if the output is not similar to the expected result,
so it is sent to the development team to fix the defects.
However, error guessing is the key technique among all testing techniques as it depends on
the experience of a tester, but it does not give surety of highest quality benchmark. It does
not provide full coverage to the software. This technique can yield a better result if
combined with other techniques of testing.
Advantages
The benefits of error guessing technique are as follows:
o It is a good approach to find the challenging parts of the software.
o It is beneficial when we will use this technique with the grouping of other formal
testing techniques.
o It is used to enhance the formal test design techniques.
Disadvantage
Following are the drawbacks of error guessing technique:
o The error guessing technique is person-oriented rather than process-oriented
because it depends on the person's thinking.
o If we use this technique, we may not achieve the minimum test coverage.
o With the help of this, we may not cover all the input or boundary values.
o With this, we cannot give the surety of the product quality.
What is basis path testing?
Basis path testing is a type of white-box testing that tests all possible independent paths in
the control flow graph of a program.
Note:
 A path is the route of nodes in the control flow graph that a program takes from one
point to another.
 An independent path is a path that adds at least one node in the already defined
independent paths. In other words, the independent paths of a program are all
unique.
Steps for basis path testing
To conduct basis path testing of a program, follow the steps below:
1. Draw the control flow graph of the program.
2. Calculate the cyclomatic complexity of the control flow graph. This will be the
maximum number of independent paths in the graph.
3. Identify independent paths in the control flow graph.
4. Design test cases based on the independent paths identified so that the test cases
execute all independent paths.
Advantages of basis path testing
The advantages of conducting basis path testing are:
 Basis path testing reduces the number of redundant tests.
 All program statements are executed and tested at least once.
 It guarantees complete branch coverage.

Graph Matrices in Software Testing


What is a Graph Matrix ?
A graph matrix is a square matrix whose size represents the number of nodes in the control
flow graph. If you do not know what control flow graphs are, then read this article. Each row
and column in the matrix identifies a node and the entries in the matrix represent the edges
or links between these nodes. Conventionally, nodes are denoted by digits and edges are
denoted by letters.
Let’s take an example.

Let’s convert this control flow graph into a graph matrix. Since the graph has 4 nodes, so the
graph matrix would have a dimension of 4 X 4. Matrix entries will be filled as follows :
 (1, 1) will be filled with ‘a’ as an edge exists from node 1 to node 1
 (1, 2) will be filled with ‘b’ as an edge exists from node 1 to node 2. It is important to
note that (2, 1) will not be filled as the edge is unidirectional and not bidirectional
 (1, 3) will be filled with ‘c’ as edge c exists from node 1 to node 3
 (2, 4) will be filled with ‘d’ as edge exists from node 2 to node 4
 (3, 4) will be filled with ‘e’ as an edge exists from node 3 to node 4
The graph matrix formed is shown below :

Connection Matrix :
A connection matrix is a matrix defined with edges weight. In simple form, when a
connection exists between two nodes of control flow graph, then the edge weight is 1,
otherwise, it is 0. However, 0 is not usually entered in the matrix cells to reduce the
complexity.
For example, if we represent the above control flow graph as a connection matrix, then the
result would be :

As we can see, the weight of the edges are simply replaced by 1 and the cells which were
empty before are left as it is, i.e., representing 0.
A connection matrix is used to find the cyclomatic complexity of the control graph.
Although there are three other methods to find the cyclomatic complexity but this method
works well too.
Following are the steps to compute the cyclomatic complexity :
1. Count the number of 1s in each row and write it in the end of the row
2. Subtract 1 from this count for each row (Ignore the row if its count is 0)
3. Add the count of each row calculated previously
4. Add 1 to this total count
5. The final sum in Step 4 is the cyclomatic complexity of the control flow graph
Let’s apply these steps to the graph above to compute the cyclomatic complexity.

We can verify this value for cyclomatic complexity using other methods :
Method-1 :
Cyclomatic complexity
=e-n+2*P
Since here,
e=5
n=4
and, P = 1
Therefore, cyclomatic complexity,
=5-4+2*1
=3
Method-2 :
Cyclomatic complexity
=d+P
Here,
d=2
and, P = 1
Therefore, cyclomatic complexity,
=2+1
=3

Loop Software Testing


Loop Testing is a type of software testing type that is performed to validate the loops. It is
one of the type of Control Structure Testing. Loop testing is a white box testing technique
and is used to test loops in the program.
Objectives of Loop Testing:
The objective of Loop Testing is:
 To fix the infinite loop repetition problem.
 To know the performance.
 To identify the loop initialization problems.
 To determine the uninitialized variables.
Types of Loop Testing:
Loop testing is classified on the basis of the types of the loops:
1. Simple Loop Testing:
Testing performed in a simple loop is known as Simple loop testing. Simple loop is
basically a normal “for”, “while” or “do-while” in which a condition is given and loop
runs and terminates according to true and false occurrence of the condition
respectively. This type of testing is performed basically to test the condition of the
loop whether the condition is sufficient to terminate loop after some point of time.
Example:
while(condition)
{
statement(s);
}

2. Nested Loop Testing:


Testing performed in a nested loop in known as Nested loop testing. Nested loop is
basically one loop inside the another loop. In nested loop there can be finite number
of loops inside a loop and there a nest is made. It may be either of any of three loops
i.e., for, while or do-while.
Example:
while(condition 1)
{
while(condition 2)
{
statement(s);
}
}
3. Concatenated Loop Testing:
Testing performed in a concatenated loop is known as Concatenated loop testing. It is
performed on the concatenated loops. Concatenated loops are loops after the loop.
It is a series of loops. Difference between nested and concatenated is that in nested
loop is inside the loop but here loop is after the loop.
Example:
while(condition 1)
{
statement(s);
}
while(condition 2)
{
statement(s);
}

4. Unstructured Loop Testing:


Testing performed in an unstructured loop is known as Unstructured loop testing.
Unstructured loop is the combination of nested and concatenated loops. It is
basically a group of loops that are in no order.
Example:
while()
{
for()
{}
while()
{}
}
Advantages of Loop Testing:
The advantages of Loop testing are:
 Loop testing limits the number of iterations of loop.
 Loop testing ensures that program doesn’t go into infinite loop process.
 Loop testing endures initialization of every used variable inside the loop.
 Loop testing helps in identification of different problems inside the loop.
 Loop testing helps in determination of capacity.
Disadvantages of Loop Testing:
The disadvantages of Loop testing are:
 Loop testing is mostly effective in bug detection in low-level software.
 Loop testing is not useful in bug detection.

Data Flow Testing


Data flow testing is used to analyze the flow of data in the program. It is the
process of collecting information about how the variables flow the data in the
program. It tries to obtain particular information of each particular point in
the process.

Data flow testing makes use of control flow graphs and associations.
Types of Data Flow Testing
1. Static Data Flow Testing
Declaring the variables, using the variables, and finding the values all happen without the
code execution is static data flow testing. Control flow graphs are used for the same.
2. Dynamic Data Flow Testing
The variables and their value are examined with the code execution in dynamic data flow
testing. The changes in the variable and their references are observed with the requirement
that the code must be executed.
Associations
Here associations are made between, where the variable is defined and used. The format of
the association is as follows: (line variable declared, line variable used, variable name).
1. int(x)
2. if(x%2==0)
3. x=x+10
4. else
5. x=x+5
Associations of the above code are as follows:
(1,(2,t),x) for the true condition in line 2 (1,(2,f),x) for the false condition in line 2 (1,3,x) for
the x being used in line 3 (1,5,x) for the x being used in line 5
There are two types of uses of variables based on how they are being used in the code.
Predicate use: This value decides the flow of the code, as in line 2 is called p-
use. Computational use: The variable's value is used by another variable, so if we have z=x in
line 6. That would be a c-use.
Advantages of Data Flow Testing
1. Data flow testing helps to redefine the flow of code.
2. It helps to identify the excess code if it exists.
3. It helps to identify computational variables.
4. It tests the code without executing it.
Disadvantages of Data Flow Testing
1. Since it is white box testing, coding knowledge is required.
2. It is a time-consuming testing process.
3. It requires a good amount of manual testing.
4. It is a slow process as a lot of manual intervention is required.
Data Flow Testing Coverage
1. All definition coverage: It covers all the sub-paths from each definition.
2. All definition-c use coverage: It covers all the computation use sub-paths from each
definition
3. All definition-p use coverage: It covers all the predicate use sub-paths from each
definition
4. All-use coverage: It covers all the c-use and p-use sub-paths from each definition.
5. All definition use coverage: It covers all the sub-paths from definition to their
respective use.

What is Mutation Testing?


Mutation Testing is a type of software testing in which certain statements of the source
code are changed/mutated to check if the test cases are able to find errors in source code.
The goal of Mutation Testing is ensuring the quality of test cases in terms of robustness that
it should fail the mutated source code.
The changes made in the mutant program should be kept extremely small that it does not
affect the overall objective of the program. Mutation Testing is also called Fault-based
testing strategy as it involves creating a fault in the program and it is a type of White Box
Testing which is mainly used for Unit Testing.
How to execute Mutation Testing?

ollowing are the steps to execute mutation testing (mutation analysis):


Step 1: Faults are introduced into the source code of the program by creating many versions
called mutants. Each mutant should contain a single fault, and the goal is to cause the
mutant version to fail which demonstrates the effectiveness of the test cases.
Step 2: Test cases are applied to the original program and also to the mutant program. A Test
Case should be adequate, and it is tweaked to detect faults in a program.
Step 3: Compare the results of an original and mutant program.
Step 4: If the original program and mutant programs generate the different output, then that
the mutant is killed by the test case. Hence the test case is good enough to detect the
change between the original and the mutant program.
Step 5: If the original program and mutant program generate the same output, Mutant is
kept alive. In such cases, more effective test cases need to be created that kill all mutants.
How to Create Mutant Programs?
A mutation is nothing but a single syntactic change that is made to the program statement.
Each mutant program should differ from the original program by one mutation.

Original Program Mutant Program

If (x>y) If(x<y)
Print “Hello” Print “Hello”
Else Else
Print “Hi” Print “Hi”

You might also like