Hi,
a colleage gave me a hint to first specifiy tests in form of an excel
table where the rows defines the relation of the input and output of the
functions. I think you all know this:
class Multiplier {
public int times(int a, int b)
}
a b -> expectedResult
0 0 0
0 1 0
0 2 0
1 0 0
1 1 1
1 2 2
2 0 0
2 1 2
2 2 4
From this specification you can derive testcases. I have done this
using TestNG with a dataprovider.
All these steps have to be done manually but can be done automatically.
One only have to narrow the datatype, since the size of int is to large,
then a tool can automatically derive the table above. After the table is
created one has to define the expected results. From this data one can
automatically derive a test:
public void test(int a, int b, int expectedResult) {
Multiplier m = new Multiplier(),
int result = m.times(a, b);
Assert.assertEquals(result, expectedResult);
}
I haven't found a tool for this use case, so I write to this mailing
list, and want to know if it could be an interesting project.
Greetings,
Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: labs-unsubscr...@labs.apache.org
For additional commands, e-mail: labs-h...@labs.apache.org