跳转到主要内容

kiwi TCMS与robotframework集成

项目描述

PyPI version Python updates TP for kiwitcms/robotframework-plugin (master) Tidelift Kiwi TCMS on Twitter

此包允许您执行您的Robot Framework测试套件并将结果报告到Kiwi TCMS

安装

pip install kiwitcms-robotframework-plugin

配置和环境

最小配置文件 ~/.tcms.conf

[tcms]
url = https://tcms.server/xml-rpc/
username = your-username
password = your-password

有关更多信息,请参阅tcms-api文档

每个RF测试套件可以定义以下变量

  • ${plan_id}:用于存储测试执行结果的现有测试计划ID。 警告:此插件将在plan_id更改时创建新的测试运行!如果后续测试场景(即.robot文件)未覆盖plan_id,则将使用当前的一个!

  • ${product}:创建新测试计划时使用的现有产品名称

  • ${build_user_email}:现有用户的电子邮件,使用TCMS_DEFAULT_TESTER_ID覆盖!

创建新测试运行时使用测试套件(的)的文档。

每个RF测试用例还可以指定TC-xyz标签以映射到数据库中的现有测试用例。例如

*** Settings ***
Documentation   An example test suite
Library         OperatingSystem

*** Variables ***
${plan_id}      234

*** Test Cases ***
Scenario Maps To Existing TestCase
    [Tags]    TC-607  arbitrary_tag_here
    Should Be Equal    "Hello"    "Hello"

Hello World Scenario
    [Documentation]    This will be the text of the new TC created in DB
    Should Be Equal    "Hello"    "Hello"

测试用例文档在数据库中创建新的TestCase记录时被使用。

用法

robot --listener zealand.listener.KiwiTCMS

扩展和自定义

您可以通过扩展监听器和后端类以及重写它们的一些方法来自定义此插件的行为。例如,将以下内容保存到 acme_tools.py

from zealand.listener import KiwiTCMS
from zealand.listener import RFBackend


class JenkinsBackend(RFBackend):
    def get_run_id(self):
        """
            If ${node_name} is specified then tag the TR with "node: X" tag!

            This is done right after a new TR is created!
        """
        run_id = super().get_run_id()

        node_name = self.built_in.get_variable_value('${node_name}')
        if node_name:
            self.rpc.TestRun.add_tag(run_id, 'node: %s' % node_name)
        return run_id

    def finish_test_run(self):
        """
            Do not set TR.stop_date !!!

            If ${jenkins_tag} is specified then tag the TR with it!

            This is executed at the end of each TestRun after all
            execution results have been reported.
        """
        # do not call the inherited method b/c we want to keep these
        # test runs open for inspection by a human !!!
        # super().finish_test_run()

        jenkins_tag = self.built_in.get_variable_value('${jenkins_tag}')
        if jenkins_tag:
            self.rpc.TestRun.add_tag(self.run_id, jenkins_tag)

class AcmeCorpListener(KiwiTCMS):
    backend_class = JenkinsBackend

    def end_test(self, name, attrs):
        """
            You may also find it more appropriate to override a
            listener class instead.
        """
        super().end_test(name, attrs)

        for tag in attrs['tags']:
            if tag.startswith('JIRA-'):
                # hyperlink the results between Kiwi TCMS, Jenkins & JIRA
                # by posting comments everywhere

然后指示Robot Framework使用重写的监听器而不是默认的监听器

robot --listener path/to/acme_tools.py

更新日志

v12.7 (10 Dec 2023)

  • 将robotframework从5.0更新到6.1.1

  • 将tcms-api从11.2更新到12.7

  • 放宽tcms-api依赖,要求>=. 关闭问题 #63

  • 使用Python 3.11构建和测试

v11.2 (15 May 2022)

  • 将robotframework从4.1.2更新到5.0

  • 将tcms-api从11.0更新到11.2

  • 在通过电子邮件搜索用户时忽略403错误

  • 创建的记录带有插件名称和版本注解

v11.0 (06 Dec 2021)

  • 与即将到来的Kiwi TCMS v11.0兼容

  • 将robotframework从3.2.2更新到4.1.2

  • 将tcms-api从10.0更新到11.0

  • Pylint修复

v10.0 (02 Mar 2021)

  • 与Kiwi TCMS v10.0兼容

  • 更新tcms-api到10.0

v9.0 (13 Jan 2020)

  • 与Kiwi TCMS v9.0兼容

  • 更新tcms-api到9.0

v1.1.0 (28 Oct 2020)

  • 更新tcms-api到8.6.0

  • 更新robotframework到3.2.2

v1.0.0 (04 May 2020)

  • 首次发布

  • 原始实现由Aniello Barletta完成

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分布

kiwitcms-robotframework-plugin-12.7.tar.gz (18.9 kB 查看散列)

上传时间

构建分布

kiwitcms_robotframework_plugin-12.7-py3-none-any.whl (19.3 kB 查看散列)

上传时间 Python 3

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面