Coder Social home page Coder Social logo

zephyr-python-api's Introduction

Zephyr-python-api

PyPI - Python Version PyPI PyPI - License

Project description

This is a set of wrappers for Zephyr Scale (TM4J) REST API. This means you can interact with Zephyr Scale without GUI, access it with python code and create automation scripts for your every day interactions.

For more detailed information please see the project's documentation.

To be done:

  • More usage examples
  • Tests, tests and tests for gods of testing
  • Convenient docs
  • Implementing higher level wrappers representing Test Case, Test Cycle, etc.

Installation

pip install zephyr-python-api

Example usage

Zephyr Cloud auth:

from zephyr import ZephyrScale

zscale = ZephyrScale(token="<your_token>")

Zephyr Server (TM4J) auth:

from zephyr import ZephyrScale

# Auth can be made with Jira token
auth = {"token": "<your_jira_token>"}

# or with login and password (suggest using get_pass)
auth = {"username": "<your_login>", "password": "<your_password>"}

# or even session cookie dict
auth = {"cookies": "<session_cookie_dict>"}

zscale = ZephyrScale.server_api(base_url="<your_base_url>", **auth)

Then it is possible to interact with api wrappers:

zapi = zscale.api

# Get all test cases
all_test_cases = zapi.test_cases.get_test_cases()

# Get a single test case by its id
test_case = zapi.test_cases.get_test_case("<test_case_id>")

# Create a test case
creation_result = zapi.test_cases.create_test_case("<project_key>", "test_case_name")

License

This library is licensed under the Apache 2.0 License.

Links

Zephyr Scale Cloud API docs

Zephyr Scale Server API docs

zephyr-python-api's People

Contributors

crapitea avatar jay-2597 avatar nassauwinter avatar

Stargazers

 avatar

Watchers

 avatar  avatar

zephyr-python-api's Issues

AutomationEndpoints are not implemented

We are using Zephyr Scale for our project and I need to use the automation endpoints to send automation reports (cucumber) to zephyr scale cloud. However I see that those endpoints just raise NotImplementedError which means they are not yet implemented. Is there any plan to support these endpoints soon?

[Cloud] Refactor and update Zephyr Scale Cloud endpoints

Description

The wrappers for Zephyr Scale Cloud endpoints should be updated: new endpoints appeared.

To do list:

  • Refactor: move Cloud endpoints to a single .py file (like in the server part) for consistence reasons;
  • Update: add new endpoints from API docs

This should create testplan cloud endpoints which were mentioned in #14.

Zephyr Scale Server REST API for iterations

From what I've observed, the current Zephyr Scale Server API doesn't have an Endpoint for Iterations: https://support.smartbear.com/zephyr-scale-server/api-docs/v1/

Looking at their interface, it seems like they are using a different API endpoint for generating / listing iterations:
https://jira.project.com/rest/tests/1.0/ vs https://jira.project.com/rest/atm/1.0/

So, for example, to get the iterations for a specific project, using the undocumented API, you can just do:
https://jira.project.com/rest/tests/1.0/iteration?projectId=11101

Without enabling the support for these APIs, the things you can do in Zephyr Scale with this module will remain limited. That being said, shouldn't the architecture be modified a bit so that both endpoints are supported?

Internal Server Error - 500 /// API not Working

@nassauwinter @crapitea ,

Facing issue HTTP Error - 500 when using the api function - create_step_attachment in TestCaseEndpoints class.
API endpoint --- /testcase/{testCaseKey}/step/{stepIndex}/attachments
Seems The post api is not working. Already Verified that get API for same is working fine.

Traceback (most recent call last):
File "c:\work\work1\file1.py", line 107, in
test_object.step_attachments(index=0, files=file_path)
File "c:\work\work1\file2.py", line 99, in step_attachments
self.zapi.test_cases.create_step_attachment(test_case_key=self.test_id, step_index=index, file_path=files)
File "C:\Users\pateljay\AppData\Local\Programs\Python\Python312\Lib\site-packages\zephyr\scale\server\endpoints\endpoints.py", line 54, in create_step_attachment
return self.session.post(Paths.CASE_STP_ATTACH.format(test_case_key, step_index),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\pateljay\AppData\Local\Programs\Python\Python312\Lib\site-packages\zephyr\scale\zephyr_session.py", line 76, in post
return self._request("post", endpoint, json=json, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\pateljay\AppData\Local\Programs\Python\Python312\Lib\site-packages\zephyr\scale\zephyr_session.py", line 68, in _request
raise HTTPError(f"Error {response.status_code}. Response: {response.content}")
requests.exceptions.HTTPError: Error 500. Response: b''

Fix PR check: Pylint on python 3.11

Job output:

tox: py311
  py311: commands[0]> pipenv install --dev --skip-lock
  Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.
  The flag --skip-lock has been reintroduced (but is not recommended).  Without 
  the lock resolver it is difficult to manage multiple package indexes, and hash 
  checking is not provided.  However it can help manage installs with current 
  deficiencies in locking across platforms.
  Installing dependencies from Pipfile...
  Installing dependencies from Pipfile...
  To activate this project's virtualenv, run pipenv shell.
  Alternatively, run a command inside the virtualenv with pipenv run.
  py[31](https://github.com/nassauwinter/zephyr-python-api/actions/runs/8686674623/job/23819125124?pr=19#step:6:32)1: commands[1]> python --version
  Python 3.11.9
  py311: commands[2]> pip --version
  pip 24.0 from /home/runner/work/zephyr-python-api/zephyr-python-api/.tox/py311/lib/python3.11/site-packages/pip (python 3.11)
  py311: commands[3]> pylint --version
  pylint 3.1.0
  astroid 3.1.0
  Python 3.11.9 (main, Apr  2 2024, 15:20:57) [GCC 9.4.0]
  py311: commands[4]> pylint --rcfile .pylintrc zephyr
  pylint: Command line or configuration file:1: UserWarning: 'BaseException' is not a proper value for the 'overgeneral-exceptions' option. Use fully qualified name (maybe 'builtins.BaseException' ?) instead. This will cease to be checked at runtime when the configuration upgrader is released.
  pylint: Command line or configuration file:1: UserWarning: 'Exception' is not a proper value for the 'overgeneral-exceptions' option. Use fully qualified name (maybe 'builtins.Exception' ?) instead. This will cease to be checked at runtime when the configuration upgrader is released.
  ************* Module zephyr.scale.zephyr_session
  zephyr/scale/zephyr_session.py:96:12: R17[37](https://github.com/nassauwinter/zephyr-python-api/actions/runs/8686674623/job/23819125124?pr=19#step:6:38): Use 'yield from' directly instead of yielding each element one by one (use-yield-from)

Automate Reports of zephyr scale test execution

Thank you for your strong supports.

We like to automate the reporting taking activity from Zephyr scale.

Now we are manually doing following steps:
Zephyr scale App in JIRA > Reports > Test execution results (list) > filter with 'Test Plan' > Generate > Export Excel.

We need to export this excel everyday at a particular time. Could you please share API or method to do it automatically.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.