Skip to content

XML Test parsing & testlinks#197

Merged
MaximilianSoerenPollak merged 23 commits into
eclipse-score:mainfrom
MaximilianSoerenPollak:MSP_add_xml_test_parsing
Aug 18, 2025
Merged

XML Test parsing & testlinks#197
MaximilianSoerenPollak merged 23 commits into
eclipse-score:mainfrom
MaximilianSoerenPollak:MSP_add_xml_test_parsing

Conversation

@MaximilianSoerenPollak
Copy link
Copy Markdown
Contributor

No description provided.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Aug 6, 2025

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run //src:license-check

Status: ✅ Passed

Click to expand output
[License Check Output]
Extracting Bazel installation...
Starting local Bazel server (8.3.0) and connecting to it...
INFO: Invocation ID: e93920a4-f063-4c7a-82bc-7cdbb05947f7
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Loading: 
Loading: 0 packages loaded
Loading: 0 packages loaded
    currently loading: src
Analyzing: target //src:license-check (1 packages loaded, 0 targets configured)
Analyzing: target //src:license-check (1 packages loaded, 0 targets configured)

Analyzing: target //src:license-check (73 packages loaded, 9 targets configured)

Analyzing: target //src:license-check (123 packages loaded, 1311 targets configured)

Analyzing: target //src:license-check (129 packages loaded, 2423 targets configured)

Analyzing: target //src:license-check (134 packages loaded, 2472 targets configured)

INFO: Analyzed target //src:license-check (137 packages loaded, 4488 targets configured).
[12 / 13] [Prepa] Generating Dash formatted dependency file ...
INFO: Found 1 target...
Target //src:license.check.license_check up-to-date:
  bazel-bin/src/license.check.license_check
  bazel-bin/src/license.check.license_check.jar
INFO: Elapsed time: 16.213s, Critical Path: 0.31s
INFO: 13 processes: 4 disk cache hit, 9 internal.
INFO: Build completed successfully, 13 total actions
INFO: Running command line: bazel-bin/src/license.check.license_check src/formatted.txt <args omitted>
[main] INFO Querying Eclipse Foundation for license data for 84 items.
[main] INFO Found 58 items.
[main] INFO Querying ClearlyDefined for license data for 26 items.
[main] INFO Found 26 items.
[main] INFO Vetted license information was found for all content. No further investigation is required.

Comment thread docs/conf.py
Comment thread src/extensions/score_source_code_linker/__init__.py
Comment thread src/extensions/score_source_code_linker/__init__.py Outdated
Comment thread src/extensions/score_source_code_linker/__init__.py Outdated
Comment thread src/extensions/score_source_code_linker/__init__.py Outdated
@MaximilianSoerenPollak
Copy link
Copy Markdown
Contributor Author

MaximilianSoerenPollak commented Aug 8, 2025

ToDO:

  • Save the combined JSON as a cache
  • Make the input json's a debug cache save
  • See if you can increase performance somehow
  • Split things into smaller functions for readability
  • Rename Dataclasses to reflect more what they are
  • Add priority to the connects in the app
  • ? Tests ?
  • Documentation on how to use this?
  • Make a PR in tooling for the decorator.

@MaximilianSoerenPollak
Copy link
Copy Markdown
Contributor Author

@AlexanderLanin

Any ideas for better names for the TestCaseNeed & the Dataclass for the combined JSON cache (that we feed into the scl to generate the needs)?
I guess I will just make them and mark them as TMP so we can easily rename them in review.

@MaximilianSoerenPollak
Copy link
Copy Markdown
Contributor Author

So I have been at work in this.
It' s slowly coming together, should soon be good to be taken a look at.

One big issue I just stumbled accross, if I have the 'grouped cache' or just the testlink cache, I do not build the TestCaseNeeds again.
This is quiet a big flaw in the design at the moment, but it can be solved. I just have to think about how to do this.
Most likely by saving the needs in a json too, as otherwise the whole datastructure of TestLink would need to be remodeld etc.
don't think that is a good idea.

Comment thread docs/requirements/requirements.rst Outdated
Comment on lines +42 to +43
'<<meta_all(no_links=True, exclude=["layout","style", "fully_verified_by", "status", "security", "safety"])>>',
'<<meta_links_all(exclude=["fully_verified_by", "fully_verifies_back", "partially_verified_by", "partially_verifies_back"])>>',
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

outcommented partially & fully verifies_back. in the end render

Comment thread src/extensions/score_metamodel/tests/test_check_options.py Outdated
Comment thread src/extensions/score_metamodel/tests/test_check_options.py Outdated
Comment thread src/extensions/score_metamodel/BUILD Outdated
@@ -0,0 +1,113 @@
[
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Golden files made for golden file assertion testing in integration tests

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-> expected_grouped_json?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better question: do we really care about the json content? Shouldn't we test end to end?

@@ -0,0 +1,126 @@
import json
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simple Half written Half Gen tests. Good start but probably need some work.
will check coverage later

Comment thread src/extensions/score_source_code_linker/tests/test_source_link.py Outdated
Comment thread src/extensions/score_source_code_linker/tests/test_source_link.py Outdated
@@ -0,0 +1,107 @@
import json
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Half written, half Generated. Probably needs more work

Comment thread src/extensions/score_source_code_linker/tests/test_xml_parser.py Outdated
"verify_type": "fully",
"result": "passed",
"result_text": ""
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notice that the 'skipped' test is missing here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whatever is noteworthy should be in the code. Comments!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do I put this? As I can't put it in the json :D?

The place where we write the testlink json?

Comment thread src/extensions/score_source_code_linker/BUILD Outdated
@@ -0,0 +1,105 @@
# *******************************************************************************
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newly created File to house the 'grouped' dataclass.

Please leave feedback for a better name (for the file & Dataclasses)

Comment on lines +111 to +121
# It's mandatory that the test either partially or fully verifies a requirement
# if self.PartiallyVerifies is None and self.FullyVerifies is None:
# raise ValueError(
# f"TestCase: {self.id} Error. Either 'PartiallyVerifies' or 'FullyVerifies' must be provided."
# )
# Skipped tests should always have a reason associated with them
# if "skipped" in self.result.keys() and not list(self.result.values())[0]:
# raise ValueError(
# f"TestCase: {self.id} Error. Test was skipped without provided reason, reason is mandatory for skipped tests."
# )
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented out for now, to not break all tests due to them not having properties.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to support gradual integration. Noone will be able to update docs-as-code if it suddenly throws 100000 errors.

Comment on lines +173 to +196
def build_test_needs_from_files(
app: Sphinx, env: BuildEnvironment, xml_paths: list[Path]
) -> list[TestCaseNeed]:
"""
Reading in all test.xml files, and building 'testcase' external need objects out of them.

Returns:
- list[TestCaseNeed]
"""
tcns: list[TestCaseNeed] = []
for f in xml_paths:
b, z = read_test_xml_file(f)
for non_prop_test in z:
logger.warning(
f"Test: {non_prop_test} has no properties. Could not create need"
)
# Now we build the needs from it
tcns.extend(b)
for c in b:
construct_need(app, c, env)
return tcns
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I can solve this better, just didn't have a good idea yet.

Comment thread src/extensions/score_source_code_linker/xml_parser.py
Comment thread src/extensions/score_source_code_linker/xml_parser.py Outdated
@MaximilianSoerenPollak
Copy link
Copy Markdown
Contributor Author

/consumer-test

Comment thread docs/requirements/requirements.rst Outdated
Tool Requirements
=================================

TESTCASE EXAMPLES
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

@@ -0,0 +1,557 @@
# *******************************************************************************
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was 'test_source_link` before.
Not sure why git didn't realize the renaming?

Comment on lines +120 to +123
# Cleanup
# Don't know if we need this?
# os.environ.pop("BUILD_WORKSPACE_DIRECTORY", None)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete

from src.extensions.score_source_code_linker.testlink import DataOfTestCase


# Unsure if I should make these last a session or not
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change this to use hardcoded XML string files instead of this. (in next PR)

# Outcomment this to enable more verbose logging
# LOGGER.setLevel("DEBUG")
# Uncomment this to enable more verbose logging
LOGGER.setLevel("DEBUG")
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should comment this out again

Comment thread src/extensions/score_source_code_linker/__init__.py
Comment thread src/extensions/score_source_code_linker/__init__.py
for prefix in prefixes:
prefixed_id = f"{prefix}{id}"
if prefixed_id in all_needs:
LOGGER.warning("linking to external needs is not supported!")
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we do more here?

Comment on lines +364 to +365
# LOGGER.warning(
# f"Putting links into need: {need['id']}. SCL: {source_code_links.links.CodeLinks}\nTESTLINKS: {source_code_links.links.TestLinks}"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this

Comment thread src/extensions/score_source_code_linker/need_source_links.py Outdated
Comment thread src/extensions/score_source_code_linker/xml_parser.py
Comment thread src/extensions/score_source_code_linker/xml_parser.py Outdated
@MaximilianSoerenPollak
Copy link
Copy Markdown
Contributor Author

@AlexanderLanin

Followup PR's :

  • Remove 'TestLink (the thing in the JSON) and replace it with DataFromTestCase
  • After decorator in Python_basics is added:
    • Use decorator in DaC
    • Add Examples to the documentation here
    • Add a Documentation
  • Fix / Add source code links to have the correct ones.
  • Adapt unit tests for xml_parser to use String XML files instead of library

Not sure what else I'm missing for now.

@MaximilianSoerenPollak MaximilianSoerenPollak merged commit 3cee6b0 into eclipse-score:main Aug 18, 2025
7 of 8 checks passed
arnoox pushed a commit to arnoox/score-docs-as-code that referenced this pull request Feb 20, 2026
* Add Test.xml parsing
* Add testlink's to requirements (where found)
* Added unit- & integration-tests 
* Splitted helper library to avoid circular imports
* Remove junitparser

Thanks for the infra Team for help in working out the concept & finding the issues here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants