SlideShare a Scribd company logo
1 of 3
Download to read offline
How to calculate Statement, Branch/Decision
and Path Coverage for ISTQB Exam purpose
Statement Coverage:
      In this the test case is executed in such a way that every statement of the code is
      executed at least once.

Branch/Decision Coverage:
      Test coverage criteria requires enough test cases such that each condition in a decision
      takes on all possible outcomes at least once, and each point of entry to a program or
      subroutine is invoked at least once. That is, every branch (decision) taken each way,
      true and false. It helps in validating all the branches in the code making sure that no
      branch leads to abnormal behavior of the application.

Path Coverage:
      In this the test case is executed in such a way that every path is executed at least once.
      All possible control paths taken, including all loop paths taken zero, once, and multiple
      (ideally, maximum) items in path coverage technique, the test cases are prepared based
      on the logical complexity measure of a procedural design. In this type of testing every
      statement in the program is guaranteed to be executed at least one time. Flow Graph,
      Cyclomatic Complexity and Graph Metrics are used to arrive at basis path


How to calculate Statement Coverage, Branch Coverage and Path Coverage?

Draw the flow in the following way-
    Nodes represent entries, exits, decisions and each statement of code.
    Edges represent non-branching and branching links between nodes.


Example:
       Read P
       Read Q
       IF P+Q > 100 THEN
       Print “Large”
       ENDIF
       If P > 50 THEN
       Print “P Large”
       ENDIF

Calculate statement coverage, branch coverage and path coverage.




      1 www.ajoysinigha.info
Solution:
The flow chart is-




Statement Coverage (SC):
        To calculate Statement Coverage, find out the shortest number of paths following
which all the nodes will be covered. Here by traversing through path 1A-2C-3D-E-4G-5H all
the nodes are covered. So by traveling through only one path all the nodes 12345 are covered,
so the Statement coverage in this case is 1.

Branch Coverage (BC):
        To calculate Branch Coverage, find out the minimum number of paths which will
ensure covering of all the edges. In this case there is no single path which will ensure coverage
of all the edges at one go. By following paths 1A-2C-3D-E-4G-5H, maximum numbers of
edges (A, C, D, E, G and H) are covered but edges B and F are left. To covers these edges we

      2 www.ajoysinigha.info
can follow 1A-2B-E-4F. By the combining the above two paths we can ensure of traveling
through all the paths. Hence Branch Coverage is 2. The aim is to cover all possible true/false
decisions.

Path Coverage (PC):
        Path Coverage ensures covering of all the paths from start to end.
All possible paths are-
        1A-2B-E-4F
        1A-2B-E-4G-5H
        1A-2C-3D-E-4G-5H
        1A-2C-3D-E-4F

So path coverage is 4.

Thus for the above example SC=1, BC=2 and PC=4.



Memorize these….

        100% LCSAJ coverage will imply 100% Branch/Decision coverage

        100% Path coverage will imply 100% Statement coverage

        100% Branch/Decision coverage will imply 100% Statement coverage

        100% Path coverage will imply 100% Branch/Decision coverage

        Branch coverage and Decision coverage are same.

*LCSAJ = Linear Code Sequence and Jump.


For similar useful information on tips and guides for ISTQB Exam please visit -
http://ajoysingha.info/istqb.aspx




      3 www.ajoysinigha.info

More Related Content

Viewers also liked

Viewers also liked (7)

Ace eden npm 2012
Ace eden npm 2012Ace eden npm 2012
Ace eden npm 2012
 
Un gustico de los hombres
Un gustico de los hombresUn gustico de los hombres
Un gustico de los hombres
 
Emily blanco a color
Emily blanco a colorEmily blanco a color
Emily blanco a color
 
forrest gump
 forrest gump forrest gump
forrest gump
 
Frech guiana
Frech guianaFrech guiana
Frech guiana
 
indian festival by rahul singhania
indian festival by rahul singhaniaindian festival by rahul singhania
indian festival by rahul singhania
 
Joan sebastian
Joan sebastianJoan sebastian
Joan sebastian
 

More from Van Pham

Thi cong da hoa cuong o tphcm thien loc phat
Thi cong da hoa cuong o tphcm thien loc phatThi cong da hoa cuong o tphcm thien loc phat
Thi cong da hoa cuong o tphcm thien loc phat
Van Pham
 
Cửa hàng bán đồ chơi xe máy ở TPHCM - Hoàng Phúc Decal
Cửa hàng bán đồ chơi xe máy ở TPHCM - Hoàng Phúc DecalCửa hàng bán đồ chơi xe máy ở TPHCM - Hoàng Phúc Decal
Cửa hàng bán đồ chơi xe máy ở TPHCM - Hoàng Phúc Decal
Van Pham
 
Avl tree
Avl treeAvl tree
Avl tree
Van Pham
 
Bai 02 active directory
Bai 02   active directoryBai 02   active directory
Bai 02 active directory
Van Pham
 
Gioi thieu va cac lenh tren console
Gioi thieu va cac lenh tren consoleGioi thieu va cac lenh tren console
Gioi thieu va cac lenh tren console
Van Pham
 
Bai 08 quan ly in an
Bai 08   quan ly in anBai 08   quan ly in an
Bai 08 quan ly in an
Van Pham
 
Bai 07 tao quan ly thu muc
Bai 07   tao quan ly thu mucBai 07   tao quan ly thu muc
Bai 07 tao quan ly thu muc
Van Pham
 
Bai 06 quan ly dia
Bai 06   quan ly diaBai 06   quan ly dia
Bai 06 quan ly dia
Van Pham
 
Bai 04 chinh sach he thong
Bai 04   chinh sach he thongBai 04   chinh sach he thong
Bai 04 chinh sach he thong
Van Pham
 
Bai 03 quan ly tai khoan nguoi dung
Bai 03   quan ly tai khoan nguoi dungBai 03   quan ly tai khoan nguoi dung
Bai 03 quan ly tai khoan nguoi dung
Van Pham
 
Bai 01 gioi thieu cai dat
Bai 01   gioi thieu cai datBai 01   gioi thieu cai dat
Bai 01 gioi thieu cai dat
Van Pham
 
Bai12 too ls-kiemtra-ktrpm@softtesting-nntu
Bai12 too ls-kiemtra-ktrpm@softtesting-nntuBai12 too ls-kiemtra-ktrpm@softtesting-nntu
Bai12 too ls-kiemtra-ktrpm@softtesting-nntu
Van Pham
 
Bai11 quan ly-kiemtra-ktrpm@softtesting-nntu
Bai11 quan ly-kiemtra-ktrpm@softtesting-nntuBai11 quan ly-kiemtra-ktrpm@softtesting-nntu
Bai11 quan ly-kiemtra-ktrpm@softtesting-nntu
Van Pham
 
Bai10 lap tailieukiemtra-k-trpm@softtesting-nntu
Bai10 lap tailieukiemtra-k-trpm@softtesting-nntuBai10 lap tailieukiemtra-k-trpm@softtesting-nntu
Bai10 lap tailieukiemtra-k-trpm@softtesting-nntu
Van Pham
 

More from Van Pham (20)

Thi cong da hoa cuong o tphcm thien loc phat
Thi cong da hoa cuong o tphcm thien loc phatThi cong da hoa cuong o tphcm thien loc phat
Thi cong da hoa cuong o tphcm thien loc phat
 
Cửa hàng bán đồ chơi xe máy ở TPHCM - Hoàng Phúc Decal
Cửa hàng bán đồ chơi xe máy ở TPHCM - Hoàng Phúc DecalCửa hàng bán đồ chơi xe máy ở TPHCM - Hoàng Phúc Decal
Cửa hàng bán đồ chơi xe máy ở TPHCM - Hoàng Phúc Decal
 
Giao trinh co so du lieu can ban
Giao trinh co so du lieu can banGiao trinh co so du lieu can ban
Giao trinh co so du lieu can ban
 
Avl tree
Avl treeAvl tree
Avl tree
 
Quy tắc
Quy tắcQuy tắc
Quy tắc
 
Lect15 cloud
Lect15 cloudLect15 cloud
Lect15 cloud
 
Session1
Session1Session1
Session1
 
172506 633746925739945000
172506 633746925739945000172506 633746925739945000
172506 633746925739945000
 
Bao cao thuc tap - Điện toán đám mây
Bao cao thuc tap - Điện toán đám mâyBao cao thuc tap - Điện toán đám mây
Bao cao thuc tap - Điện toán đám mây
 
Bai 02 active directory
Bai 02   active directoryBai 02   active directory
Bai 02 active directory
 
Gioi thieu va cac lenh tren console
Gioi thieu va cac lenh tren consoleGioi thieu va cac lenh tren console
Gioi thieu va cac lenh tren console
 
Bai 08 quan ly in an
Bai 08   quan ly in anBai 08   quan ly in an
Bai 08 quan ly in an
 
Bai 07 tao quan ly thu muc
Bai 07   tao quan ly thu mucBai 07   tao quan ly thu muc
Bai 07 tao quan ly thu muc
 
Bai 06 quan ly dia
Bai 06   quan ly diaBai 06   quan ly dia
Bai 06 quan ly dia
 
Bai 04 chinh sach he thong
Bai 04   chinh sach he thongBai 04   chinh sach he thong
Bai 04 chinh sach he thong
 
Bai 03 quan ly tai khoan nguoi dung
Bai 03   quan ly tai khoan nguoi dungBai 03   quan ly tai khoan nguoi dung
Bai 03 quan ly tai khoan nguoi dung
 
Bai 01 gioi thieu cai dat
Bai 01   gioi thieu cai datBai 01   gioi thieu cai dat
Bai 01 gioi thieu cai dat
 
Bai12 too ls-kiemtra-ktrpm@softtesting-nntu
Bai12 too ls-kiemtra-ktrpm@softtesting-nntuBai12 too ls-kiemtra-ktrpm@softtesting-nntu
Bai12 too ls-kiemtra-ktrpm@softtesting-nntu
 
Bai11 quan ly-kiemtra-ktrpm@softtesting-nntu
Bai11 quan ly-kiemtra-ktrpm@softtesting-nntuBai11 quan ly-kiemtra-ktrpm@softtesting-nntu
Bai11 quan ly-kiemtra-ktrpm@softtesting-nntu
 
Bai10 lap tailieukiemtra-k-trpm@softtesting-nntu
Bai10 lap tailieukiemtra-k-trpm@softtesting-nntuBai10 lap tailieukiemtra-k-trpm@softtesting-nntu
Bai10 lap tailieukiemtra-k-trpm@softtesting-nntu
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 

bao phủ trong kiểm thử phần mềm

  • 1. How to calculate Statement, Branch/Decision and Path Coverage for ISTQB Exam purpose Statement Coverage: In this the test case is executed in such a way that every statement of the code is executed at least once. Branch/Decision Coverage: Test coverage criteria requires enough test cases such that each condition in a decision takes on all possible outcomes at least once, and each point of entry to a program or subroutine is invoked at least once. That is, every branch (decision) taken each way, true and false. It helps in validating all the branches in the code making sure that no branch leads to abnormal behavior of the application. Path Coverage: In this the test case is executed in such a way that every path is executed at least once. All possible control paths taken, including all loop paths taken zero, once, and multiple (ideally, maximum) items in path coverage technique, the test cases are prepared based on the logical complexity measure of a procedural design. In this type of testing every statement in the program is guaranteed to be executed at least one time. Flow Graph, Cyclomatic Complexity and Graph Metrics are used to arrive at basis path How to calculate Statement Coverage, Branch Coverage and Path Coverage? Draw the flow in the following way-  Nodes represent entries, exits, decisions and each statement of code.  Edges represent non-branching and branching links between nodes. Example: Read P Read Q IF P+Q > 100 THEN Print “Large” ENDIF If P > 50 THEN Print “P Large” ENDIF Calculate statement coverage, branch coverage and path coverage. 1 www.ajoysinigha.info
  • 2. Solution: The flow chart is- Statement Coverage (SC): To calculate Statement Coverage, find out the shortest number of paths following which all the nodes will be covered. Here by traversing through path 1A-2C-3D-E-4G-5H all the nodes are covered. So by traveling through only one path all the nodes 12345 are covered, so the Statement coverage in this case is 1. Branch Coverage (BC): To calculate Branch Coverage, find out the minimum number of paths which will ensure covering of all the edges. In this case there is no single path which will ensure coverage of all the edges at one go. By following paths 1A-2C-3D-E-4G-5H, maximum numbers of edges (A, C, D, E, G and H) are covered but edges B and F are left. To covers these edges we 2 www.ajoysinigha.info
  • 3. can follow 1A-2B-E-4F. By the combining the above two paths we can ensure of traveling through all the paths. Hence Branch Coverage is 2. The aim is to cover all possible true/false decisions. Path Coverage (PC): Path Coverage ensures covering of all the paths from start to end. All possible paths are- 1A-2B-E-4F 1A-2B-E-4G-5H 1A-2C-3D-E-4G-5H 1A-2C-3D-E-4F So path coverage is 4. Thus for the above example SC=1, BC=2 and PC=4. Memorize these…. 100% LCSAJ coverage will imply 100% Branch/Decision coverage 100% Path coverage will imply 100% Statement coverage 100% Branch/Decision coverage will imply 100% Statement coverage 100% Path coverage will imply 100% Branch/Decision coverage Branch coverage and Decision coverage are same. *LCSAJ = Linear Code Sequence and Jump. For similar useful information on tips and guides for ISTQB Exam please visit - http://ajoysingha.info/istqb.aspx 3 www.ajoysinigha.info