EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 600+ Courses All in One Bundle
  • Login

Branch Coverage

By Priya PedamkarPriya Pedamkar

Secondary Sidebar
Software Testing Tutorial
  • Advance
    • Cyclomatic Complexity
    • Decision Table Testing
    • Decision Tree Algorithm
    • What is Continuous Integration
    • Mantis Bug Tracker
    • Equivalence Partitioning
    • Gantt Chart Software
    • Acceptance Testing Types
    • Load testing tools
    • Install TestNG
    • Install Unity
    • Defect Management Process
    • Test Plan Template
    • Testing Interview Questions
    • Testing of Mobile application
    • What is Test Automation Frameworks
    • Test Automation Framework
    • Application of Automation
    • Test Automation Process
    • Automation Testing Roles and Responsibilities
    • What is Instruction Cycle?
    • What is Cucumber?
    • 15 Best Popular Bug Reporting Tools
    • What is Automated Testing?
    • Software Maintenance Types
    • Types of Penetration Testing
    • Software Reliability
    • Best Gantt Chart Software
    • Code Coverage
    • Branch Coverage
    • Decision Coverage
    • Statement Coverage
    • What is Test Case
    • Types of Test Case
    • What is Test Scenario
    • Formal Review
    • Alpha Beta Pruning
    • What is Cyclomatic Complexity?
    • Test Coverage
    • How to Write Test Case
    • Testing Documentation
    • Performance Testing Life Cycle
    • Test Harness
    • Test Strategy
    • Software Incident Management
    • What is Debugging
    • What is Defect?
    • Listeners in TestNG
  • Basics
    • What is Software Testing
    • Careers in Software Testing
    • Defect Life Cycle in Software Testing
    • Bug Life Cycle
    • Levels of Software Testing
    • Software Testing Life Cycle
    • Software Tester Work
    • Software Testing Principles
    • Software Testing Services
    • Testing Methodologies
    • Test Approaches
    • Grey Box Testing
    • Types of Software Testing
    • What is a Bug in Software Testing
    • Benefits of Automation Testing
    • What is Automation Testing?
    • Types of Automation
    • Typical Journey of a Software Tester
    • Automation Testing Process
    • Mobile Automation Testing
    • Automation Testing Life Cycle
    • Software Quality Assurance
    • Software Quality Assurance
    • What is Test Environment?
    • Verification and Validation Testing
  • Types of Testing
    • Adhoc Testing
    • Types of System Testing
    • Manual Testing Types
    • Unit Testing Types
    • Unit Testing Benefits
    • Agile Testing
    • What is Agile Testing
    • Acceptance Testing
    • Stress Testing Types
    • Alpha and Beta Testing
    • Application Testing
    • Automation Testing
    • Automation Testing Advantages
    • Benchmark Testing
    • Black Box Testing
    • Domain Testing
    • Dynamic Testing
    • Ecommerce Testing
    • Fuzz Testing
    • Gray Box Testing
    • GUI Testing
    • Installation Testing
    • Interface Testing
    • Interoperability Testing
    • Mainframe Testing
    • Manual Testing
    • Mutation Testing
    • Monkey Testing
    • Negative Testing
    • Penetration Testing
    • Penetration testing phases
    • Penetration testing framework
    • Protocol Testing
    • Recovery Testing
    • Regression Testing
    • Mobile Penetration Testing
    • Accessibility Testing
    • Sanity Testing
    • Scalability Testing
    • Security Testing
    • Spike Testing
    • Stability Testing
    • State Transition Testing
    • Static Testing
    • Gatling Load Testing
    • System Integration Testing
    • Structural Testing
    • Locust Load Testing
    • System Testing
    • Control Flow Testing
    • Unit Testing
    • Cypress testing
    • Volume Testing
    • Web Testing Application
    • What is Exploratory Testing
    • What is Stress Testing
    • What is Usability Testing
    • White Box Testing
    • Types of White Box Testing
    • Compatibility Testing?
    • Use Case Testing
    • Beta Testing
    • Integration Testing
    • Non Functional Testing
    • Non Functional Testing Types
    • What is Functional Testing
    • Functional testing types
    • Cookie Testing
    • Alpha Testing
    • Boundary Value Testing
    • Equivalence Class Testing
    • Glass Box Testing
    • SOA Testing
    • Smoke Testing
    • Visual Testing
    • Visual Paradigm
    • Model-Based Testing
  • Testing techniques
    • Software Testing Methodologies
    • Black Box Testing Techniques
    • Static Testing Techniques
    • Test Case Design Techniques
    • What is Static Analysis
  • Testing tools
    • Manual Testing Tools
    • Visual Testing Tools
    • Automation Testing Tools
    • Functional Testing Tools
    • GUI Testing Tools
    • Penetration Testing Tools
    • Performance Testing Tools
    • SOA Testing Tools
    • Accessibility Testing Tools
    • What is QTP
    • Regression Testing Tools
    • Security Testing Tools
    • Test Management Tools
    • Defect Management Tools
    • Code Coverage Tools
    • Test Coverage Tools
    • Defect Tracking Tools
    • Continuous Integration Tools
    • Install Bugzilla
    • Test data generation tool
    • Unit Testing Tools
    • Web Testing Tools
    • Stress Testing Tools
    • Performance Monitoring Tools
    • Mobile Testing Tools
    • Responsive Testing Tool
    • Cross Browser Testing Tools
    • Risk Based Testing
    • Database Testing Tools
    • WinRunner
    • What is Squish?
    • CubicTest
    • What is WinRM?
    • Bugzilla Tool
    • Code review tools
    • Penetration Testing Open Source Tools
  • Inteview Questions
    • Automation Testing Interview Questions
    • Manual Testing Interview Questions
    • ISTQB Interview Questions
    • Cucumber Interview Questions
    • Software Testing Interview Questions
    • Penetration Testing Interview Questions

Related Courses

Software Testing Course

Penetration Training Course

TestNG Training Course

Home Software Development Software Development Tutorials Software Testing Tutorial Branch Coverage

Branch Coverage

Introduction to Branch Coverage

Branch Coverage is a well-known testing technique that is designed for identifying every possible and logical branch in the functional flow of the software application and defining the possible results from each resolution. The process goes on by executing every branch at least once, where the term ‘branch’ can be defined as a point that gives two possible results and the term ‘coverage’ can be defined as to what extent the branch execution is accessible. It can otherwise be explained as a necessity for validating the program’s ability to reach every nook and corner, in order to make certain that the functionality provided by the client is fulfilled.

All in One Software Development Bundle(600+ Courses, 50+ projects)
Python TutorialC SharpJavaJavaScript
C Plus PlusSoftware TestingSQLKali Linux
Price
View Courses
600+ Online Courses | 50+ projects | 3000+ Hours | Verifiable Certificates | Lifetime Access
4.6 (86,130 ratings)

How Branch Coverage Testing is Performed?

  • Branch Coverage Testing is performed on each and every part of the code, where branching occurs. For instance, the conditional statements and the loop statements in the program, which gives more than one possible result when executed. Hence the identification of branches is the first step in the implementation of Branch Coverage Testing.
  • The next step is to make a list of the results or outcomes of each branch in the code. A branch can possibly have two or three outcomes when the branch is found to be an ‘if’ conditional, and more than that if the branch if found to be a ‘switch case’ conditional statement. And so, it is essential to not miss any potential branch or the branch’s result in this process.
  • As a part of Branch Coverage Testing, the final step is to validate the test execution on all the branches and fetch the results. These results should match the ‘expected results’ column in the test script documentation that was created for the Branch Coverage Testing process. If there is any discrepancy found, it simply means that functionality is defected and needs to be recoded to match the requirement created by the client or the Business Analyst.
  • This course of quality assurance is a vital part of the code validation, as these test cases not only cover the happy path it also covers the negative functional flow of the software application. Otherwise, the system will not know how to respond during the unexpected negative functionality. For example, in a login page of an application, the user will enter the login id and respective password. In cases like an incorrect or blank username along with a password, the application needs to tell the user what went wrong and ask them to correct the error that they made. Hence the code needs to include the conditional statement for such failure scenarios. Branch Coverage testing is an important activity to ensure these gaps are satisfied appropriately.

How to Calculate Branch Coverage?

In order to locate the branching in the program, the control flow should be pinpointed and all the flow with more than one path needs to be identified. The purpose of this type of coverage testing is to verify every decision tree in the program is faultless and is validated at least once before executing the software application in real-time.

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

Example

Let us consider the below example for the execution of the Branch Coverage Testing process.

Branch Coverage image

In this example, the login page validation has three possible outcomes. When the login credentials are validated for the correctness, there rise three possible functional flows. If the User fails to enter a valid username, then the first conditional loop will be executed, if the user fails to enter a valid password, the second flow will be executed and if both the credential fields are not passed with any values, the third condition will be carried out.

As these are the failure scenarios, the loop goes on execution again and again, until the success path is reached. In terms of a sample Pseudocode, the above can be achieved by the below snippet,

Code:

READ Username
READ Password
IF Count (Username) < 8
PRINT “Enter a Valid Username”
ENDIF
IF Count (Password) < 5
PRINT “Enter a Valid Password”
ENDIF
IF Count(Username & Password) < 1
PRINT “Please Fill the Username & Password Fields”
ENDIF
ELSE
PRINT “Login Successfully”

The below formula can be used for the same,

Branch Coverage (%) = (Number of Functional Flow Implemented & Tested)/ (Total Number of Success & Fail Conditional Flow) * 100

Here,

Branch Coverage (%) = 3/3 * 100, which results in 100% coverage.

Explanation: The main purpose of the Branch Coverage Testing is to make sure every functional test scenario has the ability to cover all the potential branching for functional looping statements. The calculation of this coverage is based on two values, namely, the total number of conditional loops defined in the module as a part of the functional requirement and the number of conditional statements that are provisioned to execute in the software application.

Advantages and Disadvantages of Branch Coverage Testing

Below are some of the advantages as a part of the test execution process,

  1. This testing aids in keeping a check on the possible branches in the program
  2. It is used to make sure that all the branches in the code are directed to the essential functional requirements mentioned in the application requirement specification provided by the client or the business stakeholders.
  3. Lets the testing professionals assign the unassigned test cases, which were missed in other testing techniques in the software testing process.

Below are some of the disadvantages of executing on an application,

  1. This testing method is applicable only to operations other than the Boolean operations, for which the outcome will either be true or false.
  2. It is not a competent method, in comparison to other coverage testing methods such as statement coverage and code coverage.

Conclusion

Branch Coverage process is an indispensable test coverage technique that allows the programmer and the tester to get better visibility on what is expected and what is achieved so far. It gives a clear view of the progress made in software application development. It is also called as ‘Decision Coverage’ method, as it involves the decision statements of the code.

Recommended Articles

This is a guide to Branch Coverage. Here we discuss an introduction to Branch Coverage along with how calculate and perform execution in detail explanation with advantages and disadvantages. You can also go through our other related articles to learn more –

  1. Web Services Testing
  2. Code Coverage Tools
  3. Code Coverage
  4. Glass Box Testing
Popular Course in this category
Software Testing Training (11 Courses, 2 Projects)
  11 Online Courses |  2 Hands-on Projects |  65+ Hours |  Verifiable Certificate of Completion
4.5
Price

View Course

Related Courses

Penetration Testing Training Program (2 Courses)4.9
TestNG Training (4 Courses, 2 Project)4.8
0 Shares
Share
Tweet
Share
Primary Sidebar
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Java Tutorials
  • Python Tutorials
  • All Tutorials
Certification Courses
  • All Courses
  • Software Development Course - All in One Bundle
  • Become a Python Developer
  • Java Course
  • Become a Selenium Automation Tester
  • Become an IoT Developer
  • ASP.NET Course
  • VB.NET Course
  • PHP Course

ISO 10004:2018 & ISO 9001:2015 Certified

© 2022 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA
Free Software Development Course

C# Programming, Conditional Constructs, Loops, Arrays, OOPS Concept

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA
Free Software Development Course

Web development, programming languages, Software testing & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

Special Offer - Software Testing Training (9 Courses, 2 Projects) Learn More