Pages

Tuesday, March 22, 2016

Timeboxing: Budgeting Time in Test Design with an Operational Profile

Use Case Levels of Test: Innovate & Work Smart in Software Test Design
In the last few posts we've been talking about the importance of operational profiles as a tool for working smart in test design and how to generate an operational profile from a use case diagram using a simple QFD matrix. In this post we look at how to use an operational profile for budgeting your time in test design to maximize bang for the buck, or or as John Musa said, “More reliable software, faster and cheaper”.

 

Timeboxing

The strategy for test design presented is my book is to budget test design time for each use case based on an operational profile: an analysis of the frequency of use of each use case. After all, frequency of use is opportunity for failure: the more use, the more opportunities for the user to find defects.

The idea of budgeting a fixed time for some task is called timeboxing. Timeboxing is a planning strategy often associated with iterative software development in which the duration of a task (design tests for a use case) is fixed, forcing hard decisions to be made about what scope (number and rigor of tests) can be delivered in the allotted time. What’s new with the approach here is that budgeted times are based on an operational profile.

To illustrate, say you’ve been given a week to write test cases from the use cases of the library system (see last two posts). During that week you estimate your team will be able to spend about 40 staff hours. To get an idea of how best to budget the teams’ time, you construct a quick spreadsheet using the relative frequencies from the operational profile (again, see last two posts). Results are shown below; hours budgeted (right column) have been rounded to the nearest whole hour.

Allocating 40 hours of test design, timeboxing, based on the operational profile
Allocating 40 hours of test design based on the operational profile

The first thing you will notice in this example is that some tests have been allocated zero hours of test design; that is based on the low frequency of use. And this is a good time to reiterate one of the reasons use cases have gained attention in testing: in a pinch (you’ve run out of time for test design), the use cases for which you didn't get around test design are workable substitutes for full-fledged test cases.

Alternatively you may decide you really want some tests designed for each use case regardless of how little they are used. The figure below illustrates budgeting the 40 hours of test design to strike a balance between the spirit of the operational profile and yet having some time for test design for all use cases. And I think it is the spirit of what the operational profile is showing us that is important for planning. That combined with some common sense will lead to a better allocation of time.

Allocating 40 hours of test design, timeboxing, based on the operational profile

Reallocation of 40 hours honoring the spirit of the operational profile, yet still making sure each use case has at least a minimal amount of test design.

 

Timeboxing, Use Case Levels of Test, and Test Rigor

Timeboxing, use case levels of test, and test rigor
The four use case levels of test
In the side bar is an illustration I've used before of the four levels of use case test, and a strategy based on it for test design. Using that illustration, once budgeted time is in place for each use case (level 1), test design would proceed use case by use case, working top-down from level 2 (use case), to level 3 (single scenario) to level 4 (operations) until the budgeted time for a use case is up.

For use cases for which many hours have been budgeted, this strategy will produce tests at all levels, 2-4. And at any given level, when the option is available to increase or decrease rigor, rigor could be increased.[1] Tests at more, deeper levels, with increased rigor, will translate to more tests, with greater detail, and ultimately more test execution time for frequently used use cases.

For use cases for which few hours have been budgeted, test design may not progress deeper than level 2 (use case) or 3 (single scenario) before time is up. And at any given level, less rigor is likely in order to accommodate for less budgeted time. Tests at fewer levels with less rigor will translate to fewer, coarser granularity tests for use cases used infrequently.

 

Footnotes

[1] For an example of what I mean by increased or decreased test design rigor, refer to Chapter 4 of the book, Control Flow Graphs: Adjusting the Rigor of Test Design. Similar ideas for adjusting rigor are provided at all use case levels of test. I'll also be covering this in some future post.

Thursday, March 10, 2016

From Use Case Diagram to Operational Profile



Book Use Case Levels of Test. Innovate & Work Smart in Software Test DesignIn the previous post we explored an important question related to working smart in test design: Does it really make sense to spend the same amount of time and rigor on test design for all use cases? We looked at the idea of an operational profile, a tool used in software reliability engineering to spot the high traffic paths through your system allowing you to concentrate test design on the most frequently used use cases, and hence those having a greater chance of failure in the hands of the user.

In this post we'll look at how to generate an operational profile from a use case diagram.

 

The QFD Matrix

QFD (Quality Function Deployment) is a product-planning tool that is used to translate business drivers into the technical requirements and design aspects of a product. Though originally developed for manufacturing industries in the 1960s, today QFD-like ideas are being used successfully for all sorts of applications, including software development, the services industry, and process management, and is considered an essential part of the quality improvement toolkit.

QFD boiled down to simple mechanics is about establishing priorities, the key tool being a QFD matrix. QFD is an ideal tool for representing a use case diagram – establishing links between actors and use cases -- and for generating an operational profile from that diagram.[1]

The easiest way to see how to generate an operational profile from a use case diagram using a QFD matrix is with an example. Using the public library book management system use case diagram from the previous post, we build a simple QFD matrix, here implemented as an Excel spreadsheet (below). In this matrix, all actors of the use case diagram are placed in rows, and the use cases are placed across the top as columns.

QFD matrix for a use case diagram. Rows of matrix are actors from the use case diagram; columns are the use cases.
QFD matrix to generate operational profile from use case diagram; rows are actors, column use cases

 

Quantify Numbers of Actors in Use Case Diagram

The next step in analyzing your use case traffic is to quantify the number of each type of actor in the use case diagram. How many book curators are there? How about librarians; self-service kiosks? Don’t get hung-up on precise numbers; ball park numbers are all you need to understand the relative numbers of actors, e.g. how many librarians do you have relative to curators: Same amount; twice as many? How about internet users; how many more than kiosks: Twice as many; a hundred times as many?

At this point you might say, “I have no idea how many internet users to expect!”. To which I would respond: Bingo, we’ve just identified a non-functional requirement that needs clarification! Asking questions about numbers of actors in the use case diagram is a healthy thing to be doing early on.
Keeping in mind that the goal is to get ballpark numbers for the operational profile you might try this. Rather than agonizing over whether there is one versus two book curators, or fifty versus two hundred internet users, try working with orders of magnitude. An order of magnitude estimate is one given in terms of a factor of 10:
100 = 1
101 = 10
102 = 100
103 = 1000
104 = 10,000
etc..
By their nature of separation, it’s usually easier to come up with orders of magnitude estimates. What’s the average life of a person? Rather than getting into debates about the numerous factors that affect people’s longevity—health, lifestyle, country, even what century—it’s pretty clear that it’s on an order of magnitude of 100 years; 10 is way too small and 1000 is way too big. Use order of magnitude estimates to get you in the ball park, then step back and refine your estimates if you feel so inclined, doubling here, and halving there.

So for our library use case diagram, using orders of magnitude estimates, let's say there is one curator, ten librarians, one self service kiosk, and one hundred internet users that might be accessing the system each day. This information is placed in the matrix in column Number of Actors (below)

QFD matrix to generate operational profile from use case diagram; in this step you quantify the number of each type of actor
QFD matrix to generate operational profile from use case diagram; in this step you quantify the number of each type of actor

 

Quantify Use Case Frequency of Use by Actors

With estimates of numbers of each type of actor identified you now turn to the question of who does what, i.e. which actors use what use cases .. and how often! In a use case diagram this information is captured as relationships – depicted as lines – between actors and use cases. In the QFD matrix it is captured by placing a number in the cell that corresponds to the intersection of an actor (row) and use case (column). The number you place in the cell is the number of times a “typical” actor of that type will execute that use case per some unit of time, say daily. If an actor never uses a particular use case the cell is left blank.

Again, using orders of magnitude to estimate frequency of use will help avoid analysis paralysis. Once in the ballpark you can step back and tweak the estimate, doubling here and halving there if needed. For the library use case diagram, orders of magnitude estimates for each actor are provided in the matrix below; frequency is given in times per day each use case is executed by each actor of that type.

QFD matrix to generate operational profile from use case diagram; cells show which actors use what use cases .. and how often!
QFD matrix to generate operational profile from use case diagram; cells show which actors use what use cases .. and how often!
 
Notice that the Book Curator executes the Add Books to Library Database use case and Remove Books from Library Database use case .5 and .05 times a day, respectively.  Are those order of magnitude estimates? Yes; when a use case is used less than once per unit of time – here daily – you can get the order of magnitude estimate as follows. The curator adds about 100 books (order of magnitude) a year; a year is about 200 working days, so the formula for calculating daily use is:
100 / 200 = .5
Similarly, the curator removes about 10 books a year (order of magnitude; the library is growing!), so the formula for calculating daily use is:
10 / 200 = .05
Getting estimates of the number of actors of each type and frequency of use information is the hard part of analyzing the traffic through your use cases. All that is left is to crank out the results. The matrix below shows the final results: an estimate of the frequency of daily execution of each use case by all actors in the library book management system (also shown are the formulas you need for this; the top formula calculates absolute number of times per day; the bottom formula calculates relative frequency.)

Final QFD matrix to generate operational profile from use case diagram.
Final QFD matrix to generate operational profile from use case diagram.

In a future post we’ll look at how to put these relative frequencies to work in test design.


[1] You really don’t need to know much more about QFD to generate an operational profile from a use case diagram, but if you want to learn more refer to Denney, Succeeding with Use Cases, Part 1, which gives a broader treatment of the combined use of QFD with use cases.

Pages