Skip to content

Remove criticality - #3662

Merged
yanne merged 16 commits into
masterfrom
remove-criticality
Sep 15, 2020
Merged

yanne merged 16 commits into
masterfrom
remove-criticality

Conversation

@yanne

@yanne yanne commented Sep 11, 2020

Copy link
Copy Markdown
Member

No description provided.

@yanne
yanne requested a review from pekkaklarck September 11, 2020 09:21
@mkorpela

Copy link
Copy Markdown
Member

Only 81 files 🤣

@mkorpela

mkorpela commented Sep 12, 2020 •

Copy link
Copy Markdown
Member

Some notes about criticality use cases to check if we can cover these also in the future:

Criticality seems to be mostly used to control execution return code. Making the execution to return 0 to indicate to continuous integration server or other execution service that operations should continue normally.

Static cases:

  • not-ready tag where a test/task is executed on automated system to ensure it almost works but should not affect the outcome (for example when building the test/task or debugging it)
  • flaky tag where a test/task is known or thought to have some problems and is under investigation

Dynamic cases:

  • environment-error tag where a test/task detects during execution that it can not be executed (SKIP case)

Any other?

@mkorpela

mkorpela commented Sep 12, 2020 •

Copy link
Copy Markdown
Member

I think --skiponfailure will cover the two static cases I had in mind

@pekkaklarck pekkaklarck left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great but I found few smallish things that could be still addressed. Assuming tests pass, this PR is otherwise ready to be merged.

'Any Critical Tests Failed')
if suite.statistics.critical.failed > 0:
return self.run_keyword(name, *args)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These keywords should be deprecated, not removed. They should be basically aliases for the all tests variants. Tests can be removed.

Comment thread src/robot/model/totalstatistics.py Outdated

def __iter__(self):
return iter([self.critical, self.all])
return iter([self.all])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could just be yield self.all.

Comment thread src/robot/model/totalstatistics.py Outdated
For example::

2 critical tests, 1 passed, 1 failed
2 tests total, 1 passed, 1 failed

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the version we use just 2 tests, ..., not 2 tests total, ...?

Comment thread src/robot/model/totalstatistics.py Outdated
"""
test_or_task = 'test' if not self._rpa else 'task'
ctotal, cend, cpass, cfail = self._get_counts(self.critical)
atotal, aend, apass, afail = self._get_counts(self.all)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a prefix can be removed because c variants have been removed.

Comment thread src/robot/rebot.py
settings = RebotSettings(options)
LOGGER.register_console_logger(**settings.console_output_config)
if settings['XUnitSkipNonCritical']:
LOGGER.warn("Command line option --xunitskipnoncritical has been deprecated.")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously these cli option deprecations have been handled when validating settings (_BaseSettings._process_value if I remember correctly) and I think it would be a bit better with this option as well.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason, when I added the deprecation warning there, the warning message was echoed twice to console. Something to do with register_console_logger I suppose.

Comment thread src/robot/result/model.py
if not self.parent:
return True
return self.parent.criticality.test_is_critical(self)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property could be preserved with this kind of implementation:

warnigs.warn("'TestCase.criticality' has been deprecated and always returns 'True'.", 
             UserWarning)
return True

Comment thread src/robot/result/model.py
if self.parent is not None:
raise ValueError('Criticality can only be set to the root suite.')
self._criticality = Criticality(critical_tags, non_critical_tags)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although I think preserving TestCase.critical is a good idea, I would say these methods can be safely removed.

Comment thread src/robot/run.py
settings = RobotSettings(options)
LOGGER.register_console_logger(**settings.console_output_config)
if settings['XUnitSkipNonCritical']:
LOGGER.warn("Command line option --xunitskipnoncritical has been deprecated.")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving deprecation to settings, as I commented earlier, would avoid this duplication.


def critical_failure_occurred(self):
self.exit.failure_occurred(critical=True)
self.exit.failure_occurred()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably remove critical_ from the method name.

Comment thread atest/robot/cli/runner/status_rc.robot Outdated
-c pass --status ${FAILING} rc=0

Non-zero RC when critical tests fail
Non-zero RC when ests fail

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ests -> tests

Janne Härkönen added 2 commits September 15, 2020 13:58
They must be properly deprected before they can be removed
@yanne
yanne merged commit 5515263 into master Sep 15, 2020
@yanne
yanne deleted the remove-criticality branch November 26, 2020 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants