Unit III
Software Testing
Unit III: Software Testing                                                                 (06 Hrs.)
Introduction to faults and failures; basic testing concepts; concepts of verification and validation;
black box and white box tests; white box test coverage – code coverage, condition coverage,
branch coverage; basic concepts of black-box tests – equivalence classes, boundary value tests,
usage of state tables; testing use cases; transaction based testing; testing for non-functional
requirements – volume, performance and efficiency; concepts of inspection.
Self Study: Open Source Tools (any one).
Detail Notes
Introduction to faults and failures:
Many people associate quality of a software system with a suggestion that some software
troubles are estimated to happen (or not).And in the case if such troubles do occur, the negative
influence is estimated to be minimal. Clue to the correctness perspective of software quality is in
the concept of defect, failure, fault and error.
Faults:
A false, wrong step, process or data definition in a software product called Fault.
Failure:
The incapacity of a system to conduct its required function within clarified performance
requirements called Failure.
Basic testing concepts:-
Software testing: Software testing is a process of executing a program with the intent of finding
errors.
Glen Myers has described the important objectives of the testing which makes a test as
“successful” test. The testing objectives are subsequent:
         The first objective is that the testing is a process of executing a program with an intension
          of finding out errors.
         The second objective or goal of testing is,a good test has very high probability of
          searching errors that are not yet found.
         The third objective is, a successful test can discover not yet found errors.
If testing is conducted successfully i.e. by following the objectives stated above, it will uncover
almost all errors in the software.
Also successful software testing leads to increase in the reliability and quality of the software.
Concepts of verification and validation:-
      Software testing is one of the elements of verification and validation. Verification can be
       defined are set of activities that make it sure that software precisely implements a
       particular function.
      Validation could be defined as distinct set of activities that makes it sure that the software
       that has been built is meeting all customer requirements.
      Before software the actual testing, testing team has to work on various activities like
       preparation of test strategy, Test planning , creation of test cases and test scripts which is
       work parallel with the development activity which help to get the test deliverable on time.
Verification:
    Evaluates the intermediary products to check whether it meets the specific requirements
       of the particular phase.
      Check whether the product is built as per the specific requirement and design
       specification.
      Checks “Are we building the product right?”
      This done without executing the software.
      It involves all the static testing techniques.
Validation:
    Evaluate the final product to check whether it meets the business needs.
      It determines whether the software is fit for use and satisfies the business need.
      Checks “Are we building the right product?”
      This is done with executing the software.
      It includes all the dynamic testing techniques.
Black box and white box tests:
Black box testing:
It is referred as behavioral testing .Black box testing is mainly related to the functional
requirements of the software.
It allows software engineers to generate set of input conditions that will completely implement
every functional requirement for a program.
It helps to find out the following errors:
                 Incorrect or missing functions
                 Interface errors
                 Behavior or performance errors
                 Initialization and termination errors
Black box test coverage criteria:
             1. Equivalence classes
             2. Boundary value tests
             3. Usage of state tables
Equivalence class testing:
           o Equivalence partitioning also called as equivalence class partitioning. It is
               abbreviated as ECP.
             o It is a software testing technique that divides the input test data of the
               application under test into each partition at least once of equivalent data from
               which test cases can be derived.
             o Equivalence partitioning is a s/w technique that involves identifying a small set
               of representative i/p values that produce as much different o/p condition as
               possible.
      Boundary value tests:
                 o Boundary value analysis is also called boundary condition data testing and is
                   based on testing at the boundaries between partitions.
                 o Here we have both valid boundaries and invalid boundaries.
                 o Boundary value analysis is a black box test design technique where test case
                   are designed by using boundary values , BVA is used in range checking.
           o Example: Suppose you have a s/w which accept values between 1-1000, so
                valid partition will be 1-1000 if you enter value 1001 then it is called invalid
                partition.
    Usage of state tables:
               o A decision table is a good way to deal with combinations of things.
               o This technique is sometimes also referred to as a ‘cause-effect’ table.
               o The first task is to identify a suitable function or subsystem which reacts
                 according to a combination of input or events.
               o The system should not contain too many inputs otherwise the number of
                 combinations will become unmanageable.
               o It is better to deal with large numbers of condition by dividing them into
                 subsets and dealing with the subsets one at a time.
White box testing:
It is called as glass box testing. It is a test case design method that uses the control structure of
the procedural design to derive test cases.
It helps to find out the following errors:
                  Logic errors and incorrect assumptions are inversely proportional to the
                   probability that a program path will be executed.
                  Typographical errors are random.
                  Logical path related errors.
White box test coverage criteria:
              1. code coverage
              2. condition coverage
              3. branch coverage
   1. Code coverage:
                              It is form of testing that inspects the code directly and is therefore
                               a form of white box testing.
                              Code coverage measurement simply determine those statements in
                               a body of code have been executed through a test run and those
                               which have not.
                              Code coverage is part of a feedback loop in the development
                               process.
                              It is also called test “coverage analysis”
                              Code coverage analysis is the process of discovering code within a
                               program that is not being exercised by test cases.
    2. Condition coverage:
                         Condition coverage reports the true or false outcome of each
                                Boolean sub-expression, separated by logical-and and logical-or if
                                they occur.
                             Condition coverage measures the sub-expressions independently of
                                each other.
    3. Branch coverage:
                             A branch is the outcome of a decision, so branch coverage simply
                                measures which decision outcomes have been tested.
                             It determine the number of branches in a method is easy .
                                The total number of decision outcome in a method is therefore
                                equal to the number of branches that need to be covered plus the
                                entry branch in the method.
Boundary value testing
It is the process of testing between extreme ends or boundaries between partitions of the input
values.
        So these extreme ends like Start- End, Lower- Upper, Maximum-Minimum, Just Inside-
         Just Outside values are called boundary values and the testing is called "boundary
         testing".
        The basic idea in boundary value testing is to select input variable values at their:
    1.   Minimum
    2.   Just above the minimum
    3.   A nominal value
    4.   Just below the maximum
    5.   Maximum
Equivalent Class
Partitioning is a black box technique (code is not visible to tester) which can be applied to all
levels of testing like unit, integration, system, etc. In this technique, you divide the set of test
condition into a partition that can be considered the same.
        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.
State Transition Testing
State Transition testing, a black box testing technique, in which outputs are triggered by
changes to the input conditions or changes to 'state' of the system. In other words, tests are
designed to execute valid and invalid state transitions.
When to use?
       When we have sequence of events that occur and associated conditions that apply to
        those events
       When the proper handling of a particular event depends on the events and conditions that
        have occurred in the past
       It is used for real time systems with various states and transitions involved
Deriving Test cases:
       Understand the various state and transition and mark each valid and invalid state
       Defining a sequence of an event that leads to an allowed test ending state
       Each one of those visited state and traversed transition should be noted down
       Steps 2 and 3 should be repeated until all states have been visited and all transitions
        traversed
       For test cases to have a good coverage, actual input values and the actual output values
        have to be generated
Advantages:
       Allows testers to familiarise with the software design and enables them to design tests
        effectively.
       It also enables testers to cover the unplanned or invalid states
Testing for non-functional requirements
A type of software testing, non functional testing is a major testing term that encapsulates
various productive testing techniques to evaluate and assess the non-functional traits of a
software application. Prime purpose of this testing methodology is to evaluate the competency
and effectiveness of an application, under variant and unforeseen conditions. 
Question Bank
Sr. No.   Question   CO   BL   Marks