Each adopts its own technique of doing the table test. I will describe more or less how I do.
I create a table with the declared variables, each in a column. Each row in the column will serve to annotate the new variable value whenever there is a reassignment. Some people like to scratch the previous value to avoid confusion and only make visible the same last, which is what counts.
It is also possible to have columns for sub-expressions, which can help find errors in them.
Then from the third line I start the annotation in a column of n1
. I’ll write down a number I wish to test.
I then note the result of the calculation of the n1
(is always the last value available in the column) times 3.
Then I do the same taking the last value of n1
minus 1 plus the last value of n2
.
Then I write down separately what should appear on the screen (a screen-only page), in case O resultado final será n3=
and the last value of n3
.
If it were something more complex it would continue. If it had a loop it would keep the notes.
I would test with various values, with 0, positive, negative, some high numbers, try for a text, finally try to create situations that cause error in the algorithm.
To make an easy table test it is important that the algorithm is not too big.
In some cases there may be some specifics of how to proceed.
Some people like to create a data line for each line or sub-expression executed by copying the previous data. I think exaggeration, but it can be useful in some cases. I only do something when the state changes.
Tools of debug existing powerful today have almost abolished the use of table test on the same table :)
en.slideshare.net/mobile/henriquecarmona/aula-4-teste-de-mesa
– Dorathoto