You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
3. docker run --name logictest --rm --network host datafuselabs/sqllogictest:latest
61
67
68
+
## How to write logic test
69
+
70
+
Fast start, you can follow this demo: https://github.com/datafuselabs/databend/blob/main/tests/logictest/suites/select_0
71
+
72
+
Runner supported: mysql handler, http handler, clickhouse handler.
73
+
74
+
- ok
75
+
- Returns no error, don't care about the result
76
+
- error
77
+
- Returns with error and expected error message, usually with an error code, but also with a message string; the way to determine whether the specified string is in the returned message
78
+
- query
79
+
- Return result and check the result with expected, follow by query_type and query_label
80
+
- query_type is a char represent a column in result, multi char means multi column
81
+
- B Boolean
82
+
- T text
83
+
- F floating point
84
+
- I integer
85
+
- query_label If different runner return inconsistency, you can write like this(suppose that mysql handler is get different result)
86
+
87
+
This is a query demo(query_label is optional):
88
+
89
+
```
90
+
statement query III label(mysql)
91
+
select number, number + 1, number + 999 from numbers(10);
92
+
93
+
----
94
+
0 1 999
95
+
1 2 1000
96
+
2 3 1001
97
+
3 4 1002
98
+
4 5 1003
99
+
5 6 1004
100
+
6 7 1005
101
+
7 8 1006
102
+
8 9 1007
103
+
9 10 1008.0
104
+
105
+
---- mysql
106
+
0 1 999
107
+
1 2 1000
108
+
2 3 1001
109
+
3 4 1002
110
+
4 5 1003
111
+
5 6 1004
112
+
6 7 1005
113
+
7 8 1006
114
+
8 9 1007
115
+
9 10 1008
116
+
```
117
+
62
118
## Write logic test tips
63
119
64
120
1. skipif help you skip test of given handler
@@ -91,8 +147,10 @@ select 1;
91
147
```
92
148
93
149
**tips** If you do not care about result, use statement ok instead of statement query
150
+
**tips** Add ORDER BY to ensure that the order of returned results is always consistent
94
151
**warning** A statement query need result, and even if you want to skip a case, you still need to keep the results in the test content
0 commit comments