Game Testing All in One (Game Development Series)
The TFD Enter and Exit flows present special cases you must deal with when inverting usages. Since these are really "test" operations versus " user " operations, the usage percentage for these flows should be preserved. They will keep the same value in the inverted usage set that you assigned to them originally. Figure 12.22 shows the Unlock Item TFD's inverted Casual player usage table initialized with these fixed values.
Figure 12.22: Inverted flow usage table initialized with Enter and Exit flow data.
Complete the table by performing the inversion calculation process for the flows leaving each state on the TFD. Go from state to state and fill in the table as you go along. Start at the top of the diagram with the NoPointsItemLocked state. Do inversion calculation for flows 3 and 14. Since these flows have the identical value of 50%, there's no need to do any math. The inverted result in this case is the same as the original. Put 50's in the table for these flows, as shown in Figure 12.23.
Figure 12.23: Fixed usage added for flows leaving NoPointsItemLocked .
Moving clockwise around the diagram, do the inversion for flows 2 and 4 coming from HavePointsItemUnlocked . There are only two values, so you can swap values without having to do a calculation. Figure 12.24 shows the 90% inverted usage for flow 2 and the 10% inverted usage for flow 4 added to the table.
Figure 12.24: Inverted usage added for flows leaving HavePointsItemLocked .
The next state on your trip around the TFD is HavePointsItemUnlocked . This is the state that has the Exit flow, which is already recorded as 10% in the inverted table. The trick here is to invert the other flows from this state while preserving the total usage of 100% when they are all added up, including the Exit flow. Have you figured out how to do this? For step 1, only calculate the reciprocals of flows 5 (5%), 7 (75%), and 12 (10%). These would be 20, 1.33, and 10, respectively. The sum of the reciprocals (step 2) is 31.33. Divide each reciprocal with the sum (step 3) to get 0.638, 0.042, and 0.319. Since it has already been established that flow 6 (Exit) accounts for 10% of the usage probability total for HavePointsItemUnlocked , then these other three flows must account for the remaining 90%. Multiply the inverted usages for flows 5, 7, and 12 by 0.9 (90%) to account for that. The final result for flow 5 is 0.574 (57.4%), for flow 7 is 0.038 (3.8%), and for flow 12 is 0.287 (28.7%). Figure 12.25 shows these numbers included with the results for the other flows usages calculated so far.
Figure 12.25: Inverted usage added for flows leaving HavePointsItemUnlocked .
Go to the next state, which is NoPointsHaveItem . This is another situation with only two flows to invert. Swap the usage values for flow 8 and flow 9. Figure 12.26 shows flow 8 added to the table with a 90% inverted usage and flow 9 with a 10% inverted usage.
Figure 12.26: Inverted usage added for flows leaving NoPointsHaveItem .
NoPointsItemUnlocked is the last state to account for on the diagram. Three flows leave this state, so you have to do some calculations. Flow 10 has a 5% usage, so its reciprocal is 20. Flow 11 has a 90% usage. Its reciprocal is 1.11. Flow 13 has the same usage as flow 10 and, therefore, the same reciprocal of 20. Now do step 2 and add up the reciprocals. 20 +1.11 +20 = 41.11. Find the inverted usage of each flow by dividing their reciprocals by this total. For flows 10 and 13, calculate 20/41.11, which results in 0.486, or 48.6%. Calculate flow 11's inverted usage as 1.11/41.11, which is 0.027, or 2.7%. Enter these values to the table to get the completed version shown in Figure 12.27.
Figure 12.27: Completed table with inverted usage for NoPointsItemUnlocked .
With these inverted percentages you can produce TFD Cleanroom paths and test cases in the same way you did earlier from the normal usage probabilities.
One technique that makes it a little easier to keep track of the number ranges associated with each percentage is to add a Range column to the usage table. Figure 12.28 shows how this looks for the Unlock Item TFD inverted usages. This column can be especially helpful when the flows from a state are scattered around, like flows 3 and 12 coming from NoPointsItemLocked .
Figure 12.28: Inverted Casual player usage and ranges for Unlock Item TFD.