SlideShare une entreprise Scribd logo
1  sur  3
Télécharger pour lire hors ligne
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

Contenu connexe

En vedette

En vedette (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
 

Plus de 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
 

Plus de 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
 

Dernier

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
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
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
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
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
 

Dernier (20)

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
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
 
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
 
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
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
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
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
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
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 

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