SlideShare a Scribd company logo
The Magazine for Professional Testers
September, 2008
ISSN1866-5705		www.testingexperience.com		freeexemplar		printedinGermany
Test Techniques in practice -
Do they help?
Why do we often test without them?
3
350
80% 60% 40% 20%
Pantone 362�
100% 80% 60% 40% 20%
c:63
m:0
y:70
b:61
c:47
m:0
y:52
b:46
c:32
m:0
y:35
b:31
c:16
m:0
y:17
b:15
cmyk
c:76
m:0
y:100
b:11
c:61
m:0
y:80
b:9
c:46
m:0
y:60
b:7
c:30
m:0
y:40
b:5
c:16
m:0
y:20
b:3
© iStockphoto
58 The Magazine for Professional Testers www.testingexperience.com
Method for Reducing a Generic Software Routine
into a Mathematical Function
by Danilo Berta© iStockphoto
Abstracts1.	
This article describes a method that can be used
to reduce a general software routine, which ac-
cepts input of alphanumeric values and returns
alphanumeric output values, into a mathemati-
cal function. A generic software routine takes
and produces alphanumeric strings as inputs/
outputs, whereby there is no way to define an
order in these strings (e.g. it is not possible to
determine between two strings which of them
comes before or after the other).
In order to explain the matter in more detail,
we will consider a simple software routine
which produces as output the reverse string
that it has taken as input. This routine can be
defined as a mathematical function in this way
( ) 1121 ...... xxxxxxf nnn −= , where 11...xxx nn − are
generic alphanumeric characters. If we want
to draw a Cartesian graph of the function,
we need to know if, for example, the string
11...xxx nn − comes before or after the other string
51... −nn xxx , or any other string which we can
use as input of the function.
If we were able to reduce a software routine
into a well-defined function, we would also
be able to use the well-known mathematical
methods to test the same function, sampling
some of the input values of the function (in
some statistical way) in order to verify whether
the outputs of the same function for these input
values are as expected. This method, which is
strictly speaking a black-box method, can also
be applied to any routine with any number of
inputs and outputs; it’s clear that in these cases
we have to deal with multi-variable functions.
In this article, we will not deal with statisti-
cal sampling methods, but will only describe
a method for associating a generic string with
a number in an unambiguous way, and will
then discuss how to apply this method for the
test and the regression test of generic software
routines.
Introduction with a simple example2.	
Let’s start with a very simple example to so we
can follow the course of the subsequent dis-
cussion with a more technical and mathemati-
cal approach.
To keep things simple, we assume that we
have a really straightforward simple software
routine that produces
as output exactly
the string it takes as
input, whatever the
string may be. This
function will be:
(2.1) ( ) 1121 ...... xxxxxxf nnn −= where nxxx ...21
are generic alphanumeric characters.
If we wanted to draw a Cartesian graph of this
function, the first problem we would encounter
is how to allocate an order to the input and out-
put string, to be able to define the metrics (the
intervals) to use for the X and Y-axes. Intui-
tively, we can imagine that this function would
be the diagonal that splits the Ist quadrant in 2
parts of 45°, as shown in the picture below:
The intervals are labeled as s1, s2,...,s10,
meaning that each point represents an input
string and s(n)< s(n+1). However, we don’t
know, for example, whether the input string
“ASER” is less than (or greater than) the string
“ATER”.
We need to define a method to associate a
unique number to a string and a method to de-
duce the string that corresponds to that num-
ber.
The first thing that comes to mind is to number
the single string elements progressively. If, for
example, we suppose that the single elements
that compose our input/output strings shall be
the first three letters of the alphabet, ‘A’, ‘B’
and ‘C’, we can compile the following table:
Fig 1: Identity Function Graph Example
... and Possible Applications for Black-Box (Functional) Software Testing
59The Magazine for Professional Testerswww.testingexperience.com
Table 1: Association of string with numbers
The table should be read in this way: number
1 is linked to string “A”, number 2 is linked
to string “B”,..., number 46 is linked to string
“AACA” and so on.
Clearly, it’s possible to go on indefinitely to
compile the table above. We need to define
a rule to calculate the corresponding number
from the string.
The rule is as follows:
Start with the base association of string with
number:
Number String
1 A
2 B
3 C
Table 2: Association of Base String with numbers
As a hypothesis, we will suppose that all
strings considered must come from any com-
bination of the base letters {A,B,C} which in
the following we will call the dictionary. So,
string “ACABCCAACC” is valid, while string
“ASDFGHAAABBCRR” is not valid, because
it contains the elements S,D,F,G,R that are not
in the defined dictionary.
The rule is expressed in the following formula,
which for now we will describe by example
(and we will explain later in detail).
(2.2)AABC = 1*33 + 1*32 + 2*31 + 3*30 =
1*27 + 1*9 + 2*3 +3*1 = 45
This is exactly the number that we find for
string “AABC” in Table 1 above. If we exam-
ine the method of obtaining a value for string
“AABC” it’s evident that it’s very similar to
the way that numbers are usually transformed
into base 2, 8 or 16 or any other base into deci-
mal. So, there’s nothing new or magic about it.
The number “3” we have used in our formula
is simply the base of the dictionary, or, in other
words, the number of base elements in the dic-
tionary {A,B,C} is exactly equal to three.
This method can be extended for dictionar-
ies with any number of elements. The higher
the number of elements in the dictionary, the
greater will be the number we deduce for
“short strings” (whereby “short strings” means
strings with a low number of base elements).
It’s a little trickier to find the “opposite rule”,
i.e. the rule to transform a generic number into
a string composed only of elements of some
well defined dictionary. For now, we introduce
the rule and apply it with an example:
Divide the number for the base of the dic-1.	
tionary, considering both the result of the
division and the remainder of the divi-
sion. For example, for dictionary {A,B,C}
the base is 3, as previously stated.
If the remainder is zero, subtract 1 from2.	
the result and replace the remainder num-
ber with the base.
If the result is greater than or equal to the3.	
base, continue with the division, applying
rules (1) and (2) until the result is zero.
In our example, this will happen just af-
ter we have found a result of the division
that is less than 3 and after exactly 4 it-
erations.
Write down the string composed by the4.	
remainder of the division, starting from
the last, and written sequentially.
Replace the number in the string, which5.	
was derived as described in point (4), with
the letter in the base association string to
number of the dictionary (see Table 2).
To explain this in more detail, we will use the
number 45 as an example to verify whether the
rule is correct. We will expect to find string
“AABC”, using the dictionary {A,B,C}.
Here is an example of the algorithm’s applica-
tion:
45/3 = 15 remainder 0. Subtract 1 from1.	
15: 15-1 = 14 that is greater than 3, so we
have to continue. Replace the remainder
0 with 3.
14/3 = 4 remainder 2. No need to sub-2.	
tract. 4 is greater than 3, continue.
4/3 = 1 remainder 1. The result is less3.	
than 3. One division more and then we
will stop.
1/3 = 0 remainder 1. Stop here.4.	
So, starting from the last remainder (step #4)
and continuing with the other remainders , we
have found the numeric string “1123”, and us-
ing the table in Fig. 2.3 we can now replace the
numbers with letters as follows:
1 → A
2 → B
3 → C
In this way, the numeric string “1123” becomes
“AABC”, which is the string corresponding to
the number 45 in the Table 1.
In the following paragraph, mathematical
proof of these rules is presented.
Mathematical proof of the rules3.	
First of all, we will start with some useful defi-
nitions, as used before:
A1.	 dictionary is a collection of elements
a1,a2,...,an composing the string. It’s
written as follows: D{a1,a2,...,an}.
A2.	 base of the dictionary D is a number
equal to the number of elements of the
dictionary.
A string is3.	 valid with regard to diction-
ary D if it’s composed exclusively by ele-
ments of D. It’s not valid if there is at
least one element that does not belong to
dictionary D.
The4.	 length of a string is a number equal
to the number of elements the string is
composed of.
The5.	 numbers equivalent to the diction-
ary’s elements (in the following NEDE)
are defined by a matrix as follows:
NEDE Element
a1
= 1 a1
a2
= 2 a2
a3
= 3 a3
... ...
ap
= p ap
Table 3: Association of Base String with numbers
It is presumed that all a where j=(1,2,...,L) are
not zero. This is a fundamental hypothesis for
what follows.
Please, note that all aj
for all j=(1,2,...,L) are
strictly less than base B of the dictionary.
The first role does not have to be proven, but
must be taken as a definition of the algorithm
used to associate a number to a string. So, we
can state the following:
Definition #1: Given a dictionary D, it’s pos-
sible to associate an unique number N0
to any
valid string a1a2a3,…aL for this dictionary by
applying the following rule:
(3.1)	 N0
=
LL
L
LL
BBBBB aaaaa ++=+++ −−−−
...... 2
2
1
1
02
2
1
1
L
LL
L
LL
BBBBB aaaaaa +++=+++ −−−−
...... 2
2
1
1
02
2
1
1 because 10
=B
Number String Number String Number String Number String
1 A 13 AAA 25 BBA 37 CCA
2 B 14 AAB 26 BBB 38 CCB
3 C 15 AAC 27 BBC 39 CCC
4 AA 16 ABA 28 BCA 40 AAAA
5 AB 17 ABB 29 BCB 41 AAAB
6 AC 18 ABC 30 BCC 42 AAAC
7 BA 19 ACA 31 CAA 43 AABA
8 BB 20 ACB 32 CAB 44 AABB
9 BC 21 ACC 33 CAC 45 AABC
10 CA 22 BAA 34 CBA 46 AACA
11 CB 23 BAB 35 CBB 47 AACB
12 CC 24 BAC 36 CBC 48 ...
60 The Magazine for Professional Testers www.testingexperience.com
Where B is the dictionary’s base and aj
is the
numerical equivalent to the generic elements
aj
of the dictionary, where j=(1,2,...,L) and L is
the length of the string.
Starting from this definition, it’s possible to
deduce the rule for transforming a generic
number into a string composed only by ele-
ments of the dictionary.
If we start dividing the number N0
by base B,
we will obtain:
(3.2)
B
BB
B
N L
L
LL a
aaa ++++= −
−−
1
3
2
2
1
0
...
With the position:
(3.3)
1
3
2
2
11 ... −
−−
+++= L
LL
BBN aaa
We have:
(3.4)
B
N
B
N La
+= 1
0
that is equivalent to LBNN a+= 10
Continuing in this way, we obtain:
LBNN a+= 10
121 −+= LBNN a
232 −+= LBNN a
(3.5)	 .........
212 a+= −− BNN LL
11 a=−LN
0=LN
From the last equation in (3.5), i.e. NL-1
= a1
it
should be evident that if we start from equation
(3.1), we divide N0
by B(L-2)
. For a better un-
derstanding, an example is given below where
we apply (3.5) for the case where L = 4.
Start with: 43
2
2
3
10 aaaa +++= BBBN
Put: 32
2
11 aaa ++= BBN
we have: 410 a+= BNN
(3.5 ex)
Put: 212 aa += BN
we have: 321 a+= BNN
Put: 13 a=N
we have: 232 a+= BNN
Put: 04 =N
we have: 1143 aa ≡+= BNN
In the example L = 4, (L-1) = 3. The next N4
value is exactly equal to 0 (zero), because we
divide N3
(that is less than B) by B, obtaining
0 with remainder N3
= a1
. We have to stop the
process at this point.
Remember that we have supposed that all aj
where j=(1,2,...,L) are not zero.
In formula (3.5), the aj
where j=(1,2,...,L) are
the remainder of the subsequent division of
number N0
for the base of the dictionary, while
the Nj
where j=(1,2,...,L) are the results of the
division.
From the above discussion we can deduce the
following rule to extract from a number N0
a
string of length L composed only of elements
from a given dictionary D{a1
,a2
,...,an
}.
Define the dictionary and the number-1.	
equivalent elements.
Divide number N2.	 0
for the base B of the
dictionary, considering both the result of
the division and the remainder of the di-
vision, and continue in this way until the
result of the division is zero. This hap-
pens after L steps.
Starting from the last remainder create a3.	
string composed by the remainders of the
divisions.
Consider the remainders of the divisions4.	
as the numbers equivalent to the diction-
ary’s elements, and replace these num-
bers with the equivalent elements of the
dictionary, using the “NEDE” table.
Now, all this works fine as long as we find only
remainders of the divisions that are non zero.
However, what happens if the remainders of
the division are zero?
We will use the following simple tip. If the re-
sult of the division of X through Y is exactly
N, with remainder 0 (zero), it can also be writ-
ten as follows:
(3.6)
N
Y
N
= remainder )1(0 −=→ N
Y
X
remainder Y
In other words, the result of
Y
X should be
also be considered as equal to N-1 with re-
mainder Y. For example: 15/5 = 3 remainder 0,
but it’s also 15/5 = 2 with remainder 5.
So, if we found some aj
equal to zero in the
division process in (3.5), we now apply the tip
and replace the result with (result -1) and the
remainder with the base B of the dictionary.
This results in the following formula:
(3.7)
rrr a+= −− BNN LL
with 0=ra means:
BNN LL rr −− =
In other words:
(3.8) BBNBNN LLL +−== −−− )1( rrr
This formula demonstrates the tip explained
above.
Summary of the rules4.	
In this paragraph, we will summarize the re-
sults obtained above and define the rules for
transforming a string into a number and, vice
versa, a number into a string, with reference to
a given dictionary.
Rule #1: Transform a string into a number.
Define the dictionary and the elements of1.	
the dictionary. The elements in the string
must only be composed of any combina-
tion of elements of the selected diction-
ary.
Define the NEDE (numerical equivalents2.	
to dictionary elements) matrix
Apply the following formula:3.	
L
LL
BBN aaa +++= −−
...2
2
1
10
Where B is the dictionary’s base and aj
is the
numerical equivalent for the generic elements
of the dictionary, where j=(1,2,...,L) and L is
the length of the string.
N0 is the number corresponding to string
“a1
a2
...aL
”, that was searched.
Rule #2: Transform a number into a string.
Define the dictionary and the numerical1.	
equivalents.
Divide number N2.	 0
for the base B of the
dictionary, considering both the result
of the division and the remainder of the
division; in each subsequent division re-
place the dividend with the result of the
previous division, and continue in this
way until the result of the division is zero.
This happens after L steps, where L is the
length of the string.
If during execution of the steps described3.	
in point 2, you find a remainder equal to
zero, replace the result with (result -1)
and the remainder 0 with the base B of
the dictionary.
Starting from the last remainder, create a4.	
string composed by the remainders of the
divisions.
Consider the remainders of the divisions5.	
as the numerical equivalents to the dic-
tionary’s elements and replace these
numbers with the equivalent elements of
the dictionary, using the “NEDE” table.
61The Magazine for Professional Testerswww.testingexperience.com
We train in Latin America -
ISTQB Certified Tester Training
contact@bicorp.biz
©iStockphoto
62 The Magazine for Professional Testers www.testingexperience.com
The resulting string is the one that was
searched and corresponds to number N0
.
Software implementation of the5.	
rules
I have prepared two Perl scripts that imple-
ment both processes described. Rule #2 de-
scribed above is suitable to be implemented
in a recurring way using Perl (or your favorite
programming language), but I prefer to strictly
follow the process described to be sure that it
will work correctly.
All the scripts can be downloaded from link:
http://www.bertadanilo.netsons.org/, or direct-
ly from: http://www.bertadanilo.netsons.org/
Upload/perl_TestingExperience.zip.
Another Perl script was built with the purpose
of generating the mathematical-equivalent
function of some software routine. I took as
an example the (very simple) routine that pro-
duces as output the reverse of the string it has
taken as input.
All these scripts were prepared with the sole
purpose of providing a “proof of concept”. In
the following, there is a brief explanation of
how they work. All the scripts are released as
is, under GPL License.
Script #1. This script, called StringToNum-
ber.pl implements rule #1. It takes as input
a string and a dictionary in the form of an ar-
ray of chars separated by spaces, and returns
the numerical equivalent to the input string, as
per rule #1 explained above. To run the script,
from DOS or *IX system, you need to run the
following command:
perl StringToNumber.pl <input
string> <dictionary>
For example:
perl StringToNumber.pl ABECDEADD
“A B C D E”
which returns the number 637549
You can avoid having to explicitly call the
“perl” interpreter before the script name if
you give the execution permission (chmod +x
StringToNumber.pl) on *IX system to the
script. In Windows, it depends on how your
system is configured. I will not bother you any
further with these details. A DOS script called
runStringToNumber.bat could also be
used to run the script (avoiding having to bore
yourself with writing the dictionary, which is
usually fixed), passing only the string input pa-
rameters, as follows:
runStringToNumber.bat ABECDEADD
Script #2. This script, called NumberTo-
String.pl implements rule #2. It takes as in-
put a number and a dictionary in the form of an
array of chars separated by spaces, and returns
the numerical equivalent to the input string, as
per rule #2 explained above. To run the script,
from DOS or *IX system, you need to run the
following command:
perl NumberToString.pl <input
number> <dictionary>
For example:
perl NumberToString.pl 637549 “A
B C D E”
which returns the string: ABECDEADD. The
same considerations as for script #1 are valid
for this one. A DOS script called runNumber-
ToString.bat could also be used to run the
script (avoiding having to bore yourself with
writing the dictionary, which is usually fixed),
passing only the string input parameters, as
follows:
runNumberToString.bat 637549
Script #3. This script, called EvaluateFunc-
tion.pl implements both of the rules. It takes
as input a dictionary in the form of an array of
chars separated by spaces, and returns the ta-
ble of the results of the function that should be
used to plot the Cartesian diagram of that same
function. The function is written in the code.
In detail, to use the script you will need to:
Personalize the function to generate the•	
data in order to plot in the main routine
of the program. As a default, the function
is the “string reverse” that produces as
output the reversed input string. For ex-
ample: ABC becomes CBA.
Call the program as follows:•	
perl EvaluateFunction.pl <dic-
tionary> <number of point>
The output will be a table of data (separated by
tabs) with <number of point> points with the x
input string and y output string and equivalent
numerical value of the software function.
For example, the output of command
perl EvaluateFunction.pl “A B C
D E” 10
will be a table of 10 values as follows:
X
num
Y
num
X
num
Y
num
1 1 A A
2 2 B B
3 3 C C
4 4 D D
5 5 E E
6 6 AA AA
7 11 AB BA
8 16 AC CA
9 21 AD DA
10 26 AE EA
Table 4: Example
The plot of the “string reverse” func-6.	
tion
The first column is the X input numerical
equivalent of the input strings in the third col-
umn, while the second column is the Y output
numerical equivalent of the output strings in
the fourth column (that is the real output of the
reverse string function, or whatever function
you decide to call).
These scripts were tested on Perl version
v5.10.0 built for MSWin32-x86-multi-thread
for the Windows Vista operating system, and
Perl version v5.8.8 built for i486-linux-thread-
multi on debian version (Kurumin). These are
not really intended to control the formal valid-
ity of the inputs used (wrong numerical format,
wrong dictionary format, and so on); therefore
please take care to use the right format, other-
wise the result cannot be guaranteed.
Now, at last, we will attempt to plot a Carte-
sian diagram of a software function that works
with a list of symbols (strings). To keep the
task simple, we have decided to consider the
reverse string function. Using the command
perl EvaluateFunction.pl “A B C
D E” 100 > out.txt
we have in file out.txt a table of 100 points
that can be used to plot the “reverse string”
function. For this purpose, you may use your
favorite spread sheet or any other software you
usually use to draw graphs.
The plot looks like Graph 1.
The Y axis shows the numbers and not the Y-
string value, to make the graph easier to man-
age. Considering that the function is simply a
“reverse string” it is easy to imagine the cor-
responding string value of the Y interval num-
ber.
A graph with more points (in this case 500
points), but with fewer details, is shown be-
low.
The graph with 10000 points looks like Graph
3.
Conclusions:Whatdoesallthishave7.	
to do with software testing?
So, we have probably found a method to “re-
duce” a software routine into a mathematical
function. Clearly, what we have described can
“easily” be further generalized.
What does all this have to do with testing? At
the current moment absolutely nothing; the
main idea, as you can guess, is the following:
if we know what the mathematical equivalent
function behind the software routine under
test is, we can easily “test it” under a (small or
large) sample of input testing points (the “X”
axis).
Now, the problem is that nobody (also, and
in particular, no one who wrote the software)
knows of the function. I think that nobody
knows the profile of the “reverse string” func-
tion graphics presented above, or that the “re-
verse string function” is a well-known and
63The Magazine for Professional Testerswww.testingexperience.com
widely used feature in a lot of software pro-
grams.
So, one might ask what this method could be
useful for? It could be useful in regression test-
ing, in particular for the testing of single soft-
ware components and for the test of (probably
huge) amounts of database data, especially for
systems that cannot be easily accessed, for ex-
ample, systems who are located in different,
non-integrated environments and for which
access to the data for the software under test
can only be produced only by extraction (e.g.
in CSV format). In regression testing you can
use the information collected during the “first
test run” to clearly define the expected behav-
ior of the function under test. You can there-
fore transform it into a numeric function (one
or more functions) and keep it as reference for
the other entire regression test or retest. The
advantages are:
You collect input and expected outputa.	
data in numerical format. Knowing the
numerical input and output data, you can
at any time recalculate the inputs and out-
puts needed for the software routine (see
NumberToString.pl proof of the concept
script). Clearly, you must also save the
dictionary used in the transformation.
After you have run the software on theb.	
input data, you can transform the real
output data into a table of numbers and
draw the “real function”. This function
must then be compared with the “ex-
pected function” (i.e. performing a point-
by-point comparison between the two
functions). If any differences between
the two are found, these can be analyzed.
The operation can be easily done using
any mathematical software that can draw
graphics.
For example, to keep things simple, if you
enter users onto a system and would like to
verify that all the users’ fields are correctly
loaded onto the database, you can proceed as
follows:
Prepare the file with the data to be load-1.	
ed.
Transform all the columns for which you2.	
want to verify correct entry into the ex-
pected functions.
Load the data using the software under3.	
test
Extract the loaded data from the data-4.	
base and transform it into a function (i.e.
a real function, which expresses the real
software behavior); then compare the two
functions.
This has been done for the first time. For the
following test, you can automatize the process.
Starting from the input and output numbers
(which you saved in the first run), you proceed
as follows:
Extract the input strings from the inputa.	
numeric data and from the dictionary.
Run the software on the inputs and getb.	
Graph 1: Shape
Graph 2: Shape
Graph 3: Shape
64 The Magazine for Professional Testers www.testingexperience.com
Berta Danilo graduated in Physics at Turin University (Italy) in 1993 and first started to work
as a Laboratory Technician, but soon he switched to the software field as an employee of a
consultancy company working for a large number of customers. Throughout his career, he
worked in banks as Cobol developer and analyst, for the Italian treasury, the Italian railways
(structural and functional software test), as well as for an Italian automotive company, the
European Space Agency (creation and test of scientific data files for the SMART mission),
telecommunication companies, and the national Italian television company. This involved
work on different kinds of automation test projects, software analysis and development
projects.
With his passion for software development and analysis – which is not just limited to testing
– he has written some articles and a software course for Italian specialist magazines.
His work gives him the possibility to deal mainly with software testing; he holds both the
ISEB/ISTQB Foundation Certificate in Software Testing and the ISEB Practitioner Certificate;
he is a regular member of the British Computer Society.
Currently, he works as Test Manager for an Italian Editorial Company.
Biography
the outputs; transform the outputs into
numbers and draw the function(s).
Compare the expected output (numbers)c.	
with the real output (numbers) and find
the differences (if any).
Clearly, there will be no major differences if
we compare this method with a more tradi-
tional “string comparator”. With this method,
you will probably not have to develop new
“comparator software” to perform a particular
comparison, because all you need is software
that can draw graphics starting from a table of
(x;y) values (or also for more variables).
Acknowledgements
I’m grateful to my friend and colleague Gian-
maria Gai for the help he has given me when
I wrote this article: he also suggested that
I include some references. The problem is
that there aren’t any. The subject occurred to
me one day when I was reading a (very bor-
ing) functional analysis for some software. I
thought along the lines: “Wouldn’t it be nice
if we could reduce a big analysis into some
mathematical functions! How we can do this?
“...
If any reader knows about some other articles
and/or books on similar methods, please let me
know.

More Related Content

PDF
Arrays in c++
PPT
expressions
PDF
How to Remove First 4 Characters in Excel
PDF
Extending Boyer-Moore Algorithm to an Abstract String Matching Problem
PPT
0.1 bzca5e
PDF
Programming with matlab session 4
PPT
Topic 3
PPT
Lar calc10 ch05_sec1
Arrays in c++
expressions
How to Remove First 4 Characters in Excel
Extending Boyer-Moore Algorithm to an Abstract String Matching Problem
0.1 bzca5e
Programming with matlab session 4
Topic 3
Lar calc10 ch05_sec1

What's hot (19)

DOCX
ISMG 2800 123456789
DOCX
Digital txtbook final
PDF
Python reference
PPT
Discrete mathematics by sadat sumon
PDF
Huffman Text Compression Technique
PPTX
Recursion | C++ | DSA
PPT
Lect 8(pointers) Zaheer Abbas
PDF
[ITP - Lecture 05] Datatypes
ODP
Math Module 4 Review
DOCX
R Programming
PDF
PDF
04 a ch03_programacion
PPTX
4 absolute value and distance x
PPT
9.2 rational and irrational numbers day 1
PDF
Pointers by: Professor Lili Saghafi
PPTX
Computer Science:Pointers in C
PPTX
INTEGRAL TEST, COMPARISON TEST, RATIO TEST AND ROOT TEST
PDF
Implementation of 1D NN in Signal Processing Application to Get Relevant Recu...
ISMG 2800 123456789
Digital txtbook final
Python reference
Discrete mathematics by sadat sumon
Huffman Text Compression Technique
Recursion | C++ | DSA
Lect 8(pointers) Zaheer Abbas
[ITP - Lecture 05] Datatypes
Math Module 4 Review
R Programming
04 a ch03_programacion
4 absolute value and distance x
9.2 rational and irrational numbers day 1
Pointers by: Professor Lili Saghafi
Computer Science:Pointers in C
INTEGRAL TEST, COMPARISON TEST, RATIO TEST AND ROOT TEST
Implementation of 1D NN in Signal Processing Application to Get Relevant Recu...
Ad

Viewers also liked (15)

PPT
Oscar AFECONET presentation WFC, Durban S.A
PPT
Don't judge challenge girls
PPT
Input, output and process
PPTX
Phosphorus cycle
PPT
F 11 47 Oma likums pilnai ķēdei
PPTX
F 11 3_gravitacija_vilnji
PPTX
COPPER METABOLISM
PDF
Metabolism of zinc and its clinical significance
PPTX
Jesus gonzalez
PPTX
Edgar Dale's Cone of Experience
PPT
Elektronika dažās ierīcēs. Fizika medicīnā. Iespējamie enerģijas izmantošanas...
PDF
Ehs alert newsletter
PPTX
Loyalty
PPTX
ElectionMall Campaign Cloud Webinar February 2nd Email Fundraising Success
DOCX
кружок
Oscar AFECONET presentation WFC, Durban S.A
Don't judge challenge girls
Input, output and process
Phosphorus cycle
F 11 47 Oma likums pilnai ķēdei
F 11 3_gravitacija_vilnji
COPPER METABOLISM
Metabolism of zinc and its clinical significance
Jesus gonzalez
Edgar Dale's Cone of Experience
Elektronika dažās ierīcēs. Fizika medicīnā. Iespējamie enerģijas izmantošanas...
Ehs alert newsletter
Loyalty
ElectionMall Campaign Cloud Webinar February 2nd Email Fundraising Success
кружок
Ad

Similar to C-Pubb-TestingExperience_Issue_08_2008 (20)

PDF
A Numeric Algorithm for Generating Permutations in Lexicographic Order with a...
DOCX
© Copyright 2013 by Pearson Education, Inc. All Rights Res.docx
PDF
EmacsRedisplayAlgorithm
PPTX
Unit 1 PDF.pptx
PPTX
UNIT - I.pptx
PPTX
UNIT - I.pptx
DOCX
Lecture 1 Digital Systems and Number SystemsMatthew Shuma.docx
PPT
Introduction Combined Number And Dp
PPT
Story of Number.ppt
PDF
unit-i-number-systems.pdf
PPTX
Ip 5 discrete mathematics
PDF
25 String Matching
PDF
UNIT-1_CSA.pdf
PPTX
Daa unit 5
DOCX
Arithmetic coding
PPTX
digital-electronics.pptx
DOCX
File ...handouts complete
A Numeric Algorithm for Generating Permutations in Lexicographic Order with a...
© Copyright 2013 by Pearson Education, Inc. All Rights Res.docx
EmacsRedisplayAlgorithm
Unit 1 PDF.pptx
UNIT - I.pptx
UNIT - I.pptx
Lecture 1 Digital Systems and Number SystemsMatthew Shuma.docx
Introduction Combined Number And Dp
Story of Number.ppt
unit-i-number-systems.pdf
Ip 5 discrete mathematics
25 String Matching
UNIT-1_CSA.pdf
Daa unit 5
Arithmetic coding
digital-electronics.pptx
File ...handouts complete

C-Pubb-TestingExperience_Issue_08_2008

  • 1. The Magazine for Professional Testers September, 2008 ISSN1866-5705 www.testingexperience.com freeexemplar printedinGermany Test Techniques in practice - Do they help? Why do we often test without them? 3 350 80% 60% 40% 20% Pantone 362� 100% 80% 60% 40% 20% c:63 m:0 y:70 b:61 c:47 m:0 y:52 b:46 c:32 m:0 y:35 b:31 c:16 m:0 y:17 b:15 cmyk c:76 m:0 y:100 b:11 c:61 m:0 y:80 b:9 c:46 m:0 y:60 b:7 c:30 m:0 y:40 b:5 c:16 m:0 y:20 b:3 © iStockphoto
  • 2. 58 The Magazine for Professional Testers www.testingexperience.com Method for Reducing a Generic Software Routine into a Mathematical Function by Danilo Berta© iStockphoto Abstracts1. This article describes a method that can be used to reduce a general software routine, which ac- cepts input of alphanumeric values and returns alphanumeric output values, into a mathemati- cal function. A generic software routine takes and produces alphanumeric strings as inputs/ outputs, whereby there is no way to define an order in these strings (e.g. it is not possible to determine between two strings which of them comes before or after the other). In order to explain the matter in more detail, we will consider a simple software routine which produces as output the reverse string that it has taken as input. This routine can be defined as a mathematical function in this way ( ) 1121 ...... xxxxxxf nnn −= , where 11...xxx nn − are generic alphanumeric characters. If we want to draw a Cartesian graph of the function, we need to know if, for example, the string 11...xxx nn − comes before or after the other string 51... −nn xxx , or any other string which we can use as input of the function. If we were able to reduce a software routine into a well-defined function, we would also be able to use the well-known mathematical methods to test the same function, sampling some of the input values of the function (in some statistical way) in order to verify whether the outputs of the same function for these input values are as expected. This method, which is strictly speaking a black-box method, can also be applied to any routine with any number of inputs and outputs; it’s clear that in these cases we have to deal with multi-variable functions. In this article, we will not deal with statisti- cal sampling methods, but will only describe a method for associating a generic string with a number in an unambiguous way, and will then discuss how to apply this method for the test and the regression test of generic software routines. Introduction with a simple example2. Let’s start with a very simple example to so we can follow the course of the subsequent dis- cussion with a more technical and mathemati- cal approach. To keep things simple, we assume that we have a really straightforward simple software routine that produces as output exactly the string it takes as input, whatever the string may be. This function will be: (2.1) ( ) 1121 ...... xxxxxxf nnn −= where nxxx ...21 are generic alphanumeric characters. If we wanted to draw a Cartesian graph of this function, the first problem we would encounter is how to allocate an order to the input and out- put string, to be able to define the metrics (the intervals) to use for the X and Y-axes. Intui- tively, we can imagine that this function would be the diagonal that splits the Ist quadrant in 2 parts of 45°, as shown in the picture below: The intervals are labeled as s1, s2,...,s10, meaning that each point represents an input string and s(n)< s(n+1). However, we don’t know, for example, whether the input string “ASER” is less than (or greater than) the string “ATER”. We need to define a method to associate a unique number to a string and a method to de- duce the string that corresponds to that num- ber. The first thing that comes to mind is to number the single string elements progressively. If, for example, we suppose that the single elements that compose our input/output strings shall be the first three letters of the alphabet, ‘A’, ‘B’ and ‘C’, we can compile the following table: Fig 1: Identity Function Graph Example ... and Possible Applications for Black-Box (Functional) Software Testing
  • 3. 59The Magazine for Professional Testerswww.testingexperience.com Table 1: Association of string with numbers The table should be read in this way: number 1 is linked to string “A”, number 2 is linked to string “B”,..., number 46 is linked to string “AACA” and so on. Clearly, it’s possible to go on indefinitely to compile the table above. We need to define a rule to calculate the corresponding number from the string. The rule is as follows: Start with the base association of string with number: Number String 1 A 2 B 3 C Table 2: Association of Base String with numbers As a hypothesis, we will suppose that all strings considered must come from any com- bination of the base letters {A,B,C} which in the following we will call the dictionary. So, string “ACABCCAACC” is valid, while string “ASDFGHAAABBCRR” is not valid, because it contains the elements S,D,F,G,R that are not in the defined dictionary. The rule is expressed in the following formula, which for now we will describe by example (and we will explain later in detail). (2.2)AABC = 1*33 + 1*32 + 2*31 + 3*30 = 1*27 + 1*9 + 2*3 +3*1 = 45 This is exactly the number that we find for string “AABC” in Table 1 above. If we exam- ine the method of obtaining a value for string “AABC” it’s evident that it’s very similar to the way that numbers are usually transformed into base 2, 8 or 16 or any other base into deci- mal. So, there’s nothing new or magic about it. The number “3” we have used in our formula is simply the base of the dictionary, or, in other words, the number of base elements in the dic- tionary {A,B,C} is exactly equal to three. This method can be extended for dictionar- ies with any number of elements. The higher the number of elements in the dictionary, the greater will be the number we deduce for “short strings” (whereby “short strings” means strings with a low number of base elements). It’s a little trickier to find the “opposite rule”, i.e. the rule to transform a generic number into a string composed only of elements of some well defined dictionary. For now, we introduce the rule and apply it with an example: Divide the number for the base of the dic-1. tionary, considering both the result of the division and the remainder of the divi- sion. For example, for dictionary {A,B,C} the base is 3, as previously stated. If the remainder is zero, subtract 1 from2. the result and replace the remainder num- ber with the base. If the result is greater than or equal to the3. base, continue with the division, applying rules (1) and (2) until the result is zero. In our example, this will happen just af- ter we have found a result of the division that is less than 3 and after exactly 4 it- erations. Write down the string composed by the4. remainder of the division, starting from the last, and written sequentially. Replace the number in the string, which5. was derived as described in point (4), with the letter in the base association string to number of the dictionary (see Table 2). To explain this in more detail, we will use the number 45 as an example to verify whether the rule is correct. We will expect to find string “AABC”, using the dictionary {A,B,C}. Here is an example of the algorithm’s applica- tion: 45/3 = 15 remainder 0. Subtract 1 from1. 15: 15-1 = 14 that is greater than 3, so we have to continue. Replace the remainder 0 with 3. 14/3 = 4 remainder 2. No need to sub-2. tract. 4 is greater than 3, continue. 4/3 = 1 remainder 1. The result is less3. than 3. One division more and then we will stop. 1/3 = 0 remainder 1. Stop here.4. So, starting from the last remainder (step #4) and continuing with the other remainders , we have found the numeric string “1123”, and us- ing the table in Fig. 2.3 we can now replace the numbers with letters as follows: 1 → A 2 → B 3 → C In this way, the numeric string “1123” becomes “AABC”, which is the string corresponding to the number 45 in the Table 1. In the following paragraph, mathematical proof of these rules is presented. Mathematical proof of the rules3. First of all, we will start with some useful defi- nitions, as used before: A1. dictionary is a collection of elements a1,a2,...,an composing the string. It’s written as follows: D{a1,a2,...,an}. A2. base of the dictionary D is a number equal to the number of elements of the dictionary. A string is3. valid with regard to diction- ary D if it’s composed exclusively by ele- ments of D. It’s not valid if there is at least one element that does not belong to dictionary D. The4. length of a string is a number equal to the number of elements the string is composed of. The5. numbers equivalent to the diction- ary’s elements (in the following NEDE) are defined by a matrix as follows: NEDE Element a1 = 1 a1 a2 = 2 a2 a3 = 3 a3 ... ... ap = p ap Table 3: Association of Base String with numbers It is presumed that all a where j=(1,2,...,L) are not zero. This is a fundamental hypothesis for what follows. Please, note that all aj for all j=(1,2,...,L) are strictly less than base B of the dictionary. The first role does not have to be proven, but must be taken as a definition of the algorithm used to associate a number to a string. So, we can state the following: Definition #1: Given a dictionary D, it’s pos- sible to associate an unique number N0 to any valid string a1a2a3,…aL for this dictionary by applying the following rule: (3.1) N0 = LL L LL BBBBB aaaaa ++=+++ −−−− ...... 2 2 1 1 02 2 1 1 L LL L LL BBBBB aaaaaa +++=+++ −−−− ...... 2 2 1 1 02 2 1 1 because 10 =B Number String Number String Number String Number String 1 A 13 AAA 25 BBA 37 CCA 2 B 14 AAB 26 BBB 38 CCB 3 C 15 AAC 27 BBC 39 CCC 4 AA 16 ABA 28 BCA 40 AAAA 5 AB 17 ABB 29 BCB 41 AAAB 6 AC 18 ABC 30 BCC 42 AAAC 7 BA 19 ACA 31 CAA 43 AABA 8 BB 20 ACB 32 CAB 44 AABB 9 BC 21 ACC 33 CAC 45 AABC 10 CA 22 BAA 34 CBA 46 AACA 11 CB 23 BAB 35 CBB 47 AACB 12 CC 24 BAC 36 CBC 48 ...
  • 4. 60 The Magazine for Professional Testers www.testingexperience.com Where B is the dictionary’s base and aj is the numerical equivalent to the generic elements aj of the dictionary, where j=(1,2,...,L) and L is the length of the string. Starting from this definition, it’s possible to deduce the rule for transforming a generic number into a string composed only by ele- ments of the dictionary. If we start dividing the number N0 by base B, we will obtain: (3.2) B BB B N L L LL a aaa ++++= − −− 1 3 2 2 1 0 ... With the position: (3.3) 1 3 2 2 11 ... − −− +++= L LL BBN aaa We have: (3.4) B N B N La += 1 0 that is equivalent to LBNN a+= 10 Continuing in this way, we obtain: LBNN a+= 10 121 −+= LBNN a 232 −+= LBNN a (3.5) ......... 212 a+= −− BNN LL 11 a=−LN 0=LN From the last equation in (3.5), i.e. NL-1 = a1 it should be evident that if we start from equation (3.1), we divide N0 by B(L-2) . For a better un- derstanding, an example is given below where we apply (3.5) for the case where L = 4. Start with: 43 2 2 3 10 aaaa +++= BBBN Put: 32 2 11 aaa ++= BBN we have: 410 a+= BNN (3.5 ex) Put: 212 aa += BN we have: 321 a+= BNN Put: 13 a=N we have: 232 a+= BNN Put: 04 =N we have: 1143 aa ≡+= BNN In the example L = 4, (L-1) = 3. The next N4 value is exactly equal to 0 (zero), because we divide N3 (that is less than B) by B, obtaining 0 with remainder N3 = a1 . We have to stop the process at this point. Remember that we have supposed that all aj where j=(1,2,...,L) are not zero. In formula (3.5), the aj where j=(1,2,...,L) are the remainder of the subsequent division of number N0 for the base of the dictionary, while the Nj where j=(1,2,...,L) are the results of the division. From the above discussion we can deduce the following rule to extract from a number N0 a string of length L composed only of elements from a given dictionary D{a1 ,a2 ,...,an }. Define the dictionary and the number-1. equivalent elements. Divide number N2. 0 for the base B of the dictionary, considering both the result of the division and the remainder of the di- vision, and continue in this way until the result of the division is zero. This hap- pens after L steps. Starting from the last remainder create a3. string composed by the remainders of the divisions. Consider the remainders of the divisions4. as the numbers equivalent to the diction- ary’s elements, and replace these num- bers with the equivalent elements of the dictionary, using the “NEDE” table. Now, all this works fine as long as we find only remainders of the divisions that are non zero. However, what happens if the remainders of the division are zero? We will use the following simple tip. If the re- sult of the division of X through Y is exactly N, with remainder 0 (zero), it can also be writ- ten as follows: (3.6) N Y N = remainder )1(0 −=→ N Y X remainder Y In other words, the result of Y X should be also be considered as equal to N-1 with re- mainder Y. For example: 15/5 = 3 remainder 0, but it’s also 15/5 = 2 with remainder 5. So, if we found some aj equal to zero in the division process in (3.5), we now apply the tip and replace the result with (result -1) and the remainder with the base B of the dictionary. This results in the following formula: (3.7) rrr a+= −− BNN LL with 0=ra means: BNN LL rr −− = In other words: (3.8) BBNBNN LLL +−== −−− )1( rrr This formula demonstrates the tip explained above. Summary of the rules4. In this paragraph, we will summarize the re- sults obtained above and define the rules for transforming a string into a number and, vice versa, a number into a string, with reference to a given dictionary. Rule #1: Transform a string into a number. Define the dictionary and the elements of1. the dictionary. The elements in the string must only be composed of any combina- tion of elements of the selected diction- ary. Define the NEDE (numerical equivalents2. to dictionary elements) matrix Apply the following formula:3. L LL BBN aaa +++= −− ...2 2 1 10 Where B is the dictionary’s base and aj is the numerical equivalent for the generic elements of the dictionary, where j=(1,2,...,L) and L is the length of the string. N0 is the number corresponding to string “a1 a2 ...aL ”, that was searched. Rule #2: Transform a number into a string. Define the dictionary and the numerical1. equivalents. Divide number N2. 0 for the base B of the dictionary, considering both the result of the division and the remainder of the division; in each subsequent division re- place the dividend with the result of the previous division, and continue in this way until the result of the division is zero. This happens after L steps, where L is the length of the string. If during execution of the steps described3. in point 2, you find a remainder equal to zero, replace the result with (result -1) and the remainder 0 with the base B of the dictionary. Starting from the last remainder, create a4. string composed by the remainders of the divisions. Consider the remainders of the divisions5. as the numerical equivalents to the dic- tionary’s elements and replace these numbers with the equivalent elements of the dictionary, using the “NEDE” table.
  • 5. 61The Magazine for Professional Testerswww.testingexperience.com We train in Latin America - ISTQB Certified Tester Training contact@bicorp.biz ©iStockphoto
  • 6. 62 The Magazine for Professional Testers www.testingexperience.com The resulting string is the one that was searched and corresponds to number N0 . Software implementation of the5. rules I have prepared two Perl scripts that imple- ment both processes described. Rule #2 de- scribed above is suitable to be implemented in a recurring way using Perl (or your favorite programming language), but I prefer to strictly follow the process described to be sure that it will work correctly. All the scripts can be downloaded from link: http://www.bertadanilo.netsons.org/, or direct- ly from: http://www.bertadanilo.netsons.org/ Upload/perl_TestingExperience.zip. Another Perl script was built with the purpose of generating the mathematical-equivalent function of some software routine. I took as an example the (very simple) routine that pro- duces as output the reverse of the string it has taken as input. All these scripts were prepared with the sole purpose of providing a “proof of concept”. In the following, there is a brief explanation of how they work. All the scripts are released as is, under GPL License. Script #1. This script, called StringToNum- ber.pl implements rule #1. It takes as input a string and a dictionary in the form of an ar- ray of chars separated by spaces, and returns the numerical equivalent to the input string, as per rule #1 explained above. To run the script, from DOS or *IX system, you need to run the following command: perl StringToNumber.pl <input string> <dictionary> For example: perl StringToNumber.pl ABECDEADD “A B C D E” which returns the number 637549 You can avoid having to explicitly call the “perl” interpreter before the script name if you give the execution permission (chmod +x StringToNumber.pl) on *IX system to the script. In Windows, it depends on how your system is configured. I will not bother you any further with these details. A DOS script called runStringToNumber.bat could also be used to run the script (avoiding having to bore yourself with writing the dictionary, which is usually fixed), passing only the string input pa- rameters, as follows: runStringToNumber.bat ABECDEADD Script #2. This script, called NumberTo- String.pl implements rule #2. It takes as in- put a number and a dictionary in the form of an array of chars separated by spaces, and returns the numerical equivalent to the input string, as per rule #2 explained above. To run the script, from DOS or *IX system, you need to run the following command: perl NumberToString.pl <input number> <dictionary> For example: perl NumberToString.pl 637549 “A B C D E” which returns the string: ABECDEADD. The same considerations as for script #1 are valid for this one. A DOS script called runNumber- ToString.bat could also be used to run the script (avoiding having to bore yourself with writing the dictionary, which is usually fixed), passing only the string input parameters, as follows: runNumberToString.bat 637549 Script #3. This script, called EvaluateFunc- tion.pl implements both of the rules. It takes as input a dictionary in the form of an array of chars separated by spaces, and returns the ta- ble of the results of the function that should be used to plot the Cartesian diagram of that same function. The function is written in the code. In detail, to use the script you will need to: Personalize the function to generate the• data in order to plot in the main routine of the program. As a default, the function is the “string reverse” that produces as output the reversed input string. For ex- ample: ABC becomes CBA. Call the program as follows:• perl EvaluateFunction.pl <dic- tionary> <number of point> The output will be a table of data (separated by tabs) with <number of point> points with the x input string and y output string and equivalent numerical value of the software function. For example, the output of command perl EvaluateFunction.pl “A B C D E” 10 will be a table of 10 values as follows: X num Y num X num Y num 1 1 A A 2 2 B B 3 3 C C 4 4 D D 5 5 E E 6 6 AA AA 7 11 AB BA 8 16 AC CA 9 21 AD DA 10 26 AE EA Table 4: Example The plot of the “string reverse” func-6. tion The first column is the X input numerical equivalent of the input strings in the third col- umn, while the second column is the Y output numerical equivalent of the output strings in the fourth column (that is the real output of the reverse string function, or whatever function you decide to call). These scripts were tested on Perl version v5.10.0 built for MSWin32-x86-multi-thread for the Windows Vista operating system, and Perl version v5.8.8 built for i486-linux-thread- multi on debian version (Kurumin). These are not really intended to control the formal valid- ity of the inputs used (wrong numerical format, wrong dictionary format, and so on); therefore please take care to use the right format, other- wise the result cannot be guaranteed. Now, at last, we will attempt to plot a Carte- sian diagram of a software function that works with a list of symbols (strings). To keep the task simple, we have decided to consider the reverse string function. Using the command perl EvaluateFunction.pl “A B C D E” 100 > out.txt we have in file out.txt a table of 100 points that can be used to plot the “reverse string” function. For this purpose, you may use your favorite spread sheet or any other software you usually use to draw graphs. The plot looks like Graph 1. The Y axis shows the numbers and not the Y- string value, to make the graph easier to man- age. Considering that the function is simply a “reverse string” it is easy to imagine the cor- responding string value of the Y interval num- ber. A graph with more points (in this case 500 points), but with fewer details, is shown be- low. The graph with 10000 points looks like Graph 3. Conclusions:Whatdoesallthishave7. to do with software testing? So, we have probably found a method to “re- duce” a software routine into a mathematical function. Clearly, what we have described can “easily” be further generalized. What does all this have to do with testing? At the current moment absolutely nothing; the main idea, as you can guess, is the following: if we know what the mathematical equivalent function behind the software routine under test is, we can easily “test it” under a (small or large) sample of input testing points (the “X” axis). Now, the problem is that nobody (also, and in particular, no one who wrote the software) knows of the function. I think that nobody knows the profile of the “reverse string” func- tion graphics presented above, or that the “re- verse string function” is a well-known and
  • 7. 63The Magazine for Professional Testerswww.testingexperience.com widely used feature in a lot of software pro- grams. So, one might ask what this method could be useful for? It could be useful in regression test- ing, in particular for the testing of single soft- ware components and for the test of (probably huge) amounts of database data, especially for systems that cannot be easily accessed, for ex- ample, systems who are located in different, non-integrated environments and for which access to the data for the software under test can only be produced only by extraction (e.g. in CSV format). In regression testing you can use the information collected during the “first test run” to clearly define the expected behav- ior of the function under test. You can there- fore transform it into a numeric function (one or more functions) and keep it as reference for the other entire regression test or retest. The advantages are: You collect input and expected outputa. data in numerical format. Knowing the numerical input and output data, you can at any time recalculate the inputs and out- puts needed for the software routine (see NumberToString.pl proof of the concept script). Clearly, you must also save the dictionary used in the transformation. After you have run the software on theb. input data, you can transform the real output data into a table of numbers and draw the “real function”. This function must then be compared with the “ex- pected function” (i.e. performing a point- by-point comparison between the two functions). If any differences between the two are found, these can be analyzed. The operation can be easily done using any mathematical software that can draw graphics. For example, to keep things simple, if you enter users onto a system and would like to verify that all the users’ fields are correctly loaded onto the database, you can proceed as follows: Prepare the file with the data to be load-1. ed. Transform all the columns for which you2. want to verify correct entry into the ex- pected functions. Load the data using the software under3. test Extract the loaded data from the data-4. base and transform it into a function (i.e. a real function, which expresses the real software behavior); then compare the two functions. This has been done for the first time. For the following test, you can automatize the process. Starting from the input and output numbers (which you saved in the first run), you proceed as follows: Extract the input strings from the inputa. numeric data and from the dictionary. Run the software on the inputs and getb. Graph 1: Shape Graph 2: Shape Graph 3: Shape
  • 8. 64 The Magazine for Professional Testers www.testingexperience.com Berta Danilo graduated in Physics at Turin University (Italy) in 1993 and first started to work as a Laboratory Technician, but soon he switched to the software field as an employee of a consultancy company working for a large number of customers. Throughout his career, he worked in banks as Cobol developer and analyst, for the Italian treasury, the Italian railways (structural and functional software test), as well as for an Italian automotive company, the European Space Agency (creation and test of scientific data files for the SMART mission), telecommunication companies, and the national Italian television company. This involved work on different kinds of automation test projects, software analysis and development projects. With his passion for software development and analysis – which is not just limited to testing – he has written some articles and a software course for Italian specialist magazines. His work gives him the possibility to deal mainly with software testing; he holds both the ISEB/ISTQB Foundation Certificate in Software Testing and the ISEB Practitioner Certificate; he is a regular member of the British Computer Society. Currently, he works as Test Manager for an Italian Editorial Company. Biography the outputs; transform the outputs into numbers and draw the function(s). Compare the expected output (numbers)c. with the real output (numbers) and find the differences (if any). Clearly, there will be no major differences if we compare this method with a more tradi- tional “string comparator”. With this method, you will probably not have to develop new “comparator software” to perform a particular comparison, because all you need is software that can draw graphics starting from a table of (x;y) values (or also for more variables). Acknowledgements I’m grateful to my friend and colleague Gian- maria Gai for the help he has given me when I wrote this article: he also suggested that I include some references. The problem is that there aren’t any. The subject occurred to me one day when I was reading a (very bor- ing) functional analysis for some software. I thought along the lines: “Wouldn’t it be nice if we could reduce a big analysis into some mathematical functions! How we can do this? “... If any reader knows about some other articles and/or books on similar methods, please let me know.