Unit 4
Unit 4
Testing Concepts
As mentioned, in testing, the software under test (SUT) is executed with a set of test
cases. As discussed, devising a set of test cases that will guarantee that all errors will
be detected is not feasible. Moreover, there are no formal or precise methods for
selecting test cases. Even though there are a number of heuristics and rules of thumb
for deciding the test cases, selecting test cases is still a creative activity that relies on
the ingenuity of the tester. Because of this, the psychology of the person performing
the testing becomes important. A basic purpose of testing is to detect the errors that
may be present in the program. Hence, one should not start testing with the intent of
showing that a program works; rather the intent should be to show that a program does
not work; to reveal any defect that may exist. Due to this, testing has also been defined
as the process of executing a program with the intent of finding errors .
This emphasis on proper intent of testing is not a trivial matter because test cases are
designed by human beings, and human beings have a tendency to perform actions to
achieve the goal they have in mind. So, if the goal is to demonstrate that a program
works, we may consciously or subconsciously select test cases that will try to
demonstrate that goal and that will beat the basic purpose of testing. On the other
hand, if the intent is to show that the program does not work, we will challenge our
intellect to find test cases toward that end, and we are likely to detect more errors.
Testing is essentially a destructive process, where the tester has to treat the program
as an one's opponent in a contest that must be beaten by the tester by showing the
presence of errors. This is one of the reasons why many organizations employ
independent testing in which testing is done by a team that was not involved in
building the system.
Explain the process of testing with test oracle and test cases
A test oracle is a mechanism; different from the program itself that can be used to
check the correctness of the output of the program for the test cases. Conceptually, we
can consider testing a process in which the test cases are given to the test oracle and
the program under testing.
The output of the two is then compared to determine if the program behaved correctly
for test cases. To help the oracle determine the correct behavior, it is important that
the behavior of the system or component be unambiguously specified and that the
specification itself is error free.
There are some systems where oracles are automatically generated from specifications
of programs or modules. With such oracles, we are assured that the output of the
oracle is consistent with the specifications.
A test case is a document, which has a set of test data, preconditions, expected results
and post conditions, developed for a particular test scenario in order to verify
compliance against a specific requirement.
Test Case acts as the starting point for the test execution, and after applying a set of
input values, the application has a definitive outcome and leaves the system at some
end point or also known as execution post condition.
Equivalence partitioning is a Test Case Design Technique to divide the input data of
software into different equivalence data classes. Test cases are designed for
equivalence data class. The equivalence partitions are frequently derived from the
requirements specification for input data that influence the processing of the test
object. A use of this method reduces the time necessary for testing software using less
and effective test cases.
It can be used at any level of software for testing and is preferably a good technique to
use first. In this technique, only one condition to be tested from each partition. Because
we assume that, all the conditions in one partition behave in the same manner by the
software. In a partition, if one condition works other will definitely work. Likewise we
assume that, if one of the condition does not work then none of the conditions in that
partition will work.
Equivalence partitioning is a testing technique where input values set into classes for
testing.
At the time of testing, test 4 and 12 as invalid values and 7 as valid one.
It is easy to test input ranges 6–10 but harder to test input ranges 2-600. Testing will be
easy in the case of lesser test cases but you should be very careful. Assuming, valid
input is 7. That means, you belief that the developer coded the correct valid range (6-
10).
Cause-Effect Graph graphically shows the connection between a given outcome and all
issues that manipulate the outcome. Cause Effect Graph is a black box testing technique.
It is generally uses for hardware testing but now adapted to software testing, usually
tests external behavior of a system. It is a testing technique that aids in choosing test
cases that logically relate Causes (inputs) to Effects (outputs) to produce test cases.
A “Cause” stands for a separate input condition that fetches about an internal change
in the system. An “Effect” represents an output condition, a system transformation or a
state resulting from a combination of causes.
Drawing Cause-Effect Graphs
Explain the structural testing with an approach
Structural testing, also known as glass box testing or white box testing is an approach
where the tests are derived from the knowledge of the software's structure or internal
implementation.
The other names of structural testing includes clear box testing, open box testing, logic
driven testing or path driven testing.
Structural Testing Techniques:
● Statement Coverage - This technique is aimed at exercising all programming
statements with minimal tests.
● Branch Coverage - This technique is running a series of tests to ensure that all
branches are tested at least once.
● Path Coverage - This technique corresponds to testing all possible paths which
means that each statement and branch are covered.
Structural testing is basically related to the internal design and implementation of the
software i.e. it involves the development team members in the testing team. It
basically tests different aspects of the software according to its types. Structural testing
is just the opposite of behavioral testing.
1. Node
2. Edge
3. Decision Node
4. Junction node
Node
Nodes in the control flow graph are used to create a path of procedures. Basically, it
represents the sequence of procedures which procedure is next to come so, the tester
can determine the sequence of occurrence of procedures.
We can see below in example the first node represent the start procedure and the next
procedure is to assign the value of n after assigning the value there is decision node to
decide next node of procedure as per the value of n if it is 18 or more than 18 so
Eligible procedure will execute otherwise if it is less than 18 Not Eligible procedure
executes. The next node is the junction node, and the last node is stop node to stop the
procedure.
Edge
Edge in control flow graph is used to link the direction of nodes.
We can see below in example all arrows are used to link the nodes in an appropriate
direction.
Decision node
Decision node in the control flow graph is used to decide next node of procedure as per
the value.
We can see below in example decision node decide next node of procedure as per the
value of n if it is 18 or more than 18 so Eligible procedure will execute otherwise if it is
less than 18, Not Eligible procedure executes.
Junction node
Junction node in control flow graph is the point where at least three links meet.
Diagram - control flow graph
The above example shows eligibility criteria of age for voting where if age is 18 or more
than 18 so print message "You are eligible for voting" if it is less than 18 then print
"You are not eligible for voting."
Program for this scenario is written above, and the control flow graph is designed for
the testing purpose.
In the control flow graph, start, age, eligible, not eligible and stop are the nodes,
n>=18 is a decision node to decide which part (if or else) will execute as per the given
value. Connectivity of the eligible node and not eligible node is there on the stop node.
Test cases are designed through the flow graph of the programs to determine the
execution path is correct or not. All nodes, junction, edges, and decision are the
essential parts to design test cases.
Software maintenance
Software maintenance is the process of changing, modifying, and updating software to
keep up with customer needs. Software maintenance is done after the product has
launched for several reasons including improving the software overall, correcting issues
or bugs, to boost performance, and more.
Software maintenance is a natural part of SDLC (software development life cycle).
Software developers don’t have the luxury of launching a product and letting it run,
they constantly need to be on the lookout to both correct and improve their software to
remain competitive and relevant.
Using the right software maintenance techniques and strategies is a critical part of
keeping any software running for a long period of time and keeping customers and
users happy.