Skip to main content

robotframework integration with kiwi TCMS

Project description

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

This package allows you execute your Robot Framework test suite and report the results into Kiwi TCMS.

Installation

pip install kiwitcms-robotframework-plugin

Configuration and environment

Minimal config file ~/.tcms.conf:

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

For more info see tcms-api docs.

Each RF suite may define the following variables:

  • ${plan_id}: Existing TestPlan ID for storing test execution results. WARNING: this plugin will create a new TestRun whenever plan_id changes! If subsequent test scenarios, aka .robot files don’t override plan_id the current one will be used!

  • ${product}: Existing product name when creating a new TestPlan

  • ${build_user_email}: Email for an existing user

Documentation from test suite(s) is used when creating new TestRun(s).

Each RF test case may also specify the TC-xyz tag to map to an existing TestCase in the database. For example:

*** 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"

Documentation from test cases is used when creating new TestCase records in the database.

Usage

robot --listener zealand.listener.KiwiTCMS

Extension and customization

You can customize the behavior of this plugin by extending the listener and backend classes and overriding some of their methods. For example save the following in 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

then instruct Robot Framework to use the overriden listener instead of the default one:

robot --listener path/to/acme_tools.py

Changelog

v1.0.0 (04 May 2020)

  • Initial release

  • Original implementation by Aniello Barletta

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kiwitcms-robotframework-plugin-1.0.0.tar.gz (20.4 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file kiwitcms-robotframework-plugin-1.0.0.tar.gz.

File metadata

  • Download URL: kiwitcms-robotframework-plugin-1.0.0.tar.gz
  • Upload date:
  • Size: 20.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.6.9

File hashes

Hashes for kiwitcms-robotframework-plugin-1.0.0.tar.gz
Algorithm Hash digest
SHA256 40873590f12653100af2e88861e0686f58661ef3cd8e62b87069ff4d70752e62
MD5 3220d2b9b102aed6367ff5cb7a0a109c
BLAKE2b-256 664da7dafac054f09260c89294ce9c8be1457c2c156f8c8325c9b9dfcca3564f

See more details on using hashes here.

File details

Details for the file kiwitcms_robotframework_plugin-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: kiwitcms_robotframework_plugin-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 18.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.6.9

File hashes

Hashes for kiwitcms_robotframework_plugin-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 02664171b94f5ee72999eff8291b0237c939d4a478d4fa8b858a11f20a22e076
MD5 820103f1b1d4c8ee1b4e28a0c2c10d16
BLAKE2b-256 219ac1a0194a864254a1c47e715d17a4117a25e43e60e4b17a7582def4393c11

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page