Java News Brief (JNB): The Framework for Integrated Tests (Fit)
If you have heard about Fit for some time, but never had the time to investigate it, then this month's JNB article is for you.
The idea is very simple.
Your write your test scripts in HTML:
<table border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;" colspan="2" rowspan="1">ValidateCustomerName</td>
</tr>
<tr>
<td rowspan="1" colspan="1">
<span style="font-style: italic;">customer name</span>
</td>
<td rowspan="1" colspan="1">
<span style="font-style: italic;">valid()</span>
</td>
</tr>
<tr>
<td rowspan="1" colspan="1">
</td>
<td rowspan="1" colspan="1">error</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Mario</td>
<td rowspan="1" colspan="1">true</td>
</tr>
</tbody>
</table>
which looks like this in a browser:
| ValidateCustomerName | |
| customer name | valid() |
| error | |
| Mario | true |
You run the thing:
[prompt] $ java fit.FileRunner tests.html report.html
And depending on if your code is right or wrong, you get either an all green report card:
| ValidateCustomerName | |
| customer name | valid() |
| null | error |
| Mario | true |
or worse (from a different test):
| check | customer total balance |
$135.00 expected $35.00 actual |
You have to write a few Java classes along the way. But those are trivial, right? :)