-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Write system tests and requirements for
lobster-json
- Add a requirement to specify the behavior when the tool is given an input file. - Introduced `System_Requirement_Aspect` to RSL file
- Loading branch information
Showing
50 changed files
with
255 additions
and
67 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 |
---|---|---|
|
@@ -15,3 +15,4 @@ test_install_monolithic | |
.coverage* | ||
*.lobster | ||
*.html | ||
.idea |
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,47 @@ | ||
package json_req | ||
import req | ||
|
||
req.System_Requirement Parse_Input_File { | ||
description = ''' | ||
IF a list element given through the command line option "FILE_OR_DIR" is not a file nor a directory, | ||
THEN the tool shall exit with a non-zero return code. | ||
''' | ||
} | ||
|
||
req.System_Requirement_Aspect Parse_Input_File_JSON_Extension { | ||
description = ''' | ||
OTHERWISE, | ||
if the file extension is not "json" (case-insensitive), | ||
THEN the tool shall print a warning. | ||
Note - The file still will be parsed. | ||
''' | ||
} | ||
|
||
req.System_Requirement_Aspect Parse_Input_File_Valid_JSON { | ||
description = ''' | ||
OTHERWISE, | ||
if the file content is invalid JSON, | ||
THEN the tool shall exit with a non-zero return code. | ||
''' | ||
} | ||
|
||
req.System_Requirement_Aspect Parse_Input_File_Input_Items { | ||
description = ''' | ||
OTHERWISE the input data | ||
SHALL be written in the LOBSTER interchange format | ||
''' | ||
// TODO: This requirement needs more details. | ||
} | ||
|
||
req.System_Requirement_Aspect Parse_Input_File_To_Stdout { | ||
description = ''' | ||
to the file given in the command line option "out", | ||
IF that option is given and is not an empty string, | ||
''' | ||
} | ||
|
||
req.System_Requirement_Aspect Parse_Input_File_To_File { | ||
description = ''' | ||
OTHERWISE to STDOUT. | ||
''' | ||
} |
This file was deleted.
Oops, something went wrong.
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,25 @@ | ||
package json_req | ||
import req | ||
|
||
req.System_Requirement Name_Attribute_Given { | ||
description = ''' | ||
In addition to [[Parse_Input_File]], | ||
IF the command line option "name-attribute" is given and not an empty string, | ||
THEN the tool | ||
SHALL obtain the value from the input item at that key, | ||
and use the obtained value as tag in the serialized LOBSTER item. | ||
''' | ||
} | ||
|
||
req.System_Requirement_Aspect Name_Attribute_Missing { | ||
description = ''' | ||
OTHERWISE, the tool | ||
SHALL create a synthetic tag name based on the path of the JSON input file and an item counter. | ||
|
||
Notes: | ||
- "Synthetic" means that, the name does not need to be related to the data. | ||
- The item counter does not need to be unique across input files, | ||
but it shall be unique at least for each input file separately. | ||
- No further specification is made about how to combine the path and the item counter. | ||
''' | ||
} |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,3 +1,7 @@ | ||
req.System_Requirement { | ||
description = description | ||
} | ||
|
||
req.System_Requirement_Aspect { | ||
description = description | ||
} |
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 |
---|---|---|
@@ -1,2 +1 @@ | ||
!**/expected-output/* | ||
!**/input/* | ||
!**/expected-output/* |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
...-system/lobster-json/rbt-parse-input-file-input-items/outer-and-inner/README.md
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,3 @@ | ||
The input file of this test defines a JSON data struct which has got data items in its | ||
outer-most dictionary, as well as nested items. | ||
According to the requirement only the data items from the outer-most dictionary must be considered. |
1 change: 1 addition & 0 deletions
1
...bster-json/rbt-parse-input-file-input-items/outer-and-inner/expected-output/exit-code.txt
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 @@ | ||
0 |
Empty file.
1 change: 1 addition & 0 deletions
1
.../lobster-json/rbt-parse-input-file-input-items/outer-and-inner/expected-output/stdout.txt
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 @@ | ||
lobster-json: wrote 1 items to output.lobster |
3 changes: 3 additions & 0 deletions
3
tests-system/lobster-json/rbt-parse-input-file-input-items/outer-and-inner/input/args.txt
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,3 @@ | ||
--single | ||
--tag-attribute=something | ||
--out=output.lobster |
25 changes: 25 additions & 0 deletions
25
tests-system/lobster-json/rbt-parse-input-file-input-items/outer-and-inner/input/data.json
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,25 @@ | ||
{ | ||
"outer1": { | ||
"data": [ | ||
{ | ||
"name": "Take this item!" | ||
}, | ||
{ | ||
|
||
"name": "unclear" | ||
} | ||
] | ||
}, | ||
"outer2": { | ||
"data": [ | ||
{ | ||
"name": "Take this item!" | ||
}, | ||
{ | ||
|
||
"name": "unclear" | ||
} | ||
] | ||
} | ||
} | ||
|
3 changes: 3 additions & 0 deletions
3
tests-system/lobster-json/rbt-parse-input-file-input-items/outer-and-inner/tracing.txt
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,3 @@ | ||
# This test verifies these requirements: | ||
Parse_Input_File | ||
Parse_Input_File_JSON_Extension |
2 changes: 2 additions & 0 deletions
2
...-json/rbt-parse-input-file-json-extension/invalid-json-file-extension/README.md
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,2 @@ | ||
The goal of this test is to check if a warning message is printed when the input | ||
file has a non json extension. |
1 change: 1 addition & 0 deletions
1
...parse-input-file-json-extension/invalid-json-file-extension/expected-output/exit-code.txt
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 @@ | ||
0 |
24 changes: 24 additions & 0 deletions
24
...arse-input-file-json-extension/invalid-json-file-extension/expected-output/output.lobster
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,24 @@ | ||
{ | ||
"data": [ | ||
{ | ||
"tag": "json data.invalidjson:data.invalidjson.1", | ||
"location": { | ||
"kind": "file", | ||
"file": "data.invalidjson", | ||
"line": null, | ||
"column": null | ||
}, | ||
"name": "data.invalidjson:data.invalidjson.1", | ||
"messages": [], | ||
"just_up": [], | ||
"just_down": [], | ||
"just_global": [], | ||
"framework": "JSON", | ||
"kind": "Test Vector", | ||
"status": null | ||
} | ||
], | ||
"generator": "lobster-json", | ||
"schema": "lobster-act-trace", | ||
"version": 3 | ||
} |
Empty file.
2 changes: 2 additions & 0 deletions
2
...bt-parse-input-file-json-extension/invalid-json-file-extension/expected-output/stdout.txt
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,2 @@ | ||
<cmdline>: lobster warning: not a .json file | ||
lobster-json: wrote 1 items to output.lobster |
4 changes: 4 additions & 0 deletions
4
...bster-json/rbt-parse-input-file-json-extension/invalid-json-file-extension/input/args.txt
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,4 @@ | ||
--single | ||
--tag-attribute=something | ||
--out=output.lobster | ||
data.invalidjson |
10 changes: 10 additions & 0 deletions
10
...on/rbt-parse-input-file-json-extension/invalid-json-file-extension/input/data.invalidjson
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,10 @@ | ||
{ | ||
"items": { | ||
"data": [ | ||
{ | ||
"name": "Take this item!" | ||
} | ||
] | ||
} | ||
} | ||
|
2 changes: 2 additions & 0 deletions
2
...tem/lobster-json/rbt-parse-input-file-json-extension/mixed-extensions/README.md
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,2 @@ | ||
The goal of this test is to check if a warning message is printed when the input | ||
file has a non json extension. |
1 change: 1 addition & 0 deletions
1
...r-json/rbt-parse-input-file-json-extension/mixed-extensions/expected-output/exit-code.txt
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 @@ | ||
0 |
41 changes: 41 additions & 0 deletions
41
...-json/rbt-parse-input-file-json-extension/mixed-extensions/expected-output/output.lobster
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,41 @@ | ||
{ | ||
"data": [ | ||
{ | ||
"tag": "json data.invalidjson:data.invalidjson.1", | ||
"location": { | ||
"kind": "file", | ||
"file": "data.invalidjson", | ||
"line": null, | ||
"column": null | ||
}, | ||
"name": "data.invalidjson:data.invalidjson.1", | ||
"messages": [], | ||
"just_up": [], | ||
"just_down": [], | ||
"just_global": [], | ||
"framework": "JSON", | ||
"kind": "Test Vector", | ||
"status": null | ||
}, | ||
{ | ||
"tag": "json valid.json:valid.1", | ||
"location": { | ||
"kind": "file", | ||
"file": "valid.json", | ||
"line": null, | ||
"column": null | ||
}, | ||
"name": "valid.json:valid.1", | ||
"messages": [], | ||
"just_up": [], | ||
"just_down": [], | ||
"just_global": [], | ||
"framework": "JSON", | ||
"kind": "Test Vector", | ||
"status": null | ||
} | ||
], | ||
"generator": "lobster-json", | ||
"schema": "lobster-act-trace", | ||
"version": 3 | ||
} |
Empty file.
2 changes: 2 additions & 0 deletions
2
...ster-json/rbt-parse-input-file-json-extension/mixed-extensions/expected-output/stdout.txt
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,2 @@ | ||
<cmdline>: lobster warning: not a .json file | ||
lobster-json: wrote 2 items to output.lobster |
5 changes: 5 additions & 0 deletions
5
...s-system/lobster-json/rbt-parse-input-file-json-extension/mixed-extensions/input/args.txt
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,5 @@ | ||
--single | ||
--tag-attribute=something | ||
--out=output.lobster | ||
data.invalidjson | ||
valid.json |
13 changes: 13 additions & 0 deletions
13
.../lobster-json/rbt-parse-input-file-json-extension/mixed-extensions/input/data.invalidjson
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,13 @@ | ||
{ | ||
"items": { | ||
"data": [ | ||
{ | ||
"name": "Take this item!" | ||
}, | ||
{ | ||
"name": "unclear" | ||
} | ||
] | ||
} | ||
} | ||
|
10 changes: 10 additions & 0 deletions
10
...system/lobster-json/rbt-parse-input-file-json-extension/mixed-extensions/input/valid.json
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,10 @@ | ||
{ | ||
"items": { | ||
"data": [ | ||
{ | ||
"name": "This file has a valid json extension" | ||
} | ||
] | ||
} | ||
} | ||
|
2 changes: 2 additions & 0 deletions
2
tests-system/lobster-json/rbt-parse-input-file/file-does-not-exist/README.md
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,2 @@ | ||
The goal of this test is to check if an error message gets printed | ||
if the input file to the lobster-json tool does not exist |
1 change: 1 addition & 0 deletions
1
...ystem/lobster-json/rbt-parse-input-file/file-does-not-exist/expected-output/exit-code.txt
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 @@ | ||
1 |
Empty file.
Empty file.
1 change: 1 addition & 0 deletions
1
...s-system/lobster-json/rbt-parse-input-file/file-does-not-exist/expected-output/stdout.txt
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 @@ | ||
<cmdline>: lobster error: file/does/not_exists.json is not a file or directory |
4 changes: 4 additions & 0 deletions
4
tests-system/lobster-json/rbt-parse-input-file/file-does-not-exist/input/args.txt
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,4 @@ | ||
--single | ||
--tag-attribute=something | ||
--out=output.lobster | ||
file/does/not_exists.json |
Oops, something went wrong.