Exercise 2

click to expand
Figure A.2

Is this a valid logic circuit? All three equations do add up to the same number, but this is not a valid logic flow circuit. Two rules were broken here, and the net effect is that mathematically they cancel each other out of the calculations. This is a common occurrence in actual testing. The person doing the logic flow misses the exception clause when he or she is figuring out or explaining how the system works. A superficial inspection will not find these bugs. Care should be taken when the system is reviewed to look at each individual node and be sure it complies with the rules.

Rule: 

You can only have one edge leaving a process.

The p2 process was actually a decision. When this change is made, the equations no longer total to the same number.

  • IP = Edges - Nodes + 2

  • 11 - 8 + 2

  • = 5

  • IP = Regions + 1

  • 4 + 1

  • =5

  • IP = Decisions + 1

  • 5 + l

  • = 6

Rule: 

A decision can have more than one edge coming into it, but it is better to use a process node to collect the edges and feed a single edge into the decision.

Adding a collector or process node and one edge does not add to the total number of paths through the system. From the equation we can see that these additions cancel each other out.

  • IP = Edges - Nodes + 2

  • 12-9 + 2

  • = 5

Adding one edge and one process node makes the model clearer. If the collector node is necessary for conceptual clarity, it is probably necessary for programmatic clarity as well. This is one of the first things we identify in a reengineering effort. Take out the multiple entry points, and funnel all entries through a collector node. Not only does such a procedure node help structure a system, it is the perfect place to install a diagnostics trace to aid in testing the system.

Adding a collector node and diagnostics can have other benefits as well. It is not uncommon to discover that several of the edges that were thought to enter the new collector node are defunct or erroneous. One of the most productive uses of measurement is to verify actual usage. In one project, when a collector node and usage counts were added at the entrance to a report writer on a large system, it was discovered that only about 15 percent of the system reports were ever requested. This information was used to accurately reapportion the maintenance budget. The result was a better-balanced workload for support personnel and huge cost savings.

Rule: 

A decision must have two edges leaving it.

The d2 decision has only one edge leaving it. We will assume that it was really a process. When this change is made, the totals of all three equations agree:

  • IP = Edges - Nodes + 2

  • 8-11+2

  • = 5

  • IP = Regions + 1

  • 4 + 1

  • = 5

  • IP = Decisions + 1

  • 4 + l

  • =5

click to expand
Figure A.3



Software Testing Fundamentals
Software Testing Fundamentals: Methods and Metrics
ISBN: 047143020X
EAN: 2147483647
Year: 2005
Pages: 132

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net