Skip to content
Leandro Di Lorenzo edited this page Dec 30, 2017 · 3 revisions

Welcome to the Wiki of Mumuki SQLite Runner!

Types of Tests

In SQLite Runner, tests should be written in YAML format.

Test type should be: datasets, query, final_dataset or display.

Datasets

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

Query

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 a table<id, name>, queries SELECT * FROM table; and SELECT id, name FROM table; are equivalent.

Final Dataset

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.

Display

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.