Skip to content

Commit 9f78f49

Browse files
Michael HallikMichael Hallik
authored andcommitted
chore: bump versions and minor doc corrections
1 parent 613f457 commit 9f78f49

File tree

8 files changed

+75
-54
lines changed

8 files changed

+75
-54
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,5 @@ For example
7070
- Changed some from level=WARN to level=INFO.
7171
- Some got commented out.
7272
- Some indentation changes as well.
73+
- Fixed unit tests that now failed due to aforementioned changes in the logging.
7374
- Changed documentation (READEME.md, keyword documentation, etc.) to reflect additions and changes in this version.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ Actually, almost anything goes:
266266

267267
#### Test case status - fail_on_error
268268

269-
A test case that has resulted in the collection of one or more errors (of whatever type) will receive a status of FAIL. You can use the ``fail_on_errors`` (bool) argument to change this default behaviour. When set to `False`, the test cases's will always be PASS, regardless whether errors were collected or not.
269+
A test case that has resulted in the collection of one or more errors (of whatever type) will receive a status of FAIL. You can use the ``fail_on_errors`` (bool) argument to change this default behaviour. When set to `False`, the test cases's status will always be PASS, regardless whether errors were collected or not.
270270

271271
#### Dyanmic XSD resolution
272272

docs/XmlValidator.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# General.
22
[tool.poetry]
33
name = "robotframework-xmlvalidator"
4-
version = "2.0.0a1"
4+
version = "2.0.0"
55
description = "A Robot Framework test library for validating XML files against XSD schemas"
66
authors = ["Michael Hallik <hallik.michael@gmail.com>"]
77
license = "Apache-2.0"

src/xmlvalidator/XmlValidator.py

Lines changed: 68 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ class XmlValidator:
9898
9999
When operating in batch mode, the ``Validate Xml Files`` keyword
100100
always validates the entire set of passed XML files. That is, when
101-
it encounters an error in a file, it does not simply fail. Rather,
102-
it collects the error details (as determined by the error_facets
103-
arg) and then continues validating the current file as well as any
104-
subsequent file(s).
101+
it encounters an error in a file, it does not simply then fail.
102+
Rather, it collects the error details (as determined by the
103+
error_facets arg) and then continues validating the current file as
104+
well as any subsequent file(s).
105105
106106
In that fashion the keyword works through the entire set of files.
107107
@@ -158,12 +158,14 @@ class XmlValidator:
158158
- Namespace errors.
159159
- Etc.
160160
161-
- Captures malformed XML.
161+
- Captures malformed XML (e.g. missing closing tag, encoding
162+
issues).
162163
- Handles edge cases like empty files or XML files that could not be
163164
matched to an XSD schema file.
164-
- Does not fail on errors, but collects encountered errors in all
165-
files and reports them in a structured format in the console and
166-
RF log.
165+
- Does not immediately fail on errors, but collects encountered all
166+
errors in all files and reports them in a structured format in the
167+
console and RF log. Only *then* fails (assuming one or more
168+
errors have been collected).
167169
- Supports specifying the details that should be collected for
168170
encountered errors.
169171
- Optionally exports the error report to a CSV file, providing the
@@ -236,23 +238,13 @@ class XmlValidator:
236238
Enables resolution of schema imports/includes via a custom base URL,
237239
via the ``base_url`` arg.
238240
239-
Use ``base_url`` when your XSD uses <xs:include> or <xs:import> with
240-
relative paths.
241+
Use ``base_url`` when your XSD uses ``<xs:include>`` or ``<xs:import>``
242+
with relative paths.
241243
242244
You can pass ``base_url`` with the library import (together with
243245
passing ``xsd_path``) and/or when calling ``Validate Xml Files``
244246
with ``xsd_path``.
245247
246-
** Optional test case fail **
247-
248-
The ``Validate Xml Files`` keyword collects one or more errors for
249-
one or more XML files. As mentioned earlier, the keyword is designed
250-
so as to not fail upon encountering errors.
251-
252-
However, in case you want your test case to fail when one or more
253-
errors have been detected, you can use the ``fail_on_errors`` (bool)
254-
argument to make it so. It defaults to ${False}.
255-
256248
**Basic usage examples**
257249
258250
For a comprehensive set of example test cases, please see the
@@ -266,6 +258,18 @@ class XmlValidator:
266258
It further contains a detailed instruction on
267259
`how to run Robot Framework tests <https://github.com/MichaelHallik/robotframework-xmlvalidator/blob/main/test/_doc/integration/README.md>`_.
268260
261+
Finally, the repo also contains a `demo test suite file <https://github.com/MichaelHallik/robotframework-xmlvalidator/blob/main/test/demo/demo.robot>`_ containing
262+
eight self-contained test cases to demonstrates the following features:
263+
264+
- Single and batch XML validation
265+
- Schema matching by filename and namespace
266+
- Custom error facets
267+
- Malformed XML handling
268+
- XSD includes/imports
269+
- CSV export
270+
271+
A test suite file may look like the following:
272+
269273
.. code:: robotframework
270274
271275
*** Settings ***
@@ -361,21 +365,8 @@ class XmlValidator:
361365
[ WARN ] XML is invalid:
362366
[ WARN ] Error #0:
363367
[ WARN ] reason: No matching XSD found for: no_xsd_match_2.xml.
364-
Validation errors exported to 'C:\\test\\01_Advanced_Validation\\errors_2025-03-29_13-54-46-552150.csv'.
365-
Total_files validated: 11.
366-
Valid files: 6.
367-
Invalid files: 5
368-
01 Advanced Validation:: Demo XML validation | PASS |
369-
21 errors have been detected.
370-
========================================================
371-
01 Advanced Validation:: Demo XML validation | PASS |
372-
1 test, 1 passed, 0 failed
373-
374-
In case ``fail_on_errors`` is True, the console output will look like this:
375-
376-
.. code:: console
377-
378-
Validation errors exported to 'C:\\test\\01_Advanced_Validation\\errors_2025-03-29_13-54-46-552150.csv'.
368+
Validation errors exported to:
369+
'C:\\test\\01_Advanced_Validation\\errors_2025-03-29_13-54-46-552150.csv'.
379370
Total_files validated: 11.
380371
Valid files: 6.
381372
Invalid files: 5.
@@ -384,8 +375,8 @@ class XmlValidator:
384375
========================================================
385376
01 Advanced Validation:: Demo XML validation | FAIL |
386377
1 test, 0 passed, 1 failed
387-
388-
The corresponding CSV output would in both cases look like:
378+
379+
The corresponding CSV output will look like:
389380
390381
.. code:: text
391382
@@ -402,7 +393,7 @@ class XmlValidator:
402393
403394
"""
404395

405-
__version__ = '1.0.1'
396+
__version__ = '2.0.0'
406397
ROBOT_LIBRARY_DOC_FORMAT = 'reST'
407398
nr_instances = 0
408399

@@ -422,16 +413,19 @@ def __init__(
422413
423414
**Library Arguments**
424415
425-
+--------------+--------------+-----------+---------------------------------------------------------------------------------------------+
426-
| Argument | Type | Required | Description |
427-
+==============+==============+===========+=============================================================================================+
428-
| xsd_path | str | No | Path to an XSD file or folder to preload during initialization. |
429-
| | | | In case of a folder, the folder must hold one file only. |
430-
+--------------+--------------+-----------+---------------------------------------------------------------------------------------------+
431-
| base_url | str | No | Base path used to resolve includes/imports within the provided XSD schema. |
432-
+--------------+--------------+-----------+---------------------------------------------------------------------------------------------+
433-
| error_facets | list of str | No | The attributes of validation errors to collect and report. E.g. ``path``, ``reason``. |
434-
+--------------+--------------+-----------+---------------------------------------------------------------------------------------------+
416+
+---------------+-------------+----------+---------------------------------------------------------------------------------------------+----------------+
417+
| Argument | Type | Required | Description | Default |
418+
+===============+=============+==========+=============================================================================================+================+
419+
| xsd_path | str | No | Path to an XSD file or folder to preload during initialization. | None |
420+
| | | | In case of a folder, the folder must hold one file only. | |
421+
+---------------+-------------+----------+---------------------------------------------------------------------------------------------+----------------+
422+
| base_url | str | No | Base path used to resolve includes/imports within the provided XSD schema. | None |
423+
+---------------+-------------+----------+---------------------------------------------------------------------------------------------+----------------+
424+
| error_facets | list of str | No | The attributes of validation errors to collect and report. E.g. ``path``, ``reason``. | [path, reason] |
425+
+---------------+-------------+----------+---------------------------------------------------------------------------------------------+----------------+
426+
| fail_on_error | bool | No | Whether to fail the test case if one or more XML validation errors are found. | True |
427+
| | | | Can be overridden per keyword call. | |
428+
+---------------+-------------+----------+---------------------------------------------------------------------------------------------+----------------+
435429
436430
All arguments are optional.
437431
@@ -486,6 +480,30 @@ def __init__(
486480
487481
See the introduction for more details on the purpose and usage
488482
of error facets.
483+
484+
``fail_on_error``
485+
486+
The ``fail_on_errors`` argument controls whether a test case
487+
should fail if one or more XML validation errors are detected.
488+
It defaults to True. A test case that has resulted in the
489+
collection of one or more errors (of whatever type) will then
490+
receive a status of FAIL.
491+
492+
You can use the ``fail_on_errors`` argument to change this
493+
default behaviour. When set to False, a test cases's status will
494+
always be PASS, regardless whether errors were collected or not.
495+
496+
This may be useful for:
497+
498+
- Non-blocking checks in dashboards or QA reports.
499+
- Legacy or transitional systems where some invalid files are expected.
500+
- Schema discovery or diagnostics, where conformance isn’t yet enforced.
501+
- Soft rollout of stricter validation rules, allowing time to adapt.
502+
503+
Note that with ``fail_on_error=True`` the library's batch
504+
validation behavior remains unchanged by the latter. That is,
505+
fail_on_errors=True does not short-circuit the validation
506+
process in any way.
489507
490508
**Examples**
491509
@@ -531,6 +549,8 @@ def __init__(
531549
For more examples see the project's
532550
`Robot Framework integration test suite <https://github.com/MichaelHallik/robotframework-xmlvalidator/blob/main/test/integration/01_library_initialization.robot>`_.
533551
552+
And also the `demo test suite file <https://github.com/MichaelHallik/robotframework-xmlvalidator/blob/main/test/demo/demo.robot>`_.
553+
534554
**Raises**
535555
536556
+---------------+--------------------------------------------------------------+

src/xmlvalidator/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@
5555
__version__ = version("robotframework-xmlvalidator")
5656
except PackageNotFoundError:
5757
# Fall back when package not installed (default version for development).
58-
__version__ = "1.0.1"
58+
__version__ = "2.0.0"
5959
import warnings
6060
warnings.warn("Package metadata not found, using fallback version.")

src/xmlvalidator/xml_validator_results.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class ValidatorResultRecorder:
7575
and export validation results.
7676
"""
7777

78-
__version__ = '1.0.1'
78+
__version__ = '2.0.0'
7979

8080
errors_by_file: List[Dict[str, Any]] = field(default_factory=list)
8181
validation_summary: Dict[str, List[str]] = field(

src/xmlvalidator/xml_validator_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class ValidatorUtils:
6666
All methods are static and the class maintains no internal state.
6767
"""
6868

69-
__version__ = '1.0.1'
69+
__version__ = '2.0.0'
7070

7171
@staticmethod
7272
def _resolve_path(path: str | Path) -> Path:

0 commit comments

Comments
 (0)