-
Notifications
You must be signed in to change notification settings - Fork 0
Home
In SQLite Runner, tests should be written in YAML format.
Test type should be: datasets
, query
, final_dataset
or display
.
This type need explicit expected results.
type: datasets
seed: |
INSERT INTO table VALUES ('dato 1');
INSERT INTO table VALUES ('dato 2');
expected: |
id|descrip
1|dato 1
2|dato 2
-
seed
: (optional) If you need to insert extra data before check student's solution -
expected
: (required) You have to set explicit expected solution. When student's query is executed, returned data will be compared with your expected data. It's important to set table headers. This expected dataset is on SQLite output format with.headers on
This type need a query as solution.
type: query
seed: |
INSERT INTO table VALUES ('dato 1');
INSERT INTO table VALUES ('dato 2');
expected: SELECT * FROM table;
-
seed
: (optional) If you need to insert extra data before check student's solution -
expected
: (required) You have to set a query as solution. That query will return a dataset wich will be compared with dataset resulting from executing student query. The comparision is over results not query string. That means that, for example, in atable<id, name>
, queriesSELECT * FROM table;
andSELECT id, name FROM table;
are equivalent.
This type of test was designed to use at "NON SELECT" statements. When exercise pretends any modification over table, there is no data resulting. To test exercise, at least for now, we need data to be compared. With this type you could provides expected dataset resulting of execute your final query after student code.
Suppose that exercise have a table<id, descrip>
and in seed you inserts "data 1" and "data 2". And you request that
student insert a new row with name "data 3".
Then, student code should be something like INSERT INTO table values ('data 3');
. So, runner will execute that insert and then your query. This data will be compared with your expected data.
type: final_dataset
seed: |
INSERT INTO table VALUES ('data 1');
INSERT INTO table VALUES ('data 2');
final: SELECT * FROM table;
expected: |
id|descrip
1|dato 1
2|dato 2
3|dato 3
-
seed
: (optional) If you need to insert extra data before check student's solution -
final
: (required) Select statement to be executed after student code, used for verification. -
expected
: (required) Data result expected after student code modification.
This type of test was designed to use at "hidden" exercises. When you like to show something to student but you don't need that student wrote code.
type: display
seed: |
INSERT INTO table VALUES ('data 1');
INSERT INTO table VALUES ('data 2');
query: SELECT * FROM table;
-
seed
: (optional) If you need to insert extra data before check student's solution -
query
: (required) This query will be executed and will generate a dataset that will be shown as a solution.