Subtopic Notes

12.3 Program Testing and Maintenance

12. Software Development

Testing is one of the most crucial things in software development as it ensures that a software is reliable, functional and of high quality before it is released to end users. Testing methods allow software faults in programs to be exposed and avoided.

Types of Error

Syntax errors

  • When the code source does not follow the rules of the programming language
  • A program cannot be compiled when it has syntax errors
  • Examples:
    • Spelling mistakes in identifiers
    • Missing symbols or punctuations
    • Passing wrong arguments
    • Not Closing brackets or quotes
    • Invalid variable declaration

Logic errors

  • A logical mistake that causes the software not function as expected or give incorrect output
  • Examples:
    • Misuse of logical or arithmetic operators
    • Wrong use of loops
    • Wrong function or procedure called

Run-time errors

  • An error that cause program execution to crash or freeze
  • Occurs during the execution of the software
  • Examples:
    • Trying to access null elements
    • Dividing by zero
    • Accessing out of bounds index in arrays or string
    • File not found
    • Infinite Loops
    • Out of Memory

Methods of Testing

Dry run/Trace Table

  • Manually executing an algorithm following it’s step
  • At every step the input, variable values and outputs are checked
  • The values of the table can be checked if they provide the expected results. Errors can be detected if unexpected outputs are found.
  • Purpose: Used to find logical errors

Walkthrough Testing

  • Developer’s peers, managers and other testers go through the software’s code and details to find errors
  • Purpose: Identify and address issues early in the development process

White-box and Black-box Testing

White-box TestingBlack-box Testing
Examines the source code, paths, condition and logic of the programTesting based on software’s functionality without accessing the source code (Source code is termed as the ‘black-box’)
It is a structural test or internal testIt is a functional test or external test
Makes use of source code, variable values and inputs or outputsUses test data for which the results are already calculated
Programming knowledge is not required for the testersProgramming knowledge is required for the tester
Purpose: Identify hidden bugs, verify code coverage, and ensure the software performs as expected internallyPurpose: To validate the software’s functionality, usability, and how well it meets requirements and expectations

Integration Testing

  • Combining individually tested modules together and testing the interaction between them
  • Done before the software is finished (After modules are made)
  • Done by programmers and internal testers
  • Purpose: Ensure that parts of the software work together seamlessly

Alpha and Beta Testing

Alpha TestingBeta Testing
First stage of testingSecond stage of testing
Conducted by the developers and internal testers in a controlled environmentTesting done by real users in real world environment
Done near the end of developmentDone after alpha testing and before the general release of the program
Purpose: Find critical issues to address before beta testingPurpose: Uncover issues related to user experience, compatibility and bug detection not found in earlier stage

Acceptance Testing

  • Testing done by the intended user or client of the software to see if it matches with the requirements.
  • Done after software is finished
  • Purpose: To determine if the software is ready for deployment and meets the user’s expectations

Stub Testing

  • Stubs are temporary/dummy programs that simulate the behavior of a called module, providing the same output as the actual module
  • Purpose: To facilitate testing by replacing unimplemented parts of a software system

Test Data

Different types of test data may be used to check how the computer handles different scenarios. Let the eg. acceptable range be 20 to 40 inclusive

  • Normal: Data falling under acceptable range to test if the results are as expected. Eg. 20 <= any value <= 40
  • Abnormal/ Erroneous : Data that should be rejected and error should be displayed. Eg. 85, 15
  • Extreme: Largest and smallest values that normal data may take. Eg. 20, 40
  • Boundary: Used to check where the largest and smallest value occur. At each boundary, two values are checked where one is rejected and the other is not. Eg. 19, 20, 40, 41

Software Maintenance

Needed to ensure that a software application remains functional, efficient, and relevant over time. The key reasons include bug fixing, better performance, new features, adapting to changes.

Perfective

  • Improve software functionality and performance

  • Examples: Adding new features, Optimizing, Updating Ui

Adaptive

  • Make sure that software continues to work in changing environment
  • Examples: Updating software for new hardware, OS

Corrective

  • Fixing bugs and errors discovered after release