Skip to content

Conversation

@o-muzyka
Copy link

@o-muzyka o-muzyka commented Aug 28, 2025

Description

Extend SAMM CLI with new functions + test coverage:

  • prettyprint: Format Aspect Model files
  • to_java: Generate Java classes from Aspect Models
  • to_asyncapi: Generate AsyncAPI specifications
  • to_jsonld: Generate JSON-LD representations
  • to_sql: Generate SQL scripts for Aspect data
  • to_aas: Generate Asset Administration Shell templates
  • edit_move: Move model elements between files/namespaces
  • edit_newversion: Create new versions of models
  • usage: Show where model elements are used
  • aas_to_aspect: Convert AAS templates to Aspect Models
  • aas_list: List submodel templates in AAS files
  • package_import: Import namespace packages
  • package_export: Export models as namespace packages
  • Add support for repeated parameters (lists in kwargs)

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • I My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

@o-muzyka o-muzyka changed the title Extend cli Extend CLI functions Aug 28, 2025
check=True,
)

@pytest.mark.parametrize("command_type", ("aspect", "aas", "package", "QWE"))
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's add a test for incorrect command_type

Copy link
Contributor

Choose a reason for hiding this comment

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

This test also can be move to the functional testing suitre

Copy link
Author

@o-muzyka o-muzyka Sep 10, 2025

Choose a reason for hiding this comment

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

I wanted to clarify the type of tests I’ve written. The current tests are unit tests, not functional tests.

  • They target small helper methods like _format_argument and _process_kwargs.
  • All external dependencies are mocked (e.g., subprocess, _get_client_path), so the tests run in isolation.
  • Each test verifies only the logic of a single method and its return value.

By contrast, functional tests usually check a business scenario end-to-end, often without mocking, to ensure multiple components work together (e.g., calling the real CLI command and verifying the actual output).

Because these tests focus on isolated pieces of code, they fit the definition of unit tests.

➡️ My opinion is that we can simply keep them as part of our unit tests. There’s nothing wrong if I additionally tested a function more thoroughly — it’s not redundant, and having extra unit coverage will only help us.

Could you share your thoughts on this?

@o-muzyka o-muzyka force-pushed the feature/extend-cli branch 2 times, most recently from 3681510 to 4984770 Compare September 10, 2025 10:39
@o-muzyka o-muzyka force-pushed the feature/extend-cli branch 3 times, most recently from 98edb79 to 1af7f0e Compare September 11, 2025 12:19
@o-muzyka o-muzyka marked this pull request as ready for review September 12, 2025 09:44
@prefix : <urn:samm:org.eclipse.esmf.test.general:2.1.0#> .

:Aspect a samm:Aspect ;
:TestAspect a samm:Aspect ;
Copy link
Contributor

Choose a reason for hiding this comment

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

The Aspect should have the same name as the file

Copy link
Author

Choose a reason for hiding this comment

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

I’ve renamed it to SampleAspect.ttl

  * prettyprint: Format Aspect Model files
  * to_java: Generate Java classes from Aspect Models
  * to_asyncapi: Generate AsyncAPI specifications
  * to_jsonld: Generate JSON-LD representations
  * to_sql: Generate SQL scripts for Aspect data
  * to_aas: Generate Asset Administration Shell templates
  * edit_move: Move model elements between files/namespaces
  * edit_newversion: Create new versions of models
  * usage: Show where model elements are used
  * aas_to_aspect: Convert AAS templates to Aspect Models
  * aas_list: List submodel templates in AAS files
  * package_import: Import namespace packages
  * package_export: Export models as namespace packages

- Enhance _call_function method to support different command types (aspect, aas, package)
- Add support for repeated parameters (lists in kwargs)

- Add integration test suite that:
  * Tests all possible model transformations
  * Verifies output file validity
  * Tests language-specific outputs
  * Tests package export/import functionality
  * Uses realistic test Aspect Model
@atextor atextor merged commit 6f4fcac into eclipse-esmf:main Sep 30, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants