Ch 2 . Approaches to Testing Presented by :- Miss Pragati khade Dada P atil M ahavidyalaya Karjat
Introduction A strategy for software testing integrates software test case design methods into a Series of steps that result in the successful development A testing is a set of activities that can be planned in advance and Conducted systematically . A number of Software Testing approaches have been Proposed . Characteristics of Software Testing Approaches 1 To perform effectieve Testing . 2 Testing Begins at componenet level and works forward the integration of entire computer based system . 3 Different Testing Techniques are appropriate at different Points in time .
4 . Testing is conducted by the developer of the software and an independent test group . 5. Debugging though different from testing must eb included in any testing strategy . Software Testing Strategy The Software Process can be viewed as spiral .
Software Testing Steps
UNIT TESTING IT is a type of software testing where individual units or components of a software are tested. The purpose is to validate that each unit of the software code performs as expected. Unit Testing is done during the development (coding phase) of an application by the developers. Unit Tests isolate a section of code and verify its correctness. A unit may be an individual function, method, procedure, module, or object.
In SDLC, STLC, V Model, Unit testing is first level of testing done before integration testing. Unit testing is a WhiteBox testing technique that is usually performed by the developer.
Unit Testing LifeCyle :
INTEGRATION TESTING It is defined as a type of testing where software modules are integrated logically and tested as a group. A typical software project consists of multiple software modules, coded by different programmers. The purpose of this level of testing is to expose defects in the interaction between these software modules when they are integrated Integration Testing focuses on checking data communication amongst these modules. Hence it is also termed as 'I & T' (Integration and Testing), 'String Testing' and sometimes 'Thread Testing' .
Software Engineering defines variety of strategies to execute Integration testing, viz. Big Bang Approach : Incremental Approach: which is further divided into the following Top Down Approach Bottom Up Approach Sandwich Approach - Combination of Top Down and Bottom Up Approaches , Strategies , methodologies of Integration Testing
Big Bang Testing Big Bang Testing is an Integration testing approach in which all the components or modules are integrated together at once and then tested as a unit. This combined set of components is considered as an entity while testing. If all of the components in the unit are not completed, the integration process will not execute. Advantages: Convenient for small systems.
Disadvantages: Fault Localization is difficult. Given the sheer number of interfaces that need to be tested in this approach, some interfaces link to be tested could be missed easily. Since the Integration testing can commence only after "all" the modules are designed, the testing team will have less time for execution in the testing phase. Since all modules are tested at once, high-risk critical modules are not isolated and tested on priority. Peripheral modules which deal with user interfaces are also not isolated and tested on priority.
Incremental Testing In the Incremental Testing approach, testing is done by integrating two or more modules that are logically related to each other and then tested for proper functioning of the application. Then the other related modules are integrated incrementally and the process continues until all the logically related modules are integrated and tested successfully. Incremental Approach, in turn, is carried out by two different Methods: - Bottom Up -Top Down
Top-down Integration Testing Top Down Integration Testing is a method in which integration testing takes place from top to bottom following the control flow of software system. The higher level modules are tested first and then lower level modules are tested and integrated in order to check the software functionality. Stubs are used for testing if some modules are not ready.
Advantages: Fault Localization is easier. Possibility to obtain an early prototype. Critical Modules are tested on priority; major design flaws could be found and fixed first. Disadvantages: Needs many Stubs. Modules at a lower level are tested inadequately.
Bottom-up Integration Testing Bottom-up Integration Testing is a strategy in which the lower level modules are tested first. These tested modules are then further used to facilitate the testing of higher level modules. The process continues until all modules at top level are tested. Once the lower level modules are tested and integrated, then the next level of modules are formed.
Advantages: Fault localization is easier. No time is wasted waiting for all modules to be developed unlike Big-bang approach Disadvantages: Critical modules (at the top level of software architecture) which control the flow of application are tested last and may be prone to defects. An early prototype is not possible
S.No. TOP DOWN APPROACH BOTTOM UP APPROACH 1. In this approach We focus on breaking up the problem into smaller parts. In bottom up approach, we solve smaller problems and integrate it as whole and complete the solution. 2. Mainly used by structured programming language such as COBOL, Fortran, C, etc. Mainly used by object oriented programming language such as C++, C#, Python. 3. Each part is programmed separately therefore contain redundancy. Redundancy is minimized by using data encapsulation and data hiding. 4. In this the communications is less among modules. In this module must have communication.
5. It is used in debugging, module documentation, etc. It is basically used in testing. 6. In top down approach, decomposition takes place. In bottom up approach composition takes place. 7. In this top function of system might be hard to identify. In this sometimes we can not build a program from the piece we have started. 8. In this implementation details may differ. This is not natural for people to assemble.
Sandwich Testing Sandwich Testing is the combination of bottom-up approach and top-down approach, so it uses the advantage of both bottom up approach and top down approach. Initially it uses the stubs and drivers where stubs simulate the behaviour ogf missing component. It is also known as the Hybrid Integration Testing.
Strategy used in Sandwich Testing: 1.It combines both top down and bottom up strategies. 2 .Sandwich testing is basically viewed as 3 layers: ( i ) Main target layer (ii) A layer above the target layer (iii) A layer below the target layer 3 .In sandwich testing, testing is mainly focused for main target layer. This testing is selected on the basis of system characteristics and structure’s code. 4. It tries to minimize the number of hubs and drivers when there are more than 3 layers.
How to perform Sandwich Testing? There are 3 simple steps to perform sandwich testing which are given below. 1 .Test the user interface in isolation using stubs. 2. Test the very lowest level functions by using drivers. 3. When the complete system is in integrated only main target (middle) layer is remains for final test.
Advantage of Sandwich Testing: Sandwich Testing approach is used in very large projects having sub projects. It allows parallel testing. Sandwich testing is time saving approach. sandwich testing performs more coverage with same stubs. Disadvantage of Sandwich Testing: Sandwich Testing is very costly. Sandwich Testing can not be used for such systems which have a lot of interdependence between different modules. In sandwich testing the need of stubs and drivers is very high.
Software Testing Technique
White Box Testing is software testing technique in which internal structure, design and coding of software are tested to verify flow of input-output and to improve design, usability and security. In white box testing, code is visible to testers so it is also called Clear box testing, Open box testing, Transparent box testing, Code-based testing and Glass box testing. It is one of two parts of the Box Testing approach to software testing. White Box Testing
The testing can be done at system, integration and unit levels of software development. One of the basic goals of white box testing is to verify a working flow for an application.
Code optimization by finding hidden errors. White box tests cases can be easily automated. Testing is more thorough as all code paths are usually covered. Testing can start early in SDLC even if GUI is not available. Advantages of White Box Testing
White box testing can be quite complex and expensive. Developers who usually execute white box test cases detest it. The white box testing by developers is not detailed can lead to production errors. White box testing requires professional resources, with a detailed understanding of programming and implementation. White-box testing is time-consuming, bigger programming applications take the time to test fully. Disadvantages of White Box Testing
Black Box Testing Black Box Testing is a software testing method in which the functionalities of software applications are tested without having knowledge of internal code structure, implementation details and internal paths. Black Box Testing mainly focuses on input and output of software applications and it is entirely based on software requirements and specifications. It is also known as Behavioral Testing.
Advantages Disadvantages Well suited and efficient for large code segments. Limited coverage, since only a selected number of test scenarios is actually performed. Code access is not required. Inefficient testing, due to the fact that the tester only has limited knowledge about an application. Clearly separates user's perspective from the developer's perspective through visibly defined roles. Blind coverage, since the tester cannot target specific code segments or error prone areas. Large numbers of moderately skilled testers can test the application with no knowledge of implementation, programming language, or operating systems. The test cases are difficult to design.
What Is The Purpose Of Black Box Testing? Black box testing focuses on testing the complete functionality of the system as well as its behavior. This testing method is also referred to as behavioral testing and functional testing . This testing method is critical during the stages of software testing life cycle like regression testing, acceptance, unit, system, integration and software development. The techniques of Black box testing are beneficial for the end users who wish to perform software verification.
Techniques of Black Box Testing . BVA or Boundary Value Analysis : It is one among the useful and critical Black box testing technique that helps in equivalence partitioning. BVA helps in testing any software having a boundary or extreme values
Advantages of Boundary Value Analysis It is easier and faster to find defects using this technique. This is because the density of defects at boundaries is more. Instead of testing will all set of test data, we only pick the one at the boundaries. So, the overall test execution time reduces. Disadvantages of boundary value analysis The success of the testing using this technique depends on the equivalence classes identified, which further depends on the expertise of the tester and his knowledge of the application. Hence, incorrect identification of equivalence classes leads to incorrect boundary value testing. Applications with open boundaries or applications not having one-dimensional boundaries are not suitable for this technique. In those cases, other black-box techniques like “Domain Analysis” are used.
This technique is capable of identifying the flaws of the limits of the input values rather than focusing on the range of input value. Boundary Value Analysis also deals with edge or extreme output values. Graph-Based Testing:
This technique of Black box testing involves a graph drawing that depicts the link between the causes (inputs) and the effects (output), which trigger the effects. This testing utilizes different combinations of output and inputs. It is a helpful technique to understand the software’s functional performance, as it visualizes the flow of inputs and outputs in a lively fashion. Error Guessing Technique: This testing technique is capable of guessing the erroneous output and inputs to help the tester fix it easily. It is solely based on judgment and perception of the earlier end user experience.
Equivalence Class Partitioning :
This technique of Black box testing is widely used to write test cases. It can be useful in reducing a broad set of possible inputs to smaller but effective ones. It is performed through the division of inputs as classes, and each class is given a value. It is applied when the need for exhaustive testing arises and for resisting the redundancy of inputs.
Advantages disadvantages It is process-oriented All necessary inputs may not cover. We can achieve the Minimum test coverage This technique will not consider the condition for boundary value analysis. It helps to decrease the general test execution time and also reduce the set of test data. The test engineer might assume that the output for all data set is right, which leads to the problem during the testing process.
Grey-Box Testing Grey-box testing is a technique to test the application with having a limited knowledge of the internal workings of an application. Grey Box Testing or Gray box testing is a software testing technique to test a software product or application with partial knowledge of internal structure of the application. The purpose of grey box testing is to search and identify the defects due to improper code structure or improper use of applications. Gray Box Testing is a software testing method, which is a combination of both White Box Testing and Black Box Testing method.
Objective of Gray Box Testing: 1. The objective of Gray Box Testing is. To provide combined advantages of both black box testing and white box testing. To combine the input of developers as well as testers. To improve overall product quality. To reduce the overhead of long process of functional and non-functional testings . To provide enough free time to developers to fix defects. To test from the user point of view rather than a designer point of view.
Types of Grey Box Testing 1. Matrix Testing: In matrix testing technique, business and technical risks which are defined by the developers in software programs are examined. Developers define all the variables that exist in the program. Each of the variables has an inherent technical and business risk and can be used with varied frequencies during its life cycle. 2. Pattern Testing: To perform the testing, previous defects are analyzed. It determines the cause of the failure by looking into the code. Analysis template includes reasons for the defect. This helps test cases designed as they are proactive in finding other failures before hitting production.
3. Orthogonal Array Testing: It is mainly a black box testing technique. In orthogonal array testing, test data have n numbers of permutations and combinations. Orthogonal array testing is preferred when maximum coverage is required when there are very few test cases and test data is large. This is very helpful in testing complex applications. 4. Regression Testing: Regression testing is testing the software after every change in the software to make sure that the changes or the new functionalities are not affecting the existing functioning of the system. Regression testing is also carried out to ensure that fixing any defect has not affected other functionality of the software.
Advantages of Gray Box Testing: Users and developers have clear goals while doing testing. Gray box testing is mostly done by the user perspective. 2. Testers are not required to have high programming skills for this testing. 3. Gray box testing is non- intrusive.Overall quality of the product is improved. 4. In gray box testing, developers have more time for defect fixing. 5 . By doing gray box testing, benefits of both black box and white box testing is obtained. 6. Gray box testing is unbiased. It avoids conflicts between a tester and a developer. 7. Gray box testing is much more effective in integration testing.
Disadvantages of gray box testing: Defect association is difficult when gray testing is performed for distributed systems. Limited access to internal structure leads to limited access for code path traversal. Because source code cannot be accessed, doing complete white box testing is not possible. Gray box testing is not suitable for algorithm testing. Most of the test cases are difficult to design.