TALKS AND WEBINARS

THE POWER OF PERSONAL BRANDING!

Webinar - Heuristics and Mnemonics in Software Testing

WATIDEAS TO IMPROVE YOUR TESTING OPERATIONS AND EFFICIENCY

COVID-19, WFH,TESTING

LATEST THINKING

Monday, August 8, 2016

ISTQB: Easiest way to solve statement and branch coverage problems.

12:17:00 AM Posted by Prashant Hegde 59 comments
Several ISTQB aspirants face issues in answering the statement and branch coverage questions. These questions are really important to clear ISTQB certification.I got emails from several aspirants where they have asked me doubts on statements and branch coverage. So I decided to write this post.

Before learning how to solve these problem one needs to know the basics of  drawing flow chart.
Flowcharts use special shapes to represent different types of actions or steps in a process. Lines and arrows show the sequence of the steps, and the relationships among them. These are known as flowchart symbols.



STATEMENT COVERAGE

You can say you have achieved 100% statement coverage if your test cases executes every statement in the code at-least once.

Let's solve a problem on statement coverage so that you know how to solve such question when asked in exam.

How many test case are required to achieve 100% statement coverage?

Switch PC on
Start "outlook"
IF outlook appears THEN
Send an email
Close outlook




Tip: To achieve 100% statement coverage you need to execute all the statements (represented with rectangular boxes).You need to find out the shortest number of paths following which all the nodes will be covered. 

As you seen in diagram below in one path we can cover all statements. So 1 test case is enough to achieve 100% statement coverage.

If you are flying with an economy ticket, there is a possibility that you may get upgraded to business class, especially if you hold a gold card in the airline's frequent flier program. If you don't hold a gold card, there is a possibility that you will get 'bumped' off the flight if it is full and you check in late. This is shown in Figure 4.5.
Note that each box (i.e. statement) has been numbered. Three tests have been run:

Test 1: Gold card holder who gets upgraded to business class
Test 2: Non-gold card holder who stays in economy
Test 3: A person who is bumped from the flight

What is the statement coverage of these three tests?
a. 60%
b. 70%
c. 80%
d. 90%


The answer is 80%. There are 10 statements(boxes) and 8 have been covered by the tests run.



BRANCH/DECISION COVERAGE:

Branch coverage is also known as Decision coverage. It covers both the true and false conditions unlike statement coverage. We can say we have achieved 100% decision coverage if all the edges in the flow charts are covered by your test case.

How many test case are required to achieve 100% decision coverage?

Switch PC on
Start "outlook"
IF outlook appears THEN
Send an email
Close outlook
We need 2 test cases to achieve 100% decision coverage. 2 paths will ensure covering of all the edges as shown is figure below:

How many test cases are required for 100% decision coverage?

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



With 2 paths we can cover all the edges. So 2 test cases are required for 100% decision coverage.
Tips
  • Cover all nodes for 100% statement coverage. 
  • Cover all edges for 100% decision coverage.

You are often asked minimum number of test cases required to cover 100%statement and branch coverage in ISTQB exams.
PATH COVERAGE:
To achieve 100% path Coverage you need to cover all the paths from start to end. As far as I know you wont get questions to calculate path coverage in ISTQB certification exam.

How many test cases are required for 100% path coverage?

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



As shown in the illustration above, 4 test cases are required for 100% path coverage.

1A-2B-E-4F
1A-2B-E-4G-5H
1A-2C-3D-E-4G-5H
1A-2C-3D-E-4F

Remember
  1. Branch coverage and Decision coverages are one and the same
  2. 100% LCSAJ(Linear Code Sequence and Jump.) coverage implies 100% Branch/Decision coverage
  3. 100% Path coverage implies 100% Statement coverage
  4. 100% Branch/Decision coverage implies 100% Statement coverage
  5. 100% Path coverage implies 100% Branch/Decision coverage
I have tried to explain the statement and decision coverage with simple techniques. I hope it helps!


RECOMMENDED BOOK FOR ISTQB NEW SYLLABUS
                                                                    




59 comments:

Naveen Kumar S said...

Thanks for your effort :-)

poonampreet said...
This comment has been removed by the author.
poonampreet said...

Thanks,great explanation.

Sari said...

Very detailed Explanation.Thank You

Unknown said...

Hi Prashant, Could you please solve this as well for both branch and statement coverage? Thanks!
IF A > B THEN

C = A – B

ELSE

C = A + B

ENDIF

Read D

IF C = D Then

Print “Error”

ENDIF

Sherlin Jones said...
This comment has been removed by a blog administrator.
Unknown said...

It helps alot ...easily understable with examples

Unknown said...

What are nodes and edges? can you elaborate?

Suba said...

Testing mould our application without any bugs. As you said Testing field is peak in software industry. I like your way of writing. I am the one who is interested to learn testing blogs, eagerly waiting for the next article from you.
Regards:
Software training institutes in chennai
Software testing training institutes in chennai

UNKNOWN said...

Those guidelines additionally worked to become a good way to recognize that other people online have the identical fervor like mine to grasp great deal more around this condition.

Best Selenium Training in Chennai



Anonymous said...

Such easy explaination.

David Miller said...

Wow, great post.

David Miller said...

I visit the website more times to know more information. This post about to solving statement and branch coverage problems very easy way. I am waiting for your next post about Personal Statement Review information.

Unknown said...

Thanks a lot very much for the high quality and results-oriented help. I won’t think twice to endorse your blog post to anybody who wants and needs support about this area. Digital Marketing Training in Chennai

Andreas said...

Thank you very much!

NAINA said...

you are the real hero. I read your article. IU think you always follow google Update. I see you are used info graphic Video for information article website. I love the skill. thans.

Steven G. Kingsley said...

Glad to know this information.

Steven G. Kingsley said...

This is wonderful article about solution of statement and branch coverage problem. Here you have provided great explanation with some diagram. This statement solution system should helpful for students. Also you can visit our site to take personal statement writing help. Thanks for sharing useful post.

Unknown said...

Excellent explanation

Anonymous said...

Your explanation is the best one for me, after countless blogwalking. Thank you very much. Please continue blogging!

Stephanica said...

Thank you for the nice article here. Really nice and keep update to explore more gaming tips and ideas.

Android Game Testing Services

Adhoc Testing

Stephanica said...

Thank you for the nice article here. Really nice and keep update to explore more gaming tips and ideas.

Game Testing Company

Video Game Testing Company

Mobile Game Testing

Focus Group Testing

Game QA Testing

sheran said...

wooow Thanks well explained.

Edward said...

Really nice topics you had discussed above. I am much impressed. Thank you for providing this nice information here

Software Testing Company

Mobile Game Testing

Gameplay Testing

Switch Game Testing

Stephanica said...

Thank you for the nice article here. Really nice and keep update to explore more gaming tips and ideas.

Game QA Company

Game Functionality Testing

Game Compatibility Testing

Game Compliance Testing

Anonymous said...

Very good explanation!Thanks a lot!!

Androidgsm.com said...

Your File 100% Working... Brother.. Thanks For Uploading....
Please Visit Our Website, Mobile flashing Tools, Cracked Box, Frp Remover Tool, Country Unlock Tools, iPhone Unlock tools, Any Flash File Without Password,Mtk file,mobile pc All software, Etc File Tool Free Download BY AndroidtipsBD71.xyz
AndroidtipsBD71.blogspot.com

new hd movie download By hdvdomela.blogspot.com
All mobile flash file baypass 100% tested free password by
Chiefbd.blogspot.com



Nisuga Jayawardana said...

what if there is a while loop like this??
Is there Any easy method to get the minimum number of required test cases?

intf1(int x, int y){
while (x != y){
if (x>y)
x=x-y;
else y=y-x;
}
return x; }

Chris Hemsworth said...

The article is so informative. This is more helpful. Thanks for sharing.
Learn best software testing online certification course class in chennai with placement
Best selenium testing online course training in chennai
Best online software testing training course institute in chennai with placement

adhi said...


thanks for your information really good and very nice web design company in velachery

shivam said...

Flying Shift - Packers & Movers in Bhopal

divi said...

Really nice blog, I enjoyed your information. Thank you and I will expect more in the future.
web design company in velachery

Anonymous said...

Good effort. Specially the animated example. Some of the examples and content seems to be have been referred from ISTQB Guru

Naveen S said...

This is the first & best article to make me satisfied by presenting good content. I feel so happy and delighted. Thank you so much for this article.

Learn Best Digital Marketing Course in Chennai

Digital Marketing Course Training with Placement in Chennai

Best Big Data Course Training with Placement in Chennai

Big Data Analytics and Hadoop Course Training in Chennai

Best Data Science Course Training with Placement in Chennai

Data Science Online Certification Course Training in Chennai

Learn Best Android Development Course Training Institute in Chennai

Android Application Development Programming Course Training in Chennai

Learn Best AngularJS 4 Course Online Training and Placement Institute in Chennai

Learn Digital Marketing Course Training in Chennai

Digital Marketing Training with Placement Institute in Chennai

Learn Seo Course Training Institute in Chennai

Learn Social Media Marketing Training with Placement Institute in Chennai

Komal said...

your article on data science is very good keep it up thank you for sharing.
Data Science course in Hyderabad

data science course in hyderabad said...

your article on data science is very interesting thank you so much.
Data Science course in Hyderabad

source said...

Looks easy enough (sarcasm). Thanks for the content though.

Anonymous said...

This was really helpful

thank you very much!!!

kloudportal said...

Thank you for sharing this post
Very nice post here thanks for it I always like and search such topics and everything connected to them.
Online Exam Software

Anonymous said...

Very useful article while preparing for ISTQB exam! Thanks :)

Y Hasnat said...
This comment has been removed by the author.
Aipmca said...

Web Designer in Noida
Best Website Development service In Noida
Website Designing service In Noida
Best digital marketing service In Noida
Best digital marketing Company in Noida
Indian Bookmarking list
Indian Bookmarking list
India Classified Submission List
Indian Classified List

yadav said...


Nice Blog. Keep update more information about this..
IELTS Coaching in Chennai
IELTS coaching in bangalore
IELTS coaching centre in coimbatore
IELTS coaching in madurai
IELTS Coaching in Hyderabad
Best ielts coaching in bangalore
ielts training in bangalore
ielts coaching centre in bangalore
ielts classes in bangalore
ethical hacking course in bangalore

Allen Marry said...

The information which you have provided is very good. It is very useful who is looking for Game testing services

merlin said...

As you said Testing field is peak in software industry. I like your way of writing. I am the one who is interested to learn testing blogs, eagerly waiting for the next article from you.
Selenium Training in chennai | Selenium Training in anna nagar | Selenium Training in omr | Selenium Training in porur | Selenium Training in tambaram | Selenium Training in velachery




Microtechsupport_UK said...

Looking for Outlook Support UK, visit on:
Microsoft Exchange Contact Number

Edward said...

Thank you so much for this nice information. Hope so many people will get aware of this and useful as well. And please keep update like this.

Game QA Solutions

PC Game Testing Services

Playrep said...

playrep is offer you to play lots of games like - fungame, funrep, playrep etc..

WOW said...

thank u

WOW said...

Description:-
The West Bengal Police is one of the two police forces of the Indian state of West Bengal. The West Bengal Police was reorganized under provisions of the Police Act 1861 during the British Raj.

Here you can find West Bengal Police full mock test in Bengali. You will get a free mock test for West Bengal Police.

anand said...

nice post
Software Testing Training in Chennai | Certification | Online Courses



Software Testing Training in Chennai | Certification | Online Training Course | Software Testing Training in Bangalore | Certification | Online Training Course | Software Testing Training in Hyderabad | Certification | Online Training Course | Software Testing Training in Coimbatore | Certification | Online Training Course | Software Testing Training in Online | Certification | Online Training Course

sathya said...

There are many things I agree with in this post. Enjoyed the simplicity. Thanks for the post. If you want to learn

Selenium Training in Chennai | Certification | Online Courses

selenium training in chennai

selenium training in chennai

selenium online training in chennai

selenium training in bangalore

selenium training in hyderabad

selenium training in coimbatore

selenium online training

sara mohamed said...

شركة تنظيف بخميس مشيط
شركة تنظيف منازل بخميس مشيط
تنظيف سجاد بخميس مشيط
شركة تنظيف مجالس بخميس مشيط
شركة تنظيف سجاد بابها
شركة رش مبيدات بابها
شركة تنظيف فلل بابها
شركة تنظيف سجاد بابها
شركة تنظيف كنب بابها
شركة تنظيف سجاد ومجالس بابها
شركة تنظيف خزانات بابها
شركة تنظيف منازل بابها

HelpTech said...

Looking for Outlook Support UK, visit on: Phone Number For Outlook Support UK

Social Media Marketing Agency said...

You prominent the function of huge information in computerized promoting. Much appreciated! branding companies in chennai

HelpTech said...

Looking for Microsoft Office 365 Support UK call on 0808 164 2786 , visit on: Microsoft Office 365 Support UK

COCOTECH said...

Amazing to peruse this sorts of blog, continue giving the new updates. Continue sharing Thanks... Regards Activated carbon manufacturing companies in India

Unknown said...

The article unambiguously top branding companies in chennai indicated every one of the positive and negative sides of the issue I'm exceptionally bewildered with the nature of the substance which you have written down. This is a marvelous article! Your article has all the essential data on the individual theme branding companies in chennai

borav said...

Hi! I simply need to offer you a major approval for your incredible data you have here on this post. I'll be returning to your site for all the more soon.
live

SUBSCRIBE AND GET FREE UPDATES TO YOUR INBOX!

Strategy to excel in ISTQB CTFL 2018 (New syllabus)

LogiGear Blog

Popular Posts

Total Pageviews