Skip to content

Commit

Permalink
Updated based on review comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
namsonx committed May 13, 2024
1 parent 3aacc33 commit f7f51cb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
13 changes: 8 additions & 5 deletions RobotFramework_TestsuitesManagement/Config/CConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,12 +515,15 @@ def __updateGlobalVariable(self):
lReservedKeyword = ['Settings', 'Variables', 'Keywords', 'Comments', 'Documentation', 'Metadata']
if 'params' in self.oConfigParams and 'global' in self.oConfigParams['params']:
for k,v in self.oConfigParams['params']['global'].items():
if not re.match(varNamePattern, k) or k in lReservedKeyword:
if not re.match(varNamePattern, k):
self.bLoadedCfg = False
self.sLoadedCfgLog['error'].append(f"Parameter '{k}' is invalid variable name or conflicts with Robot reserved keywords.")
self.sLoadedCfgLog['error'].append("Variable names in Robot Framework must start with a letter or underscore, \
followed by letters, digits, or underscores.")
BuiltIn().unknown()
self.sLoadedCfgLog['error'].append(f"Found invalid parameter name '{k}'.")
self.sLoadedCfgLog['unknown'] = "Violation of naming conventions detected. The test execution will be aborted!"
raise Exception
if k in lReservedKeyword:
self.sLoadedCfgLog['error'].append(f"'{k}' is a reserved keyword in Robot Framework and cannot be used as parameter name.")
self.sLoadedCfgLog['unknown'] = "Violation of naming conventions detected. The test execution will be aborted!"
raise Exception
if k in self.lBuitInVariables:
continue
try:
Expand Down
16 changes: 10 additions & 6 deletions RobotFramework_TestsuitesManagement/Keywords/CSetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@ def testsuite_setup(self, sTestsuiteCfgFile=''):
if not TM.CTestsuitesCfg.oConfig.bLoadedCfg:
if len(TM.CTestsuitesCfg.oConfig.sLoadedCfgLog['error']) > 0:
for errorMsg in TM.CTestsuitesCfg.oConfig.sLoadedCfgLog['error']:
logger.error(errorMsg)
if errorMsg.strip() != '':
logger.error(errorMsg)
if len(TM.CTestsuitesCfg.oConfig.sLoadedCfgLog['info']) > 0:
for errorMsg in TM.CTestsuitesCfg.oConfig.sLoadedCfgLog['info']:
logger.error(errorMsg)
for infoMsg in TM.CTestsuitesCfg.oConfig.sLoadedCfgLog['info']:
if infoMsg.strip() != '':
logger.error(infoMsg)
BuiltIn().unknown(TM.CTestsuitesCfg.oConfig.sLoadedCfgLog['unknown'])
return
if not TM.CTestsuitesCfg.oConfig.rConfigFiles.bLevel1:
Expand All @@ -83,10 +85,12 @@ def testsuite_setup(self, sTestsuiteCfgFile=''):
except:
if len(TM.CTestsuitesCfg.oConfig.sLoadedCfgLog['error']) > 0:
for errorMsg in TM.CTestsuitesCfg.oConfig.sLoadedCfgLog['error']:
logger.error(errorMsg)
if errorMsg.strip() != '':
logger.error(errorMsg)
if len(TM.CTestsuitesCfg.oConfig.sLoadedCfgLog['info']) > 0:
for errorMsg in TM.CTestsuitesCfg.oConfig.sLoadedCfgLog['info']:
logger.error(errorMsg)
for infoMsg in TM.CTestsuitesCfg.oConfig.sLoadedCfgLog['info']:
if infoMsg.strip() != '':
logger.error(infoMsg)
BuiltIn().unknown(TM.CTestsuitesCfg.oConfig.sLoadedCfgLog['unknown'])

if TM.CTestsuitesCfg.oConfig.rConfigFiles.bLevel1:
Expand Down

0 comments on commit f7f51cb

Please sign in to comment.