-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
schema: Update to allow sequences of inputs/expect
References #9
- Loading branch information
Showing
5 changed files
with
144 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: "Sequence of inputs/expect, for testing stateful component" | ||
topic: "DummyComponent" | ||
cases: | ||
- | ||
name: 'correct data using spacy notation' | ||
assertion: 'should pass' | ||
inputs: # NOTE: should only sequence for stateful components. Normally use multiple testcases instead | ||
- | ||
in: true | ||
- | ||
in: false | ||
expect: | ||
- | ||
out: | ||
equals: true | ||
- | ||
out: | ||
equals: false | ||
- | ||
name: 'correct data using compact notation' | ||
assertion: 'should pass' | ||
inputs: | ||
- { in: 1000 } | ||
- { in: 1001 } | ||
expect: | ||
- { out: { equals: 1000 } } | ||
- { out: { equals: 1001 } } | ||
|
||
|
||
# Failing cases | ||
- | ||
name: 'mismatch between number of inputs and expect' | ||
assertion: 'should fail' | ||
inputs: | ||
- { in: 1000 } | ||
expect: | ||
- { out: { equals: 1000 } } | ||
- { out: { equals: 1001 } } | ||
- | ||
name: 'first output in sequence wrong' | ||
assertion: 'should fail' | ||
inputs: | ||
- { in: 1000 } | ||
- { in: 1001 } | ||
expect: | ||
- { out: { equals: 42 } } | ||
- { out: { equals: 1001 } } | ||
- | ||
name: 'second output in sequence wrong' | ||
assertion: 'should fail' | ||
inputs: | ||
- { in: 1000 } | ||
- { in: 1001 } | ||
expect: | ||
- { out: { equals: 1000 } } | ||
- { out: { equals: 42 } } | ||
- | ||
name: 'all outputs in sequence wrong' | ||
assertion: 'should fail' | ||
inputs: | ||
- { in: 0 } | ||
- { in: 1 } | ||
expect: | ||
- { out: { equals: 2 } } | ||
- { out: { equals: 3 } } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"id": "outputdata.json", | ||
"$schema": "http://json-schema.org/draft-04/schema", | ||
"title": "Output data", | ||
"description": "Data expected in a testcase.\nEach key refers to a port, and the value is a description of the expected message on that port.\nThere can be one expectation (check) on each message, or an array of them.\n", | ||
"type": "object", | ||
"items": { | ||
"oneOf": [ | ||
{ | ||
"$ref": "expectation.json" | ||
}, | ||
{ | ||
"$ref": "expectations.json" | ||
} | ||
] | ||
}, | ||
"required": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
id: outputdata.json | ||
"$schema": "http://json-schema.org/draft-04/schema" | ||
title: Output data | ||
description: | | ||
Data expected in a testcase. | ||
Each key refers to a port, and the value is a description of the expected message on that port. | ||
There can be one expectation (check) on each message, or an array of them. | ||
type: object | ||
items: | ||
oneOf: | ||
- "$ref": "expectation.json" | ||
- "$ref": "expectations.json" | ||
required: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters