Unit-1 STQA
Unit-1 STQA
PLAN (P) – Devise a Plan. Define objective and determine the strategy and supporting
methods required to achieve that objective.
DO (D) – Execute the Plan. Create the conditions and perform the necessary training to
execute the plan.
CHECK (C) – Check the Results. Check to determine whether work is progressing according
to the plan and whether the expected results are obtained.
ACT (A) – Take the necessary Action. If the check up reveals that the work is not being
performed according to plan or that results are not what was anticipated, devise measures
for appropriate action
                           Need of Testing
• To point out the defects and errors that were made during the development
phases.
• Software Testing is itself an expensive activity but launching a software without
testing may lead to cost potentially much higher than that of testing.
• Testing is necessary in order to provide the facilities to the customers like the
delivery of high quality product or software application which requires lower
maintenance cost and hence results into more accurate, consistent and reliable
results.
• It makes sure of the Customer’s reliability and their satisfaction in the application.
• Testing is required for an effective performance of software application or product.
• Something that works when one person is using it may or may not work when
hundreds of people are using it (100’s of people hitting a website at the same time
can lead to crashing down)
• There are lots of different devices, browsers and operating systems available (Test
it for compatibility)
               Who should do the Testing?
• It depends on the process and associated stakeholders of the project. In IT
industry, large companies have separate team. In most cases, following
professionals are involved:
•Software Tester
•Software Developer
•End User
• Study the functionality in detail to find where bugs are likely to occur
• Study the code to ensure each and every line of code is tested
• Create test cases in such a way that testing is done to uncover the hidden
Conclusion:
•A Bug is the result of a coding Error and A Defect is a deviation from the Requirements.  A defect
does not necessarily mean there is a bug in the code, it could be a function that was not
implemented but defined in the requirements of the software.
              What should We
•
                       Test  ?
    We should test the program’s responses to every
   possible input. It means, we should test for all
  valid and invalid inputs.
• Suppose a program requires two 8 bit integers as
   inputs.
• Total possible combinations are 28 * 28.
• We have also not considered invalid inputs
  where so many combinations are possible.
  Hence, complete testing is just not possible,
  although, we may wish to do so.
                                    Test, Test Case and Test
                                              Suite
   • Test and Test case terms are used interchangeably. Test case is a document which
     consists of a set of inputs, preconditions and expected outcomes developed for a
     particular objective such as to verify compliance with a specific requirement.
   • The process of developing test cases can also help find problems in the requirements
     or design of an application.
   • The set of test cases is called a test suite. Hence any combination of test cases may
     generate a test suite.
Test   Test case     Pre-            Test       Test    Expected   Actual   Status      Created   Date of    Executed   Date of
case   description   conditions      steps      Data    Result     Result               by        creation   By         execution
ID
    Case 4: Check for CVV number with the invalid characters as well as with the alphabetic & alpha
    numeric values.
    Description: Enter invalid CVV number. Like: ABC or a3c. or @@" or "1".
    Expected Result: Error message should appear information. Invalid characters are entered.
    Case 5: Check for validation messages while enter wrong billing information.
    Description: Check for Maximum & Minimum value acceptance. Check for invalid Characters.
    Check for Numeric value acceptance where numeric values are required & vice-versa.
    Expected Result: Error message should appear while entering invalid values.
      What is a GOOD Test?
    Has
    Has aa high
           high
  probability
   probabilityofof
finding
 findingan
         anerror.
             error.
                    ItItmust
                        mustnot
                             notbe
                                 be
                 redundant.
                  redundant. Every
                               Every
                  test
                   testmust
                         must have
                              have aa
                 different
                 differentpurpose.
                             purpose.
                                  ItItshould
                                       shouldneither
                                                neither
                                     be
                                      be too
                                          too simple,
                                              simple,
                                  nor
                                  nor tootoo complex.
                                              complex.
                 Objectives Of
                   Testing
Uncovering different cases of errors.
Validate the quality of a software using the minimum cost, effort and
 time.
Showing that software functions work according to specification.
Generate high quality test cases, perform effective tests and issue
 correct and helpful problem reports.
Step I
•Add 2 & 3
•5 will be displayed
Problem Reports After First
                Test
• The program worked in the sense that it accepted 2 &
   3, and returned 5. But it still has problems.
• Design Errors:- No On screen Instructions. How do
  we know what to do?
Instructions could easily be displayed on the screen.
• The errors are described in problem report form.
Submit one problem report for each error. All errors
  could fit on the same report but that is not a good
 idea.
Problems that are grouped together might not be
 fixed at the same time. The unfixed ones will be lost.
If the developer wants to group them, he /she can
 sort the reports himself/ herself.
• Make some notes about what else needs testing.
• Some of the notes may turn into formal test series that is
   well-documented groups of tests that may be probably
  used each time we test a new version of the program.
     TESTS OF VALID INPUT
Sr. No. Test Case   Expected   Notes
                    Results
1.     99 + 99      198        Largest pair of
                               numbers the
                               program can add
2.     -99 +(-99)   -198       The specification
                               did not say we
                               cannot use negative
                               numbers.
3.   99 + (-14)   85    Contd
                         A large first number might affect
                         the program’s interpretation of
                        …the second
4.   -38 + 99     61      Check addition of a negative to a
                          positive number.
5.   56 + 99      155     Large second number’s effect on
                          first.
6.   9+9          18      9 is the largest one digit number
7.   0+0          0       Programs often fail on zero.
8.   0 + 23       23      0 should be tested in first and
9.   -78 + 0      -78     second entry position
                   Step III
• Check the invalid cases and see what
  happens.
• The largest sum that it can handle is 198 and the smallest is 0.
Testing starts with known conditions, uses     Debugging starts from possibly unknown initial
predefined procedures and has predictable      conditions and the end cannot be predicted
outcomes.                                      except statistically.
Testing can and should be planned, designed    Procedure and duration of debugging cannot be
and scheduled.                                 so constrained.
Can be done with design knowledge Impossible without detailed design knowledge
System A
                     Sub-system                          Sub-system
                      A1/STUB                             A2/STUB
• STUB is the replacement of a method that has not yet been implemented or tested
• A stub has the same header as the method it replaces, but its body only displays a
  message indicating that stub was called (returns a default result if a return is needed)
• In above diagram, a software system A consists of sub-systems A1 and A2. System A is
  tested while A1 and A2 are not tested
          Top-down Testing Technique
Advantages
• Early testing of complete system provides confidence to
  the team and customer
• Very useful if there are too many bugs at the top level
Drawbacks
• If sub-system is not ready, stubs need to be written,
  which is an additional effort
               Bottom-up Testing Technique
• In bottom up approach, lower level components are created first.
• If the top level system is not ready, a driver is developed to simulate the top level
  module
                                    System A/Driver
                     Sub-system                          Sub-system
                         A1                                  A2
• A driver program declares any necessary object instances and variables, assigns values
  to any of the method’s inputs, calls the method, and displays the values of any
  outputs returned by the method.
• You can put a main method in a class to serve as the test driver for that class’s
  methods.
• Sub-system A1 and A2 are tested. A driver can be used in place of system A, if it is not
  yet developed
         Bottom-up Testing Technique
Advantages:
• Good technique if majority of bugs occur at sub-system
  level
• Easier to write test cases because sub-systems are small in
  size
Drawbacks:
• A driver must be written if the top system is not
  developed, leading to additional effort
                     Box Technique
• Black Box Testing: It is a software testing methodology
  where functionality of the software is examined without
  looking into the internals of the application. This
  technique is used by the customers and functional
  testing team
• White box testing: It is a testing methodology which
  looks at the internal working of a system. It is used by
  the development team
                             Levels of
•    There are 3 levels of    Testing
     testing:
i. Unit Testing
ii. Integration Testing
iii. System Testing
                               Unit
                            Testing
• It is the testing of an individual unit or group of related
  units.
• It falls under the class of white box testing.
• It is often done by the programmer to test that the unit
  he/she has implemented is producing expected output
  against given input
• The size of a single module is small enough that we can
  locate an error fairly easily.
                             Integration
                                  Testing
The purpose of unit testing is to determine that each independent module is
correctly implemented. This gives little chance to determine that the interface
between modules is also correct, and for this reason integration testing must
be performed. One specific target of integration testing is the interface:
whether parameters match on both sides as to type, permissible ranges,
meaning and utilization.
                Integration
                  Testing
• Integration Test case differs from other test
  cases in the sense it focuses mainly on the
  interfaces & flow of data/information
  between the modules.
• Priority is to be given for the integrating
  links rather than the unit functions which are
   already tested
                Integration
                  Testing
Sample Integration Test Cases for the
following scenario: Application has 3 modules
say 'Login Page', 'Mail box' and 'Delete mails'
and each of them are integrated logically.
Approaches/Methodologies/Strategies of
            Integration Testing:
 • Big Bang Approach
 • Incremental Approach: which is further
   divided into following
   – Top Down Approach
   – Bottom Up Approach
   – Sandwich Approach - Combination of Top Down
     and Bottom Up
   Integration Testing: Big-Bang Approach
All components (units) are first tested individually and then together as a single and entire
system:
♦Pros:
No test stubs and drivers are needed
♦Cons:
Difficult to pinpoint the specific component responsible for the failure
             Bottom-up Testing
•
                     Strategy
    The subsystem in the lowest layer of the call
    hierarchy are tested individually.
•   Then the next subsystems are integrated and
    tested from the next layer up that call the
    previously tested subsystems
•   This is done repeatedly until all subsystems
    are included in the testing
•   Only Test Drivers are used to simulate the
    components of higher layers
•   No Test Stubs!
Bottom-up
Integration
                    Bottom-up Integration
Testing Approach :
Test 2 such that it calls 4 and 5 separately. If an error occurs we know that the problem is in one
of the modules.
Test 1 such that it calls 3 and If an error occurs we know that the problem is in 3 or in the
interface between 1 and 3.
  Pros and Cons of Bottom-up Integration
                    Testing
Pros:
•Interface faults can be more easily found (the usage of
test drivers accomplishes a clear intention of the
underlying interfaces of the lower layer)
•No Stubs are necessary
Cons:
•Components of the User Interface are tested last
•Faults found in the top layer may lead to changes in the
subsystems of lower layers, invalidating previous tests.
               Top-down Testing
•
                      Strategy
    Test the top layer or the controlling subsystem
    first
•   Then combine all the subsystems that are called
    by the tested subsystems and test the resulting
    collection of subsystems
•   Do this until all subsystems are incorporated into
     the test
•   Test Stubs are used to simulate the components
    of lower layers that have not yet been
    integrated.
•   No drivers are needed
Top-down Integration
      Testing
                     Top-down Integration
                           Testing
The order of Integration will be: 1,2 1,3 2,Stub 1 2,Stub 2 3,Stub 3 3,Stub 4
Testing
                        Firstly, the integration between the
Approach:
                         modules 1,2 and 3
• If these tests do not produce the same outputs as before, this implies that
  the new increment has, in some way, interfered with the functionality of
  the existing system
                    Regression testing
Problem:
•Given program P, its modified version P’, and a test set T that
was used to previously test P, find a way to utilize T to gain
sufficient confidence in the correctness of P’
        Who performs Software
             Regression?
Developers - regression testing at the unit level
   or integration
Test engineers - regression testing at the
  function level
QA and test engineers - regression testing at
  the system level
                   Software Regression
                             Process
Step #1: Software Change Analysis
-Understand and analyze various software changes.
Step #2: Software Change Impact Analysis
-Understand and analyze software change impacts
Step #3: Define Regression Test Strategy and Criteria
Step #4: Define, select, and reuse test cases to form a regression test suite
Step  #5: Perform re-testing at the different levels.
-re-testing at the unit level
-re-testing at integration level
-re-testing at the function level
-re-testing at the system level
Step #6: Report and analyze regression test results
            Different Types of Software
                      Changes
Requirements          Requirements Spec. Changes
analysis              -> add new functional features
                      -> change current function features
                      -> delete existing function features
• Retesting requires
Test suites
                      What to do?
  Minimization        Selection      Prioritization
                Regression Test
                 Minimization
• Test suite minimization seeks to eliminate
  redundant test cases in order to reduce the
  number of tests to run.
T7               1               45             0
T8               1               55             0
T9               1               55             0
LOC that are still to be executed are – [5, 15, 35, 45,
55]
             Version Specific Test Case
                      Prioritization Contd…
• T1 is elected for execution & it covers lines no 1&2 so
  the modified lines are 5,15,35,45,55.
T3          5                1
T5          5,15             2
T6          15,35            2
T7          45               1
T8 55 1
T9          55               1
Test cases No. of                 Line   Candidate
           matches                Number
           found
T5         2                      5,15             1   Selected for
                                                       Execution
T6         2                      15,35            0
T3                1               5                0   Removed
                                                       as selected
T7                1               45               0   for
                                                       execution
T8                1               55               0
T9                1               55               0
LOC that are still to be executed are – [35, 45,
55]
Test case   Modified Lines   No. of Matches
T6 15,35 2
T7 45 1
T8 55 1
T9          55               1
Test            No. of  Line   Candidate
cases           matches Number
                found
                                                   Selected for
T6              1               35             1   Execution
T7              1               45             1
T8              1               55             1
T9              1               55             0   Duplicate
ANALOGY
During the process of manufacturing a ballpoint pen, the cap, the
body, the tail and clip, the ink cartridge and the ballpoint are produced
 separately and unit tested separately. When two or more units are
ready, they are assembled and Integration Testing is performed.
When the complete pen is integrated, System Testing is performed.
Once System Testing is complete, Acceptance Testing is performed so
as to confirm that the ballpoint pen is ready to be made available to
the end-users.
• Usually, Black Box Testing method is used in Acceptance Testing.
When is it performed?
• Acceptance Testing is performed after System Testing and before
  making the system available for actual use.
Who performs it?
Internal Acceptance Testing (Also known as Alpha Testing)
• Performed mainly by the in-house software QA and testing teams.
• Alpha testing is the last testing done by the test teams at the development
   site before releasing the software for beta test.
• Focus is to simulate real users
• Alpha testing aims at carrying out tasks that a typical user might perform
• Alpha testing is conducted in a controlled lab environment
System
• Validation:
"Are we building the right product"
• The software should do what the user really
  requires
        Difference between Verification and Validation
                      Verification                                                  Validation
It is a process that makes it sure that the software It refers to a different set of activities which ensure
product is developed in the right way.               that the software built is traceable to customer
"Are we building the product right“                  requirements
                                                     "Are we building the right product”
It ensures that software confirms to its predefined          Validation physically ensures that the system operates
specifications, as the product development goes              according to plan by executing the system functions
through different stages, an analysis is done to ensure      through a series of tests that can be observed and
that all required specifications are met.                    evaluated.
Verification is a static practice of verifying documents,    Validation is a dynamic mechanism of validating and
design, code and program.                                    testing the actual product.
It does not involve executing the code.                      It always involves executing the code.
Verification uses methods like inspections, reviews,         Validation uses methods like black box (functional) 
walkthroughs etc.                                            testing, white box (structural) testing etc.
It can catch errors that validation cannot catch. It is low It can catch errors that verification cannot catch. It is
level exercise.                                             High Level Exercise.
Target is requirements specification, application and        Target is actual product-a unit, a module, a bent of
software architecture, high level, complete design, and      integrated modules, and effective final product.
database design etc.
It generally comes first-done before validation.             It generally follows after verification
             The V & V process
• V&V is a process of checking that a software
  meets specifications and fulfills its intended
  purpose
This model suggests parallel work on the testing sub-phases along with other phases. It suggests
that unit test cases are written while low level design is in progress and so on
 How to test software requirements
        specification (SRS)?
• “Most of the bugs in software are due to
  incomplete or inaccurate functional
  requirements.” The software code, doesn’t matter
  how well it’s written, can’t do anything if there are
  ambiguities in requirements.
   How to measure functional software
requirement specification (SRS) documents?
• We need to define some standard tests to
  measure the requirements. Once each
  requirement is passed through these tests you can
  evaluate and freeze the functional requirements.
• Let’s take an example. You are working on a web
  based application. Requirement is as follows:
  “Web application should be able to serve the user
  queries as early as possible”
How will you freeze the requirement in
               this case?
• What will be your requirement satisfaction
  criteria? To get the answer, ask this question to
  stakeholders: How much response time is ok for
  you?
• If they say, we will accept the response if it’s
  within 2 seconds, then this is your requirement
  measure. Freeze this requirement and carry the
  same procedure for next requirement.
• “Requirements should be clear and consistent.”
• “Discover missing requirements.”
• For checking the requirements completeness, divide
  requirements in three sections, ‘Must implement’
  requirements, requirements those are not specified but are
  ‘assumed’ and third type is ‘imagination’ type of
  requirements. Check if all type of requirements are
  addressed before software design phase.
• Requirements specification (SRS) doc should
  address following: Project functionality (What
  should be done and what should not)
• Software, Hardware interfaces and user interface
• System Correctness, Security and performance
  criteria
• Implementation issues (risks) if any
“Requirements should be clear and specific with no
  uncertainty, requirements should be measurable
  in terms of specific values, requirements should be
  testable having some evaluation criteria for each
  requirement, and requirements should be
  complete, without any contradictions”
      Static and Dynamic black box
                 testing
• Under Static Testing code is not executed.
  Rather it manually checks the code,
  requirement documents, and design
  documents to find errors. Hence, the name
  "static".
• Main objective of this testing is to improve the
  quality of software products by finding errors in
  early stages of the development cycle. This
  testing is also called as Non-execution
  technique or verification testing.
                   Static
                  Testing
It examines work documents and provides
review comments. Work document can be of
 following:
•Requirement specifications
•Design document
•Source Code
•Test Plans
•Test Cases
•Test Scripts
•Help or User document
•Web Page content
      Static Testing Techniques
• Unit testing
• Integration testing
• System testing
• Acceptance testing
 Difference between Static and Dynamic testing
                    Static testing                                         Dynamic testing
Static testing involves verification of activities of the Dynamic testing involves working with the
developed software                                        software, giving input values and checking if the
                                                          output is as expected.
It is white box testing which is done at early stage    Can be either black or white box and is done at later
of development                                          stage of development
Static testing is done before the code deployment       Dynamic testing is done after code deployment
(verification stage)                                    (validation stage).
5. Check-in book
Librarians can check in a book using its call number
The check-in can be initiated from a previous search operation where
   user has selected a set of books.
The return date would automatically reflect the current system date.
   Any late fees would be computed as difference between due date
   and return date at rate of 10 cents a day.