Script table
If the tables described above are single-step and single-method tables. Script table is a series of multi-step operations, as the name represents.
The first entry in the header is followed by a script: prefix, or a script, followed by a cell as the class name. The following is the construction parameter. Each row of the following rows represents an operation. The following operation types are allowed: Execution method, check result, and display output.
The execution method includes the method name and parameters. The amazing design is that the method name and parameters can be staggered into the table. In my example below, this is a method in code is combined from columns 1, 3, and 5, and columns 2, 4, and 6 are parameters. Another method is better suited to the normal habits-put the method name (followed by one;) in the first column, and put parameters in sequence.
The check result uses four phrases as the content of the first column: Check, check not, ensure, reject, the returned results are the same as the table content, different from the table content, true returned, and false returned.
Show words are used for display output. In the first column, the method name and parameters are followed. This line only shows that the output is not verified. Therefore, an extra column is displayed in the result table.
Example:
Script: script.zjc.com. scriptdemo |
Zjc |
20 |
This is |
10 |
A Method |
20 |
In code |
30 |
Check |
Get age |
80 |
This is a method in code; |
15 |
25 |
35 |
Check not |
Get age |
200 |
Show |
Get name |
5 |
Reject |
Reject Method |
5 |
Fixture:
package script.zjc.com;public class ScriptDemo {private String name;private int age;public ScriptDemo(String name,int age){this.name=name;this.age=age;}public void thisIsAMethodInCode(int a,int b,int c){age=age+a+b+c;}public int getAge(){return age;}public String getName(int a){return name;}public boolean rejectMethod(int a){return false;}}
In my opinion, script table and demo-table are the two most important types of tables. demo-table can implement most data verification, while script table can be used together with other tools, implement many amazing functions that exceed expectations.
Fitnesse Series 5