File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -228,6 +228,18 @@ documentation from Java source files. In addition to setting ``CLASSPATH``
228228explicitly, it is possible to put ``tools.jar `` into the ``ext-lib ``
229229directory in the project root and ``CLASSPATH `` is set automatically.
230230
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+
231243Telnet tests
232244------------
233245
Original file line number Diff line number Diff line change 11import os
22import re
33
4+ from xmlschema import XMLSchema
5+
46from robot import utils
57from robot .api import logger
68from robot .utils .asserts import assert_equal
@@ -60,14 +62,22 @@ class NoSlotsTestSuite(TestSuite):
6062
6163
6264class TestCheckerLibrary :
65+ ROBOT_LIBRARY_SCOPE = 'GLOBAL'
66+
67+ def __init__ (self ):
68+ self .schema = XMLSchema ('doc/schema/robot.02.xsd' )
6369
64- def process_output (self , path ):
70+ def process_output (self , path , validate = None ):
6571 set_suite_variable = BuiltIn ().set_suite_variable
6672 if not path or path .upper () == 'NONE' :
6773 set_suite_variable ('$SUITE' , None )
6874 logger .info ("Not processing output." )
6975 return
7076 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 )
7181 try :
7282 logger .info ("Processing output '%s'." % path )
7383 result = Result (root_suite = NoSlotsTestSuite ())
Original file line number Diff line number Diff line change @@ -52,11 +52,11 @@ Run Tests Without Processing Output
5252 [Return] ${result }
5353
5454Run Rebot
55- [Arguments] ${options } = ${sources } = ${default options } =${COMMON DEFAULTS } ${output } =${OUTFILE }
55+ [Arguments] ${options } = ${sources } = ${default options } =${COMMON DEFAULTS } ${output } =${OUTFILE } ${ validate output } =True
5656 [Documentation] *OUTDIR:* file://${OUTDIR} (regenerated for every run)
5757 ${result } = Execute ${INTERPRETER.rebot } ${options } ${sources } ${default options }
5858 Log Many RC: ${result.rc } STDERR:\n${result.stderr } STDOUT:\n${result.stdout }
59- Process Output ${output }
59+ Process Output ${output } validate= ${ validate output }
6060 [Return] ${result }
6161
6262Run Rebot Without Processing Output
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ Resource rebot_resource.robot
77
88*** Test Cases ***
99RF 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
1111
1212RF 4.0 compatibility
1313 Run Rebot And Validate Statistics rebot/output-4.0.xml 172 10
@@ -21,8 +21,8 @@ Message directly under test
2121
2222*** Keywords ***
2323Run 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 }
2626 ${total } ${passed } ${failed } = Evaluate ${passed } + ${failed } , ${passed } , ${failed }
2727 Should Be Equal ${SUITE.statistics.total } ${total }
2828 Should Be Equal ${SUITE.statistics.passed } ${passed }
You can’t perform that action at this time.
0 commit comments