机械手框架:将套件设置为非关键

时间:2020-04-08 14:28:33

标签: robotframework

TLDR:是否可以将特定套件本身标记为非关键?

我正在使用rebot合并几个相同的测试,即具有不同结果的相同测试。

我想创建一个新的合并日志,如果最新的成功,则显示PASS。为了解决这个问题,我做了一个类似的TestStatusChecker函数,如下所示:

Robot Framework: How to merge old/new statuses using rebot --merge and keep the only one?

请参见下面的代码。这样就可以将所有测试设置为非关键测试,最后一组除外。哪个可行,但是较旧的失败日志显示为绿色,这可能会引起误导。

enter image description here

我希望套件说失败(红色),但是对于不使新的合并日志失败不会很关键。这可能吗?如果没有,还有其他选择吗?

TestStatusChecker.py

from robot.api import SuiteVisitor


class TestStatusChecker(SuiteVisitor):

def __init__(self, *args):
    pass

def visit_suite(self, suite):
    # Map timestamps to suite status.
    suites_status = {}
    for sutie in suite.suites:
        suites_status[sutie.starttime] = sutie.status

    # Get the most recent suite timestamp.
    most_recent_log = 0
    for element in suites_status:
        if most_recent_log == 0 or most_recent_log < element:
            most_recent_log = element

    # Set all suites, except for the most recent one, to non critical.
    for sutie in suite.suites:
        if (sutie.starttime == most_recent_log):
            for test in sutie.tests:
                test.tags = "critical" # This makes normally non critical tests critical
        else:
            # sutie.tags = "suite-non-critical" # Here I would like to set the suite as non critical.
            for test in sutie.tests:
                test.tags = "suite-non-critical"

0 个答案:

没有答案