robotframework-xmlvalidator 1.0.1__tar.gz → 2.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,9 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: robotframework-xmlvalidator
3
- Version: 1.0.1
3
+ Version: 2.1.0
4
4
  Summary: A Robot Framework test library for validating XML files against XSD schemas
5
5
  License: Apache-2.0
6
+ License-File: LICENSE
6
7
  Keywords: robotframework,xml,xsd,validation,test-library,test,testing,test-automation
7
8
  Author: Michael Hallik
8
9
  Author-email: hallik.michael@gmail.com
@@ -14,6 +15,7 @@ Classifier: Programming Language :: Python :: 3.10
14
15
  Classifier: Programming Language :: Python :: 3.11
15
16
  Classifier: Programming Language :: Python :: 3.12
16
17
  Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
17
19
  Classifier: Programming Language :: Python :: 3 :: Only
18
20
  Classifier: Topic :: Software Development :: Testing
19
21
  Requires-Dist: lxml (>=5.1.0,<6.0.0)
@@ -25,13 +27,9 @@ Project-URL: Homepage, https://github.com/MichaelHallik/robotframework-xmlvalida
25
27
  Project-URL: Repository, https://github.com/MichaelHallik/robotframework-xmlvalidator
26
28
  Description-Content-Type: text/markdown
27
29
 
28
- | Version | License | Tests |
29
- |---------|---------|-------|
30
- | [![PyPI version](https://img.shields.io/pypi/v/robotframework-xmlvalidator.svg)](https://pypi.org/project/robotframework-xmlvalidator/) | [![License](https://img.shields.io/pypi/l/robotframework-xmlvalidator?cacheSeconds=600)](LICENSE) | [![Tests](https://github.com/MichaelHallik/robotframework-xmlvalidator/actions/workflows/test.yml/badge.svg)](https://github.com/MichaelHallik/robotframework-xmlvalidator/actions/workflows/test.yml) |
31
-
32
- | Downloads | Update Badge |
33
- |-----------|---------------|
34
- | [![Total Downloads](https://github.com/MichaelHallik/robotframework-xmlvalidator/raw/main/badge_pepy_downloads.svg)](https://pepy.tech/project/robotframework-xmlvalidator) | [![Run Badge Update](https://github.com/MichaelHallik/robotframework-xmlvalidator/actions/workflows/update_pepy_badge.yml/badge.svg)](https://github.com/MichaelHallik/robotframework-xmlvalidator/actions/workflows/update_pepy_badge.yml) |
30
+ | Version | License | Tests | Downloads |
31
+ |---------|---------|-------|-----------|
32
+ | [![PyPI version](https://img.shields.io/pypi/v/robotframework-xmlvalidator)](https://pypi.org/project/robotframework-xmlvalidator/) | [![License](https://img.shields.io/github/license/MichaelHallik/robotframework-xmlvalidator)](LICENSE) | [![Tests](https://github.com/MichaelHallik/robotframework-xmlvalidator/actions/workflows/test.yml/badge.svg)](https://github.com/MichaelHallik/robotframework-xmlvalidator/actions) | [![Downloads](https://img.shields.io/pepy/dt/robotframework-xmlvalidator)](https://pepy.tech/project/robotframework-xmlvalidator) |
35
33
 
36
34
 
37
35
  <details>
@@ -51,12 +49,18 @@ Description-Content-Type: text/markdown
51
49
  - [Examples](#examples)
52
50
  - [Using a preloaded schema](#using-a-preloaded-schema)
53
51
  - [Defer schema loading to the test case(s)](#defer-schema-loading-to-the-test-cases)
54
- - [Importing with preloaded XSD that requires a base\_url](#importing-with-preloaded-xsd-that-requires-a-base_url)
55
- - [Importing with custom error\_facets](#importing-with-custom-error_facets)
52
+ - [Importing with preloaded XSD that requires a `base_url`](#importing-with-preloaded-xsd-that-requires-a-base_url)
53
+ - [Importing with custom `error_facets`](#importing-with-custom-error_facets)
54
+ - [Importing with \`fail\_on\_errors=True](#importing-with-fail_on_errorstrue)
56
55
  - [Further examples](#further-examples)
57
56
  - [Using the library](#using-the-library)
58
57
  - [Keyword overview](#keyword-overview)
59
- - [Error collection](#error-collection)
58
+ - [Error collection](#error-collection)
59
+ - [Batch mode](#batch-mode)
60
+ - [Single file mode](#single-file-mode)
61
+ - [Test case status - fail\_on\_error](#test-case-status---fail_on_error)
62
+ - [Dyanmic XSD resolution](#dyanmic-xsd-resolution)
63
+ - [Error collection](#error-collection-1)
60
64
  - [XSD Schema violations.](#xsd-schema-violations)
61
65
  - [Malformed XML](#malformed-xml)
62
66
  - [File-level issues](#file-level-issues)
@@ -64,6 +68,7 @@ Description-Content-Type: text/markdown
64
68
  - [Keyword documentation](#keyword-documentation)
65
69
  - [Keyword example usage](#keyword-example-usage)
66
70
  - [A few basic examples](#a-few-basic-examples)
71
+ - [Demo test suite file as examples](#demo-test-suite-file-as-examples)
67
72
  - [Integration tests as examples](#integration-tests-as-examples)
68
73
  - [Example console output](#example-console-output)
69
74
  - [Example CSV output](#example-csv-output)
@@ -85,6 +90,8 @@ Description-Content-Type: text/markdown
85
90
  - [Continuous Integration \& GitHub templates](#continuous-integration--github-templates)
86
91
  - [Class architecture (Simplified)](#class-architecture-simplified)
87
92
  - [Project Structure](#project-structure)
93
+ - [Changelog](#changelog)
94
+ - [Roadmap](#roadmap)
88
95
  - [License](#license)
89
96
  - [Author](#author)
90
97
 
@@ -157,11 +164,12 @@ See the [Robot Framework Library Scope docs](https://robotframework.org/robotfra
157
164
 
158
165
  ### Library arguments
159
166
 
160
- | Argument | Type | Required? | Description |
161
- |----------------|-------------|-----------|------------------------------------------------------------------------------------|
162
- | `xsd_path` | `str` | No | Path to an XSD file or folder to preload during initialization. In case of a folder, the folder must hold one file only. |
163
- | `base_url` | `str` | No | Base path used to resolve includes/imports within the provided XSD schema. |
164
- | `error_facets` | `list[str]` | No | The attributes of validation errors to collect and report (e.g., `path`, `reason`) |
167
+ | Argument | Type | Required? | Description | Default |
168
+ |-----------------|-------------|-----------|------------------------------------------------------------------------------------------------------------------------|-----------------|
169
+ | `xsd_path` | `str` | No | Path to an XSD file/folder to preload during initialization. In case of a folder, the folder must hold one file only. | None |
170
+ | `base_url` | `str` | No | Base path used to resolve includes/imports within the provided XSD schema. | None |
171
+ | `error_facets` | `list[str]` | No | The attributes of validation errors to collect and report (e.g., `path`, `reason`) | [path, reason] |
172
+ | `fail_on_error` | `bool` | No | Whether to fail the test case if one or more XML validation errors are found. Can be overridden per keyword call. | True |
165
173
 
166
174
  ### Examples
167
175
 
@@ -178,7 +186,7 @@ Library xmlvalidator xsd_path=path/to/schema.xsd
178
186
  Library xmlvalidator
179
187
  ```
180
188
 
181
- #### Importing with preloaded XSD that requires a base_url
189
+ #### Importing with preloaded XSD that requires a `base_url`
182
190
 
183
191
  ```robotframework
184
192
  Library xmlvalidator xsd_path=path/to/schema_with_include.xsd
@@ -187,7 +195,7 @@ Library xmlvalidator xsd_path=path/to/schema_with_include.xsd
187
195
 
188
196
  Use `base_url` when your XSD uses `<xs:include>` or `<xs:import>` with relative paths.
189
197
 
190
- #### Importing with custom error_facets
198
+ #### Importing with custom `error_facets`
191
199
 
192
200
  Use the `error_facets` argument to control which attributes of detected errors will be collected and reported.
193
201
 
@@ -206,6 +214,21 @@ Library xmlvalidator xsd_path=schemas/schema.xsd
206
214
  ... error_facets=value, namespaces
207
215
  ```
208
216
 
217
+ #### Importing with `fail_on_errors=True
218
+
219
+ The fail_on_errors argument controls whether a test case should fail if XML validation errors are detected.
220
+
221
+ It defaults to True.
222
+
223
+ The library's batch validation behavior remains unchanged. That is, `fail_on_errors=True` does *not* short-circuit the validation process in any way.
224
+
225
+ Set `fail_on_errors=False` to log validation issues without failing the test. This is useful for:
226
+
227
+ - Non-blocking checks in dashboards or QA reports.
228
+ - Legacy or transitional systems where some invalid files are expected.
229
+ - Schema discovery or diagnostics, where conformance isn’t yet enforced.
230
+ - Soft rollout of stricter validation rules, allowing time to adapt.
231
+
209
232
  #### Further examples
210
233
 
211
234
  See also the [library initialization Robot test file](test/integration/01_library_initialization.robot).
@@ -216,39 +239,63 @@ See also the [library initialization Robot test file](test/integration/01_librar
216
239
 
217
240
  ### Keyword overview
218
241
 
219
- | Keyword | Description |
220
- |--------------------------|-------------|
242
+ Thi section merely provides a short summary of the library's capabilities.
243
+
244
+ For more details, please see the [keyword documentation](https://michaelhallik.github.io/robotframework-xmlvalidator/XmlValidator.html).
245
+
246
+ | Keyword | Description |
247
+ |--------------------------|---------------------------------------------------------------------|
221
248
  | `Validate Xml Files` | Validate one or more XML files against one or more XSD schema files |
222
- | `Reset Schema` | Clear the currently loaded XSD schema |
223
- | `Reset Errors` | Clear the set of collected errors |
224
- | `Get Schema` | Get the current schema name or object |
225
- | `Log Schema` | Log the currently loaded schema |
226
- | `Get Error Facets` | Returns a list of the currently active error facets |
227
- | `Reset Error Facets` | Reset the error facets to default (`path`, `reason`) |
249
+ | `Reset Schema` | Clear the currently loaded XSD schema |
250
+ | `Reset Errors` | Clear the set of collected errors |
251
+ | `Get Schema` | Get the current schema name or object |
252
+ | `Log Schema` | Log the currently loaded schema |
253
+ | `Get Error Facets` | Returns a list of the currently active error facets |
254
+ | `Reset Error Facets` | Reset the error facets to default (`path`, `reason`) |
228
255
 
229
256
  The main keyword is `Validate Xml Files`. The other keywords are convenience/helper functions, e.g. 'Reset Error Facets'.
230
257
 
258
+ #### Error collection
259
+
231
260
  The `Validate Xml Files` validates one or more XML files against one or more XSD schema files and collects and reports all encountered errors.
232
261
 
233
- The type of error that the keyword can detect is not limited to XSD violations, but may also pertain to malformed XML files (e.g. parse errors), empty files, unmatched XML files (no XSD match found), etc.
262
+ The type of error that the keyword can detect is not limited to XSD violations, but may also pertain to malformed XML files, empty files, unmatched XML files (no XSD match found), etc.
234
263
 
235
264
  Errors that result from malformed XML files or from XSD violations support detailed error reporting. Using the `error_facets` argument you may specify the details the keyword should collect and report about captured errors.
236
265
 
237
- When operating in batch mode, the `Validate Xml Files` keyword always validates the entire set of passed XML files.
266
+ #### Batch mode
267
+
268
+ The `Validate Xml Files` keyword always validates the entire set of passed XML files.
238
269
 
239
- That is, when it encounters an error in a file, it does not fail. Rather, it collects the error details (as determined by the `error_facets` arg) and then continues validating the current file as well as any subsequent file(s).
270
+ That is, when it encounters an error in a file, it does not fail and stop execution. Rather, it collects the error details (as determined by the `error_facets` arg) and then continues validating the current file as well as any subsequent file(s).
240
271
 
241
272
  In that fashion the keyword works through the entire set of files.
242
273
 
243
- Once all files are processed it will log a summary of the test run and then proceed to report all collected errors in the console, in the RF log and, optionally, in the form of a CSV file.
274
+ Once *all* files are processed it will log a summary of the test run and then proceed to report all collected errors in the console, in the RF log and, optionally, in the form of a CSV file.
244
275
 
245
- However, in case you want your test case to fail when one or more errors have been detected, you can use the ``fail_on_errors`` (bool) argument to make it so. It defaults to False. When setting it to True, the keyword will still check each XML file (and collect possible errors), but after it has thus processed the batch, it will fail if one or more errors will have been detected.
276
+ For example:
277
+ - If you validate fifteen XML files and five of them contain schema violations or other errors, all files will still be processed.
278
+ - Errors are simply collected throughout the run and reported collectively, only after the final file has been (fully) processed.
279
+ - The test case will fail (assuming `fail_on_errors=True`) only after all files have been checked, ensuring comprehensive diagnostics.
246
280
 
247
- The keyword further supports the dynamic matching (i.e. pairing) of XML and XSD files, using either a 'by filename' or a 'by namespace' strategy. That means you can simply pass the paths to a folder containing XML files and to a folder containing XSD files and the keyword will determine which XSD schema file to use for each XML file. If the XML and XSD files reside in the same folder, you only have to pass one folder path. When no matching XSD schema could be identified for an XML file, this will be integrated into the mentioned summary and error reporting (the keyword will not fail).
281
+ #### Single file mode
248
282
 
249
283
  Of course, you may also refer to specific XML/XSD files (instead of to folders). In that case, no matching will be attempted, but the keyword will simply try to validate the specified XML file against the specified XSD file.
250
284
 
251
- For more details, please see the [keyword documentation](https://michaelhallik.github.io/robotframework-xmlvalidator/XmlValidator.html).
285
+ Actually, almost anything goes:
286
+
287
+ - one folder with: one or more XML files and one or more XSD files
288
+ - one folder with one or more XML files and another folder with one or more XSD files
289
+ - one folder with one or more XML files and a single XSD file
290
+ - a single XML file and a sigle XSD file
291
+
292
+ #### Test case status - fail_on_error
293
+
294
+ 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.
295
+
296
+ #### Dyanmic XSD resolution
297
+
298
+ The keyword further supports the dynamic matching (i.e. pairing) of XML and XSD files, using either a 'by filename' or a 'by namespace' strategy. That means you can simply pass the paths to a folder containing XML files and to a folder containing XSD files and the keyword will determine which XSD schema file to use for each XML file. If the XML and XSD files reside in the same folder, you only have to pass one folder path. When no matching XSD schema could be identified for an XML file, this will be integrated into the mentioned summary and error reporting (the keyword will not fail).
252
299
 
253
300
  ### Error collection
254
301
 
@@ -333,9 +380,9 @@ General errors that do not pertain to syntax or schema issues:
333
380
 
334
381
  #### Final note on error collection
335
382
 
336
- On account of the purpose of this library, all encountered errors (regardless the involved types) are collected and reported. The validator analyzes all files, collects encountered errors (if any) and, finally, reports the results of the run in the console and in the Robot Framework log
383
+ On account of the purpose of this library, all encountered errors (regardless the involved types) are collected and reported. The validator analyzes all files, collects encountered errors (if any) and, finally, reports the results of the run in the console and in the Robot Framework log.
337
384
 
338
- If you want the test run to receive a FAIL status when, at the end of test run, one or more errors have been found, then set: `fail_on_errors=True`.
385
+ Every test case in which one or more errors have been collected, will receive status FAIL unless `fail_on_errors=True` (see earlier explanations).
339
386
 
340
387
  ### Keyword documentation
341
388
 
@@ -384,6 +431,10 @@ Validate Folder With Multiple Schemas By File Name
384
431
  Validate Xml Files ${FOLDER_MULTIPLE_XML_XSD_FN} xsd_search_strategy=by_file_name
385
432
  ```
386
433
 
434
+ #### Demo test suite file as examples
435
+
436
+ See the [demo test suite](test/demo/demo.robot) for a demo test suite that demonstrates the most important features of the library in a concise fashion.
437
+
387
438
  #### Integration tests as examples
388
439
 
389
440
  Note that the [integration test](test/integration) folder contains seven Robot Framework test suite files.
@@ -772,6 +823,18 @@ requirements.txt # Requirements file for users (pip)
772
823
 
773
824
  ---
774
825
 
826
+ ## Changelog
827
+
828
+ For a list of changes across versions, including recent behavioral changes in validation logic, see the [CHANGELOG](https://github.com/MichaelHallik/robotframework-xmlvalidator/blob/main/CHANGELOG.md).
829
+
830
+ ---
831
+
832
+ ## Roadmap
833
+
834
+ See the [project roadmap](ROADMAP.md) for upcoming features and ideas.
835
+
836
+ ---
837
+
775
838
  ## License
776
839
 
777
840
  Licensed under the Apache License 2.0. See [LICENSE](LICENSE).