15.01.2013 Views

Model-Based Testing - Testing Experience

Model-Based Testing - Testing Experience

Model-Based Testing - Testing Experience

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Let’s assume that a tester performs a review using a flow model.<br />

While reviewing, he might run into the following text. It’s a very<br />

simple example from a functional design, be it a use case or some<br />

other design document:<br />

“After opening the web site the ‘log on’ screen is shown in<br />

which the user can enter his username/password. After validation<br />

the user is shown the ‘choose update product’ screen”.<br />

The point is not that this description says nothing about how<br />

to validate the username/password combination. This may very<br />

well – and for good reason – be written down in some other artifact.<br />

What’s missing here is what should happen if the username/<br />

password combination does not compute. Then what? Back to<br />

the log on screen? Most probably, but how many times? Infinitely,<br />

or is there some security rule that enforces a maximum of three<br />

tries after which a suspend mechanism must be invoked?<br />

One could say that a tester, especially if he’s well-trained and<br />

experienced, should and will find this flaw anyway. That’s true.<br />

However, if a tester, under time pressure, has to read through a<br />

design artifact of dozens of pages, he’s bound to miss some of<br />

the flaws. Testers are not perfect. And even when he picks it up,<br />

it might be very tempting to think (to know!?) that after three<br />

tries, the suspend mechanism must be invoked. So he does not<br />

question the artifact. But that’s interpreting the design. Testers<br />

are human!<br />

Discussing the model<br />

A typical product of a traditional review is a list of comments and<br />

questions. In practice, it’s a list of design flaws and errors. Let’s<br />

be honest, this can be perceived rather negative by the designer.<br />

With model-based reviewing, a shift is made towards the positive.<br />

If a tester can’t put the design into a proper flow, there may be a<br />

couple of reasons. Firstly, the tester may not have the proper background<br />

to do so – he just lacks subject matter knowledge – or it<br />

has to do with the design itself – too little detail, inconsistent, incomplete,<br />

... – or a combination of factors. In any case, something<br />

needs to be done, measures need to be taken.<br />

The best way forward is to discuss the design with all parties<br />

involved. With a traditional review, designers may take remarks<br />

personally, an attack on ‘their work’. <strong>Model</strong> based reviewing will<br />

take the sting out of this ‘design discussion’: you’re not questioning<br />

the work of someone else, you’re putting your own model up<br />

for questioning! Showing that you created a model out of a design<br />

artifact itself will prove you’ve invested time and effort into<br />

understanding what another designer created.<br />

Suppose a tester wants to discuss the example mentioned before.<br />

The tester can now use the process flow as a communication tool<br />

with the designers of the functional description. The goal is to<br />

complete the model by asking questions like: ‘What happens if<br />

validation fails? ’, or ‘What will happen if validation fails over and<br />

over again?’ In practice, both designers and testers will be adjusting<br />

the model in no time. After the model is finished, the tester<br />

needs to emphasize that all changes to the model imply changes<br />

to the original artifact. It’s up to designers to make these changes.<br />

www.testingexperience.com<br />

Finalizing the model<br />

As stated earlier, model-based reviewing takes place at the stage<br />

‘intake test base’. An important aspect of this stage is a common<br />

understanding of the scope of the testing at hand. Merely agreeing<br />

on testing functional design ‘FU_update_product v0.9.3’ or<br />

use case ‘UC001.C version 1.4’ isn’t enough. To what extent will<br />

this be tested? The finalized model serves as a reference for the<br />

agreements on this. If all paths of the flow model will be tested,<br />

only the test depth needs to be decided, but if the design is too<br />

elaborate to test all paths, including all alternate paths, and every<br />

possible error handling path, then a different way of drawing a<br />

path (different coloring, dotted or not) can be applied to indicate<br />

whether or not that (part of the) path is included in the test at<br />

hand.<br />

<strong>Model</strong> based test design<br />

<strong>Model</strong> based reviewing is time consuming, and up to this point<br />

no test case is created and no test is executed. Therefore model-based<br />

test design steps in. <strong>Model</strong>s are unambiguous (at least<br />

good models are). So a test suite derived from such an unambiguous<br />

model consists of a predictable set of test cases, provided by<br />

a formal test design technique. One of the nice features of the<br />

Internet is that it hosts an increasing number of automated test<br />

design tools. With the help of these tools, a test suite can be built<br />

out of models in a matter of minutes, where manual test case<br />

specification would easily take days or more. Thus, the extra effort<br />

put into creating models during test preparation is won back<br />

several times over during the test specification phase!<br />

Advantages of model-based test services<br />

Applying models in our day to day test activities shows several<br />

benefits:<br />

For test preparation:<br />

▪ Creating and reviewing models not only finds defects in the<br />

test base, but also enhances our understanding of the application<br />

under test<br />

▪ It will make the test base more clear and objective.<br />

▪ Using models removes the ‘personal element’ from reviewing.<br />

For test specification:<br />

▪ Accessibility and traceability back to the test base of the test<br />

suite increase.<br />

▪ The width and depth (scope) of the test suite becomes much<br />

clearer, since it is the scope of the model.<br />

▪ Test specification might very well be automated.<br />

It’s plausible that model-based services also provide advantages<br />

for test execution. Increasing the quality of documentation by<br />

applying model-based reviewing has two advantages. First it’s<br />

likely that the quality of the delivered software increases, as the<br />

improved documentation is used by programmers as well. This<br />

could speed up test execution. Furthermore, a major barrier is removed<br />

for test automation as the inconsistencies in documentation<br />

are now gone.<br />

The Magazine for Professional Testers<br />

19

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!