Learning Unit 2-2 Types of Software Testing
Learning Unit 2-2 Types of Software Testing
• Unit Testing
• Integration Testing
• System Testing
• Smoke & Sanity Testing
• Acceptance Testing
• Regression Testing
• Testing in DevOps
Unit Testing
Unit Testing
• Objective of unit testing is to isolate a section of code and verify its
correctness.
• Goal of unit testing is to isolate each part of the program and show that the
individual parts are correct.
• Skimping on unit testing leads to higher defect fixing costs during system testing
or integration testing.
• Proper unit testing done during the development stage saves both time and
money in the end. It can be automated or performed manually.
• Relies on mock objects – stubs and drivers - being created to test sections of
code that are not yet part of a complete application.
• stubs and drivers do not implement the entire programming logic of the software
module but just simulate data communication with the calling module.
Automated Unit Testing
• A developer could write another section of code in the application just to test
the function - then later comment out and finally remove the test code when
the application is done.
• They could also isolate the function to test it more rigorously by copying and
pasting the function to its own testing environment e.g., a Unit Test
Framework
• During the execution of the test cases, the framework logs those that fail any
criterion.
• Many frameworks will also automatically flag and report a summary of these
failed test cases.
• Programmers think that integration testing will catch all errors and not a unit
test.
• Once units are integrated, very simple errors which could have been very easily
found and fixed in the unit tested take a very long time to be traced and fixed.
Unit Testing Cont…
Benefits of Unit Testing
• the procedure is to write test cases for all functions and methods so that
whenever a change causes a fault, it can be quickly identified and fixed.
• due to the modular nature of the unit testing, we can test parts of the project
without waiting for others to be completed.
• Unit testing can't be expected to catch every error in a program unit testing
by its very nature focuses on a unit of code - can't catch integration errors or
broad system level errors.
• It's recommended unit testing be used in conjunction with other testing
activities.
Unit Testing Cont…
• follow clear and consistent naming conventions for your unit tests in case of
change in code in any module, ensure there is a corresponding unit test case
for the module and the module passes the tests bugs identified during unit
testing must be fixed before proceeding to the next phase in SDLC.
• adopt a "test as your code" approach - the more code you write without testing
the more paths you have to check for errors.
Integration Testing
Integration Testing
• individual software modules are integrated logically and tested as a group.
Although each software module is unit tested, defects still exist for various
reasons like :
integration testing becomes necessary to verify the software modules work in unity
at the time of module development, there are wide chances of change in
requirements by the clients - these new requirements may not be unit tested, and
hence integration testing becomes necessary.
priority is given for the integrating links rather than the unit functions which are
already tested.
For example: application has 3 modules: 'Login Page', 'Mailbox' and 'Delete
mails' and each of them are integrated logically.
Integration Testing Cont…
Advantages
Disadvantages
▪ testing is done by joining two or more modules that are logically related.
▪ the process uses stubs and drivers.
i. Bottom-up Integration:
▪ Each module at lower levels is tested with higher modules until all modules
are tested.
▪ Uses drivers for testing
Integration Testing Cont…
Bottom-up Integration cont..
Advantages:
Disadvantages:
▪ critical modules (at the top level of software architecture) which control the
flow of applications are tested last and may be prone to defects.
▪ An early prototype is not possible
Integration Testing Cont…
ii. Top down Integration:
- testing takes place from top to down following the control flow of the
software system.
- uses stubs for testing
Advantages:
Disadvantages:
Entry Criteria
Exit Criteria
• First determine the integration test strategy that could be adopted and later
prepare the test cases and test data accordingly.
• Study the architecture design of the application and identify the critical
modules - these need to be tested on priority.
• Obtain the interface designs from the architectural team and create test
cases to verify all of the interfaces in detail. Interface to database/external
hardware/software application must be tested in detail.
• After the test cases, it's the test data that plays a critical role.
• Always have the mock data prepared, prior to executing - do not select test
data while executing the test cases.
System Testing
System testing
• A series of different tests whose sole purpose is to exercise the full computer-
based system.
• Need to build detailed test cases and test suites that test each aspect of the
application as seen from the outside without looking at the actual source code.
• Involves the external workings of the software from the user's perspective.
System testing Cont…
• verify thorough testing of every input in the application to check for desired
outputs.
Unit testing
Integration testing
testing done before, during and after integration of a new module into the
main software package.
involves testing of each individual code module.
System testing
Acceptance testing
Usability Testing
mainly focuses on the user's ease to use the application, flexibility in
handling controls and ability of the system to meet its objectives
Load Testing
necessary to know that a software solution will perform under real life
loads.
Regression Testing
involves testing done to make sure none of the changes made over the
course of the development process have caused new bugs.
also makes sure no old bugs appear from the addition of new software
modules over time.
Recovery Testing
done to demonstrate a software solution is reliable, trustworthy and can
successfully recoup from possible crashes.
System testing Cont…
Migration Testing
done to ensure that the software can be moved from older system
infrastructures to current system infrastructures without any issues.
Functional Testing
also known as functional completeness testing, functional testing involves
trying to think of any possible missing functions.
Hardware/Software Testing
IBM refers to Hardware/Software testing as "HW/SW Testing".
Smoke Testing:
• objective is not to perform exhaustive testing, but to verify that the critical
functionalities of the system are working fine.
• purpose is to reject a badly broken application so that the QA team does not
waste time installing and testing the software application.
Smoke and Sanity Testing cont…
For Example:
Sanity Testing:
• Both sanity tests and smoke tests are ways to avoid wasting time and effort
by quickly determining whether an application is too flawed to merit any
rigorous testing.
• One of the best industry practices is to conduct a daily build and smoke test in
software projects.
• Both smoke and sanity tests can be executed manually or using an automation
tool. When automated tools are used, the tests are often initiated by the same
process that generates the build itself.
• As per the needs of testing, you may have to execute both Sanity and Smoke
Tests on the software build. In such cases, you will first execute Smoke tests
and then go ahead with Sanity Testing.
Acceptance Testing
Acceptance Testing
• All units in the system are combined into the final program/application
• Ensure that the system works how the user expects, i.e., it meets the user
specifications for functionality.
• Is nothing but a full or partial selection of already executed test cases that
are re-executed to ensure existing functionalities work fine.
• this testing is done to make sure that new code changes should not have
side effects on the existing functionalities.
• ensures that old code still works once the new code changes are done
• all the tests in the existing test bucket or suite should be re-executed.
• very expensive as it requires a lot of time and resources.
• instead of re-executing the entire test suite, it is better to select part of a test
suite to be run
• test cases selected can be categorized as:
-Reusable Test Cases - can be used in succeeding regression cycles.
-Obsolete Test Cases - can't be used in succeeding cycles
• prioritize the test cases depending on business impact, critical & frequently
used functionalities.
• selection of test cases based on priority will greatly reduce the regression
test suite.
Regression Testing Cont..
Difference between Re-testing and Regression Testing
• Retesting means testing the functionality or bug again to ensure the code is
fixed. If it is not fixed, the defect needs to be reopened. If fixed, the defect is
closed.
• With successive regression runs, test suites become fairly large - due to time
and budget constraints, the entire regression test suite cannot be executed
• Minimizing the test suite while achieving maximum test coverage remains a
challenge
• Determination of the frequency of Regression Tests, i.e., after every
modification or every build update or after a bunch of bug fixes, is a
challenge.
DevOps
DevOps is a CULTURAL and
OPERATIONAL model that
fosters COLLABORATION to
ENABLE high-performance IT to
ACHIEVE business goals
Test harness: a system of test drivers and other tools that support test
execution
Oracle: means to check the output from a program is correct for the given input