Skip to content

Add workflow recommendations and templates #1722

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Oct 21, 2020
Merged
163 changes: 87 additions & 76 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,83 +51,90 @@ Test data can be incorporated into a track's test suites manually or extracted b
The file format is described in [canonical-schema.json](./canonical-schema.json), but it is easier to understand with an example:

```json
{ "exercise": "foobar"
, "comments":
[ " Comments are always optional and can be used almost anywhere. "
, " "
, " They usually document how the exercise's readme ('description.md') "
, " is generally interpreted in test programs across different "
, " languages. "
, " "
, " In addition to a mainstream implementation path, this information "
, " can also document significant variations. "
]
, "cases":
[ { "comments":
[ " A test case must have 'uuid', 'description', 'property', "
, " 'input' and 'expected' properties. The rest is optional. "
, " "
, " The 'property' is a string in lowerCamelCase identifying "
, " the type of test, but most of the times it is just the "
, " name of a function being tested. "
, " "
, " Test cases can have any number of additional keys, and "
, " most of them also have an 'expected' one, defining the "
, " value a test should return. "
]
, "uuid" : "31e9db74-86b9-4b14-a320-9ea910337289"
, "description": "Foo'ing a word returns it reversed"
, "property" : "foo"
, "input" : {
"word" : "lion"
}
, "expected" : "noil"
}
, { "uuid" : "09113ce5-b008-45d0-98af-c0378b64966b"
, "description": "Bar'ing a name returns its parts combined"
, "property" : "bar"
, "input" : {
"firstName" : "Alan",
"lastName" : "Smithee"
{
"exercise": "foobar",
"comments": [
" Comments are always optional and can be used almost anywhere. ",
" ",
" They usually document how the exercise's readme ('description.md') ",
" is generally interpreted in test programs across different ",
" languages. ",
" ",
" In addition to a mainstream implementation path, this information ",
" can also document significant variations. "
],
"cases": [
{
"comments": [
" A test case must have 'uuid', 'description', 'property', ",
" 'input' and 'expected' properties. The rest is optional. ",
" ",
" The 'property' is a string in lowerCamelCase identifying ",
" the type of test, but most of the times it is just the ",
" name of a function being tested. ",
" ",
" Test cases can have any number of additional keys, and ",
" most of them also have an 'expected' one, defining the ",
" value a test should return. "
],
"uuid": "31e9db74-86b9-4b14-a320-9ea910337289",
"description": "Foo'ing a word returns it reversed",
"property": "foo",
"input": {
"word": "lion"
},
"expected": "noil"
},
{
"uuid": "09113ce5-b008-45d0-98af-c0378b64966b",
"description": "Bar'ing a name returns its parts combined",
"property": "bar",
"input": {
"firstName": "Alan",
"lastName": "Smithee"
},
"expected": "ASlmainthee"
},
{
"comments": [
" Test cases can be arbitrarily grouped with a description ",
" to make organization easier. "
],
"description": "Abnormal inputs: numbers",
"cases": [
{
"uuid": "f22d7a03-e752-4f14-9231-4eae9f128cef",
"description": "Foo'ing a number returns nothing",
"property": "foo",
"input": {
"word": "42"
},
"expected": null
},
{
"uuid": "8790a635-e8a8-4343-a29f-7da2929b9378",
"description": "Foo'ing a very big number returns nothing",
"optional": "big-ints",
"comments": ["Making this test case pass requires using BigInts."],
"property": "foo",
"input": {
"word": "28948022309329048855892746252171976962977213799489202546401021394546514198529"
},
"expected": null,
"scenarios": ["big-integers"]
},
{
"uuid": "c7b6f24a-553f-475a-8a40-dba854fe1bff",
"description": "Bar'ing a name with numbers gives an error",
"property": "bar",
"input": {
"firstName": "HAL",
"lastName": "9000"
},
"expected": { "error": "You should never bar a number" }
}
, "expected" : "ASlmainthee"
}
, { "comments":
[ " Test cases can be arbitrarily grouped with a description "
, " to make organization easier. "
]
, "description": "Abnormal inputs: numbers"
, "cases":
[ { "uuid" : "f22d7a03-e752-4f14-9231-4eae9f128cef"
, "description": "Foo'ing a number returns nothing"
, "property" : "foo"
, "input" : {
"word" : "42"
}
, "expected" : null
}
, { "uuid" : "8790a635-e8a8-4343-a29f-7da2929b9378"
, "description": "Foo'ing a very big number returns nothing"
, "optional" : "big-ints"
, "comments" : [ "Making this test case pass requires using BigInts." ]
, "property" : "foo"
, "input" : {
"word" : "28948022309329048855892746252171976962977213799489202546401021394546514198529"
}
, "expected" : null
, "scenarios" : [ "big-integers" ]
}
, { "uuid" : "c7b6f24a-553f-475a-8a40-dba854fe1bff"
, "description": "Bar'ing a name with numbers gives an error"
, "property" : "bar"
, "input" : {
"firstName" : "HAL",
"lastName" : "9000"
}
, "expected" : { "error": "You should never bar a number" }
}
]
}
]
}
]
}
```
Expand Down Expand Up @@ -257,3 +264,7 @@ yarn run test-one exercises/<exercise>/canonical-data.json
```

Replace `<exercise>` by the name of exercise which you want to check.

## Github Action Workflows

See [`workflows/README.md`](./workflows/README.md)
Loading