LOBSTER Tool for JSON
Project description
LOBSTER
The Lightweight Open BMW Software Traceability Evidence Report allows you to demonstrate software traceability and requirements coverage, which is essential for meeting standards such as ISO 26262.
This package contains a tool extract tracing tags from JSON files. The tool expects a json file with a list of objects, for which you can specify members to extract by name. It is extremely simplistic but it may be good enough to support some use-cases.
If you have a more complex file format you will likely need to provide your own tool for your own files.
Tools
lobster-json: Extract activities from JSON files
Configuration via YAML
The tool uses a YAML configuration file to define the following parameters:
- inputs: A list of input file paths (can include directories).
- inputs-from-file: A file containing paths to input files or directories.
- single: A flag to avoid the use of multiprocessing. If true, multiprocessing will be skipped.
- test_list: Member name indicator resulting in a list containing objects carrying test data.
- name_attribute: Member name indicator for test name.
- tag_attribute: Member name indicator for test tracing tags.
- justification_attribute: Member name indicator for justifications.
Only the --out and --config parameters are supported on the command line. All other parameters must be specified in the YAML configuration file.
-
YAML Configuration Example:
Below is an example of how you can define these parameters in the YAML configuration file:
inputs: - "file1.json" - "file2.json" - "directory1/" inputs_from_file: "files.txt" # File containing a list of input files or directories single: false # Set to true to avoid multiprocessing test_list: sample_list name_attribute: apple tag_attribute: fruit justification_attribute: ignored
-
Command-Line Usage:
To run the tool with the specified YAML configuration file, use the following command:
lobster-json --config /path/to/config.yaml --out "<file path where the output will be stored>"
Where /path/to/config.yaml is the path to your YAML configuration file.
Usage
Some projects store their test vectors in JSON files. This tool can be used to expose these to LOBSTER. Consider this example:
[
{"name" : "XOR Test 1",
"values" : [false, false],
"expectation" : false,
"tags" : "example.req_xor"},
{"name" : "XOR Test 2",
"values" : [false, true],
"expectation" : true,
"tags" : "example.req_xor"},
{"name" : "Potato Test 1",
"values" : [false, false],
"expectation" : true,
"tags" : null,
"justification" : "Unlinked on purpose"}
]
Here we have a list of three tests. You can configure the
lobster-json tool to extract the relevant information:
config.yml
name_attribute: "name"
tag_attribute: "tags"
justification_attribute: "justification"
$ lobster-json --config "/path/to/above/config.yaml" --out "json.lobster"
The name attribute is optional. If your test files do not contain names for the tests then a name is synthesised using the filename and the index of the test (e.g. foo_1, foo_2, foo_3, etc.).
The justification attribute is also optional.
The tag attribute is not, and it needs to be present in each test object.
The specification of these attributes can be nested, for example if your test objects instead look like this:
[
{"meta" : {"name" : "XOR Test 1",
"asil" : "B",
"req" : "example.req_xor"},
"test" : {"inputs" : [false, false],
"expect" : false}
},
...
Then you can get to the data like so:
config.yml
name_attribute: "meta.name"
tag_attribute: "meta.req"
justification_attribute: "meta.just"
$ lobster-json --config "/path/to/config.yaml" --out "json.lobster"
Finally, if your list of tests is nested more deeply in an object, you
can use the test-list parameter to identify where it is. For example:
{ "kind" : "tests",
"vectors" : [
{"meta" : {"name" : "XOR Test 1",
"asil" : "B",
"req" : "example.req_xor"},
"test" : {"inputs" : [false, false],
"expect" : false}
},
...
Then you can add test-list: vectors in the yaml config file to identify the correct
list.
Note: This tool is pretty limited. For the obvious cases it works pretty well, but if you have a more complex test definition in JSON then you will need to write your own adaptor using the documented schema.
Copyright & License information
The copyright holder of LOBSTER is the Bayerische Motoren Werke Aktiengesellschaft (BMW AG), and LOBSTER is published under the GNU Affero General Public License, Version 3.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bmw_lobster_tool_json-1.0.3-py3-none-any.whl.
File metadata
- Download URL: bmw_lobster_tool_json-1.0.3-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2d432fd4c1e0a05319589424ce63caf35a34e81d8505580a375569a679ec12e
|
|
| MD5 |
cad85861d7d65503d1137e250ddf77d7
|
|
| BLAKE2b-256 |
deebe3f960018a46525b9d93710e0aacb0130773ea6fb7823aa0e4b117bdd3ce
|
Provenance
The following attestation bundles were made for bmw_lobster_tool_json-1.0.3-py3-none-any.whl:
Publisher:
package.yml on bmw-software-engineering/lobster
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bmw_lobster_tool_json-1.0.3-py3-none-any.whl -
Subject digest:
e2d432fd4c1e0a05319589424ce63caf35a34e81d8505580a375569a679ec12e - Sigstore transparency entry: 1409236459
- Sigstore integration time:
-
Permalink:
bmw-software-engineering/lobster@5ae311eb063d43c0a47f43156ca7ea1beb7ea76a -
Branch / Tag:
refs/tags/lobster-1.0.3 - Owner: https://github.com/bmw-software-engineering
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
package.yml@5ae311eb063d43c0a47f43156ca7ea1beb7ea76a -
Trigger Event:
release
-
Statement type: