Fitnesse Series 4

Source: Internet
Author: User

Query tables, subquery tables, and ordered query tables

The header still needs to be marked. There is nothing to say. A parameter column is usually constructed to provide query conditions (which can be omitted ). In the fixture code, you must note that there must be a query method without parameters. The return value is list. This list is a complex set of three-tier lists, corresponding to tables, rows, and fields. The oral expression is not clear, but you should check the following code. The returned results are compared with the data on the page. Query tables are suitable for verifying the query results of relational databases.

Query: qt.zjc.com. querytable 123456
Name Age Job Salary
Zjc 99 Worker 1000000
The Code is as follows:

public class QueryTable {private int salary;private List table;public QueryTable(int s){this.salary=s;}public List query(){table=new ArrayList();ArrayList row=new ArrayList();ArrayList field1=new ArrayList<String>();ArrayList field2=new ArrayList<String>();ArrayList field3=new ArrayList<String>();ArrayList field4=new ArrayList<String>();field1.add("name");field1.add("zjc");row.add(field1);field2.add("age");field2.add("99");row.add(field2);field3.add("job");field3.add("worker");row.add(field3);field4.add("salary");field4.add("1000000");row.add(field4);table.add(row);return table;}}
As you can see, constructing this list structure is rather cumbersome. Of course, I am just an example here. Actually, it must be a loop operation. Even so, I think we can find some simpler ways to achieve the same purpose, such as using a decision table. The test code should be as simple and clear as possible, and should not contain complex operations and business logic. Otherwise, it is not worth the candle to determine whether the problem is caused by the Business Code or the test code, this is my opinion. Therefore, I personally think that the query table is not widely used, so I will write the subquery table and the ordered query table together.

The format of the subquery table and the ordered query table is the same as that of the query table. According to the document, the method of querying a table is to contain the results of the specified existence. I did not find any difference in the verification. The ordered query table means that the results are compared in order, the content is correct, and the order is wrong. It is also considered a test failure.

Fitnesse Series 4

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.