The Asset Administration Shell (AAS) is a standard for Digital Twins. More information can be found here.
The tools in this repository offer measures to validate compliance of AAS implementations against the AAS standard.
You can install the AAS Test Engines via pip:
python -m pip install aas_test_engines
You may want to invoke the test tools using the simplified command line interface:
# Check file
python -m aas_test_engines check_file test.aasx
# Check file including submodel template
python -m aas_test_engines check_file test.aasx --submodel_template ContactInformation
# Check server
python -m aas_test_engines check_server https://localhost --suite 'Asset Administration Shell API'
# Generate test data
python -m aas_test_engines generate_files output_dir
# Alternative output formats
python -m aas_test_engines check_file test.aasx --output html > output.html
python -m aas_test_engines check_file test.aasx --output json > output.json
from aas_test_engines import file
from xml.etree import ElementTree
with open('aas.aasx', 'rb') as f:
result = file.check_aasx_file(f)
# result.ok() == True
result.dump()
# try result.to_html() to get an interactive representation
from aas_test_engines import file
# Check file
with open('aas.json') as f:
result = file.check_json_file(f)
# result.ok() == True
# Or check data directly
aas = {
'assetAdministrationShells': [],
'submodels': [],
'conceptDescriptions': []
}
result = file.check_json_data(aas)
# result.ok() == True
result.dump()
from aas_test_engines import file
from xml.etree import ElementTree
# Check file
with open('aas.xml') as f:
result = file.check_xml_file(f)
# result.ok() == True
# Or check data directly
data = ElementTree.fromstring(
'<environment xmlns="https://admin-shell.io/aas/3/0" />')
result = file.check_xml_data(aas)
# result.ok() == True
result.dump()
By passing a set of submodel template names you can check a file for compliance to these:
from aas_test_engines import file
with open('aas.xml') as f:
result = file.check_xml_file(f, submodel_templates=set(['ContactInformation']))
# result.ok() == True
By default, the file.check...
methods check compliance to version 3.0 of the standard.
You may want to check against older versions by passing a string containing the version to these methods.
You can query the list of supported versions as follows:
from aas_test_engines import file
print(file.supported_versions())
print(file.latest_version())
from aas_test_engines import api
tests = api.generate_tests(suites=set(['Asset Administration Shell API']))
conf = api.run.ExecConf(
server = "http://localhost",
)
for result in api.execute_tests(tests, conf):
result.dump()
By default, the api.generate_tests
method generate test cases for version 3.0 of the standard and all associated test suites.
You may want to check against older versions by passing a string containing the version to these methods.
You can also provide a list of test suites to check against:
from aas_test_engines import api
tests = api.generate_tests('3.0', ['Asset Administration Shell API'])
api.execute_tests(tests, "http://localhost")
For the naming of test suites we follow the names given by the specification. These are:
You can query the list of supported versions and their associated test suites as follows:
from aas_test_engines import api
print(api.supported_versions())
print(api.latest_version())
If you develop an AAS application like an AAS editor you may want to use test data to verify correctness of your application. The test engines allow to generate a set of AAS files which are compliant with the standard and you can therefore use to assess your application as follows:
from aas_test_engines import file
for sample in file.generate():
print(sample) # or whatever you want to do with it