File tree Expand file tree Collapse file tree 4 files changed +28
-6
lines changed Expand file tree Collapse file tree 4 files changed +28
-6
lines changed Original file line number Diff line number Diff line change @@ -228,6 +228,18 @@ documentation from Java source files. In addition to setting ``CLASSPATH``
228
228
explicitly, it is possible to put ``tools.jar `` into the ``ext-lib ``
229
229
directory in the project root and ``CLASSPATH `` is set automatically.
230
230
231
+ Schema validation
232
+ -----------------
233
+
234
+ Created output.xml has `<../doc/schema >`_ that can be tested as part of acceptance
235
+ test run. The schema is always used to validate selected outputs in
236
+ `<robot/rebot/compatibility.robot >`_, but validating all outputs would slow down
237
+ execution a bit too much.
238
+
239
+ It is, however, possible to enable validating all outputs by setting
240
+ `ATEST_VALIDATE_OUTPUT ` environment variable to `TRUE ` (case-insensitive).
241
+ This is recommended especially if the schema is updated or output.xml changed.
242
+
231
243
Telnet tests
232
244
------------
233
245
Original file line number Diff line number Diff line change 1
1
import os
2
2
import re
3
3
4
+ from xmlschema import XMLSchema
5
+
4
6
from robot import utils
5
7
from robot .api import logger
6
8
from robot .utils .asserts import assert_equal
@@ -60,14 +62,22 @@ class NoSlotsTestSuite(TestSuite):
60
62
61
63
62
64
class TestCheckerLibrary :
65
+ ROBOT_LIBRARY_SCOPE = 'GLOBAL'
66
+
67
+ def __init__ (self ):
68
+ self .schema = XMLSchema ('doc/schema/robot.02.xsd' )
63
69
64
- def process_output (self , path ):
70
+ def process_output (self , path , validate = None ):
65
71
set_suite_variable = BuiltIn ().set_suite_variable
66
72
if not path or path .upper () == 'NONE' :
67
73
set_suite_variable ('$SUITE' , None )
68
74
logger .info ("Not processing output." )
69
75
return
70
76
path = path .replace ('/' , os .sep )
77
+ if validate is None :
78
+ validate = os .getenv ('ATEST_VALIDATE_OUTPUT' , False )
79
+ if utils .is_truthy (validate ):
80
+ self .schema .validate (path )
71
81
try :
72
82
logger .info ("Processing output '%s'." % path )
73
83
result = Result (root_suite = NoSlotsTestSuite ())
Original file line number Diff line number Diff line change @@ -52,11 +52,11 @@ Run Tests Without Processing Output
52
52
[Return] ${result }
53
53
54
54
Run Rebot
55
- [Arguments] ${options } = ${sources } = ${default options } =${COMMON DEFAULTS } ${output } =${OUTFILE }
55
+ [Arguments] ${options } = ${sources } = ${default options } =${COMMON DEFAULTS } ${output } =${OUTFILE } ${ validate output } =True
56
56
[Documentation] *OUTDIR:* file://${OUTDIR} (regenerated for every run)
57
57
${result } = Execute ${INTERPRETER.rebot } ${options } ${sources } ${default options }
58
58
Log Many RC: ${result.rc } STDERR:\n${result.stderr } STDOUT:\n${result.stdout }
59
- Process Output ${output }
59
+ Process Output ${output } validate= ${ validate output }
60
60
[Return] ${result }
61
61
62
62
Run Rebot Without Processing Output
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ Resource rebot_resource.robot
7
7
8
8
*** Test Cases ***
9
9
RF 3.2 compatibility
10
- Run Rebot And Validate Statistics rebot/output-3.2.2.xml 172 10
10
+ Run Rebot And Validate Statistics rebot/output-3.2.2.xml 172 10 validate=False
11
11
12
12
RF 4.0 compatibility
13
13
Run Rebot And Validate Statistics rebot/output-4.0.xml 172 10
@@ -21,8 +21,8 @@ Message directly under test
21
21
22
22
*** Keywords ***
23
23
Run Rebot And Validate Statistics
24
- [Arguments] ${path } ${passed } ${failed }
25
- Run Rebot ${EMPTY } ${path }
24
+ [Arguments] ${path } ${passed } ${failed } ${ validate } =True
25
+ Run Rebot ${EMPTY } ${path } validate output= ${ validate }
26
26
${total } ${passed } ${failed } = Evaluate ${passed } + ${failed } , ${passed } , ${failed }
27
27
Should Be Equal ${SUITE.statistics.total } ${total }
28
28
Should Be Equal ${SUITE.statistics.passed } ${passed }
You can’t perform that action at this time.
0 commit comments