Docstoc

Software Testing

Document Sample
Software Testing Powered By Docstoc
					   Software Testing




                       1
1: Operating Systems Overview   2
1: Operating Systems Overview   3
What is a computer
 A computer is a fast and accurate data manipulating
  system that is designed to accept and store input data,
  process them and produce output results under the
  direction of a stored program of instruction
 A computer works with information presented in the
  form of 1s and 0s because it is built of the principle of
  the presence or absence of an electronic signal.




                                                          4
Parts of a digital computer

 Input devices
 Central Processing unit
 Output devices
 Secondary storage devices




                              5
Components of a computer
 Hardware -> term used to represent the physical and
  tangible components of the computer which can be
  seen and touched.
 Software-> A set of instructions stored as programs
  that govern the operation of a computer system and
  make the hardware run. Software can be classified as
       System software
       Application software




                                                         6
System software
 The user of a computer has a large number of software
 provided by the manufacturer at his disposal. These
 programs are used to run the computer system and
 aid the application programmer in doing his work.
 Such programs are known as system software. Is is
 subdivided into
       Operating System
       Translators
       Utilities and service programs



                                                          7
Operating Systems
 It is a software that control the execution of computer
  programs inside the system.
 DOS
 UNIX
 LINUX
 WINDOWS




                                                            8
Translators
 Programs developed to translate programs written in
 high level language to machine code is known as
 translators. Three types are there
   Assemblers
   Compilers
   Interpreters




                                                        9
Utilities
 System programs which provide a useful service to the
 user of the computer by providing common tasks of a
 routine nature. Common types are
   Sort utilities
   Editors
   Debuggers
   File maintenance utilities




                                                       10
Application Software
 programs    written by programmers within an
 organization that enable the computer to produce
 useful work such as specific inventory control,
 attendance accounting etc.




                                                11
Programming Language
 A language is a medium for communication
 A programming language consists of all the symbols,
  characters and usage rules that permit people to
  communicate with computers.
 Ex:- C, C++, java, C#, Pascal, COBOL, Fortran etc..




                                                        12
C Language




             13
printf
 Predefined function for printing output.
 Syntax
      printf(“message”);
message will be printed on screen
     printf(“%d”,n);
Value of the variable n will be printed on screen
     printf(“message %d “, n);
Message followed by the value of n will be shown on
 screen


                                                      14
scanf
 Function using for reading data from the keyboard.
Syntax
  scanf(“control string”,&variable1,&variable2..);
 control string-> contains the format of data being
                 received.
  %d –> integer
  %f -> float
  %s -> string
 ex:- scanf(“%d”,&a);


                                                       15
Data types
Keyword    Purpose           Range                Control String
int        Integer number    -32768 to 32767      %d
long int   Integer number    -2,147,483648 to     %ld
                             +2147483647
float      Decimal numbers   3.4E-38 to 3.4E+38   %f
double     Decimal Numbers   1.7E-308 to          %lf
                             1.7E+308
char       Alpha numeric     -128 to 127          %c




                                                                   16
Operators
Category               Operators

Relational operators   <, <=, >, >=, !=, ==

Logical Operators      &&, ||, !

Arithmetic opertors    +, -, *, /, %,




                                              17
Conditional statements
 If(condition)
  {
      statement block;
   }
 If(condition)
   {
     statement block
   }
  else
   {     Statement block
   }
                           18
 If(condition)
  {
      statement block
  }
 else if(condition)
  {
    statement block
  }




                        19
Looping statements
 for(variable=value; condition;Updation)
    {
        block of statements
    }
 while(condition)
   {
      block of statements
  }


                                            20
Software Testing




                   21
Software testing
 Every software product has a target
 audience. when an organization
 develop a software product, it can
 assess whether the software product
 will be acceptable to its target
 audience. Software testing is the
 process of attempting to make this
 assessment.

                                    22
Goals of software testing
 A primary goal for testing is to detect software failures
  so that defects may be uncovered and corrected.
 meets the business and technical requirements that
  guided the design of the product
 To make sure that the software works as expected




                                                          23
Functional vs non-functional testing
 Functional testing refers to tests that verify a specific
  action or function of the code. These are usually found
  in the code requirements documentation. Functional
  tests tend to answer the question of "can the user do
  this" or "does this particular feature work".
 Non-functional testing tends to answer such questions
  as "how many people can log in at once".




                                                              24
Defects and failures
 Not all software defects are caused by coding errors.
  One common source of expensive defects is caused by
  requirement gaps
 Software faults occur through the following processes.
  A programmer makes an error which results in a bug
  in the software source code. If this bug is executed, in
  certain situations the system will produce wrong
  results, causing a failure.
 A defect can turn into a failure when the environment
  is changed. Eg:- running in a new hardware .
 A single defect may result in a wide range of failure
  symptoms.
                                                        25
Finding faults early
 The earlier a defect is found the cheaper it is to fix it.
   For example, if a problem in the requirements is found
  only post-release, then it would cost 10–100 times more
  to fix than if it had already been found by the
  requirements review.




                                                               26
Compatibility
 A common cause of software failure is a lack of
 compatibility     with other application software,
 operating systems or target environments that differ
 greatly from the original.




                                                    27
Input combinations and preconditions
 A very fundamental problem with software testing is
 that testing under all combinations of inputs and
 preconditions is not feasible, even with a simple
 product. This means that the number of defects in a
 software product can be very large and defects that
 occur infrequently are difficult to find in testing




                                                    28
Static vs. dynamic testing
 There are many approaches to software testing.
  Reviews, walkthroughs or inspections are considered
  as static testing.
 Actual execution of the programmed code with a
  given set of test cases is referred to as dynamic testing.
 Dynamic testing takes place when the program itself is
  used for the first time
 Dynamic testing may begin before the program is
  100% complete in order to test particular sections of
  code.


                                                           29
Software verification and validation
 Verification is the process of evaluating a system or
  component to determine whether the products of a
  given development phase satisfy the conditions
  imposed at the start of that phase.
 Validation is the process of evaluating a system or
  component during or at the end of the development
  process to determine whether it satisfies specified
  requirements.



                                                      30
Software Development Life Cycle

 Requirement gathering and Analysis
 Planning
 Design
 Development or coding
 Testing
 Deployment and Maintenance




                                       31
The software testing team
 Software testing can be done by software testers.
 Regarding the periods and the different goals in
 software testing,[20] different roles have been
 established: manager, test lead, test designer, tester,
 automation developer, and test administrator.




                                                           32
Software quality assurance
(SQA)
 software testing is an important part of the software
  quality assurance (SQA) process. In SQA, software
  process specialists and auditors take a broader view on
  software and its development. They examine and
  change the software engineering process itself to
  reduce the amount of faults that end up in the
  delivered software: the so-called defect rate.
 What constitutes an "acceptable defect rate" depends
  on the nature of the software; A flight simulator video
  game would have much higher defect tolerance than
  software for an actual airplane.
                                                            33
 Although there are close links with SQA, testing
  departments often exist independently.
 Software testing is a task intended to detect defects in
  software by contrasting a computer program's
  expected results with its actual results for a given set of
  inputs. By contrast, QA (quality assurance) is the
  implementation of policies and procedures intended
  to prevent defects from occurring in the first place.



                                                            34
Types of Testing




                   35
Types of testing
      White Box Testing
      Black Box Testing
      Integration Testing
      System and Acceptance Testing
      Performance Testing
      Regression Testing
      Internationalization Testing
      Ad hoc Testing




                                       36
 White box testing
 White box testing is when the tester has access to the
 internal data structures and algorithms including the
 code that implement these.




                                                         37
Types of White box Testing
                                            White box
                                             testing




                                                                                  Structural
            Static testing
                                                                                   Testing



                                              Unit/code
   Desk        Code             Code                                 Code                                   Code
                                              functional
 Checking   Walkthrough      Inspection                            coverage                               complexity
                                                testing




                                      Statement                               Condition        Function   Cyclomatic
                                                        Path coverage
                                       coverage                               coverage         coverage   complexity




                                                                                                                   38
Static Testing
 A type of testing which requires only the source code
 of the product not the binaries or executables.
  Static testing make sure the following
   Whether the code works according to the functional
    requirement
   Whether the code has been written in accordance with
    the design developed earlier in the project life cycle
   Whether the code for any functionality has been missed
    out
   Whether the code handles errors properly

                                                             39
Static testing by humans
 Desk checking of the code-> it is a method to verify
  the portions of the code for correctness. Such
  verification is done by comparing the code with
  design specification. It is an unstructured method. No
  log is maintained.
 Code walkthrough-> In walk throughs, a set of people
  look at the program code and raise the questions from
  the author. The author explains the logic of the code
  and answers the questions.


                                                         40
Formal Inspection -> The focus of this method is to
  detect all faults, violations and other side-effects.
  There are four roles in inspection
 Author - > author of the code
 Moderator -> formally run the inspection according to
  the process
 Inspectors -> people who actually provides, review
  comments for the code
 Scribes-> Takes detailed notes during the inspection
  meeting and circulates them to the inspection team
  after the meeting


                                                          41
Structural Testing
 Unit/code Functional testing->This corresponds to
 some quick checks that a developer performs before
 subjecting the code to more extensive code coverage
 testing. This includes
   Knowing the input variables and the corresponding
    expected output
   Putting intermediate print statements and making sure
    the program is passing through the right loops and
    iterations the right number of times
   Run the debugger to stop the execution at the end of
    each instruction and verify the result, setting break
    points at any function or instruction etc
                                                            42
Code coverage testing
 It involves designing and executing test cases and
  finding out the percentage of code that is covered by
  testing.
 Percentage of code covered by is determined by a
  method called instrumentation.
 There are specialized tools for instrumentation
 Instrumentation rebuilds the product with a set of
  libraries provided by the tool vendors. This
  instrumented code can monitor and keep an audit of
  what portions of the code are covered.
                                                          43
Statement coverage
 Any programming language has
       Sequential control flow
       Two-way decision statement like it then else
       Multi-way decision statement like switch
       Loops like while, for etc
 Statement coverage test refers to writing test cases that
  execute each of the above program statements.
 Statement coverage=(total statement exercised /total
  number of executable statements in the program)*100


                                                          44
Path Coverage
 Here we split the program into a number of distinct
  paths. A program can start from the beginning and
  take any of the paths to its completion
 Path coverage provides a stronger condition of
  coverage than statement coverage as it relates to the
  logical paths in the program rather than just program
  statements.




                                                          45
Condition Coverage
 Condition coverage = ( total decisions exercised / Total
  number of decisions in program) * 100
 It gives an indication of the percentage of conditions
  covered by a set of test cases.
 Condition coverage is a much stronger criteria than
  path coverage




                                                           46
Function Coverage
 Identify how many program functions are covered by
  test cases
 Functions are easier to identify in a program and
  hence it is easier to write test cases to provide function
  coverage
 It is easier to achieve 100 percentage function coverage
  than 100 percent coverage in any of the earlier
  methods



                                                               47
Code complexity Testing
 Cyclomatic complexity is a metric that quantifies the
  complexity of a program and provide answers to the
  following questions
 Which of the paths are independent ? If two paths are
  not independent, then we may be able to minimize the
  number of tests
 Is there an upper bound on the number of tests that
  must be run to ensure that all the statements have
  been executed at least once.


                                                          48
 A program is represented in the form of a flow graph.
  Flow graph consists of nodes and edges.
 A flow graph and the cyclomatic complexity provide
  indicators to the complexity of the logic flow in a
  program and to the number of independent paths in a
  program.
 Cyclomatic complexity= Edges – Nodes + 2




                                                          49
Challenges in white box testing
 Human tendency of a developer being unable to find
  the defects in his or her code
 Fully tested code may not correspond to realistic
  scenarios




                                                       50
BLACK BOX TESTING




                    51
Black box testing
 It is done without the knowledge of the internals of the
  system under test
 Black box tests are convenient to administer because
  they use the complete finished product and do not
  require any knowledge of its construction




                                                         52