Active TopicsActive Topics  Display List of Forum MembersMemberlist  CalendarCalendar  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin


 One Stop Testing ForumTypes Of Software Testing @ OneStopTestingFunctional Testing @ OneStopTesting

Message Icon Topic: Complexity Testing - Cyclomatic Complexity

Post Reply Post New Topic
Author Message
yogindernath
Groupie
Groupie


Joined: 27Oct2008
Location: India
Online Status: Offline
Posts: 52
Quote yogindernath Replybullet Topic: Complexity Testing - Cyclomatic Complexity
    Posted: 25May2009 at 9:10am
Two questions coming to mind while doing the code complexity testing are:

Question – 1: Which of the paths are independent?

If two paths are not independent, then we may be able to minimize the number of tests.

Question – 2: Is there any limit on the number of tests that must be run to ensure that all the statements have been executed at least once?

The answer to the above questions is a metric that quantifies the complexity of a program and is known as Cyclomatic Complexity.

It is also known as structural complexity because it gives the internal view of the code. It is a number, which provides us with an upper bound for the number of tests that must be conducted to ensure that all statements have been executed at least once.

McCabe IO covers about 146 different counts and measures. These metrices are grouped according to six main "collections" each of which provides a different level of granularity and information about the code being analyzed.

The collections of various metrices are as under

1) McCabe Metrics: are based on Cyclomatic Complexity, V(G).

2) Execution Coverage metrics: are based on any of Branch, Path or Boolean coverage.

3) Code Grammar metrics: are based around line counts and code structure counts such as Nesting.

4) 00 metrics: are based on the work of Chidamber and Kemerer.

5) Derived Metrics: are based on abstract concepts such as understability, maintainability, comprehension and testability.

6) Custom Metrics: are imported from third party software / systems, e.g. defects count.

McCabe IO provides for about 100 individual metrics at the Method, Procedure, Function, Control and Section / paragraph level. 40 additional metrices are available at the class / file and program level.

Categories of Metrics: There are three categories of metrics

1) McCabe Metrics.

2) 00 Metrics.

3) Grammar Metrics.

When collecting metrics, we rely upon subordinates who need to 'buy into' the metrics program. Hence, it is important to only collect what you intend to use. We should remember, 'The Hawthorne Effect' which states that when you collect metrics on people, the people being measured will change their behavior. Either of these practices will destroy the efficiency of any metrics program.

Let us discuss the above mentioned three metrics categories

1) McCabe Metrics:

a) Cyclomatic Complexity, V(G) : It is the measure of the amount of logic in a code module of 3rd and 4th generation languages. If V(G) is excessively high then it leads to impenetrable code i.e., a code which is at higher risk due to difficulty in testing. The threshold value is 10. When V(G) > 10; then the likelihood of code being unreliable is much higher. It must be remembered that a high V(G) shows a decreased quality in the code resulting in higher defect that become costly to fix.


Complete Article is available at:
http://www.softwaretestinggenius.com/hotarticles.php?mode=details&qry=391

http://www.softwaretestinggenius.com
A Storehouse of Complete Knowledge on Software Testing & QA under one Roof



Post Resume: Click here to Upload your Resume & Apply for Jobs

IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.094 seconds.
Vyom is an ISO 9001:2000 Certified Organization

© Vyom Technosoft Pvt. Ltd. All Rights Reserved.

Privacy Policy | Terms and Conditions
Job Interview Questions | Placement Papers | Free SMS | Freshers Jobs | MBA Forum | Learn SAP | Web Hosting