GithubHelp home page GithubHelp logo

enriquegh / testobject-python-api Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 2.0 16.82 MB

TestObject Python client library

License: MIT License

Python 100.00%
python testobject wrapper-api appium-suite testobject-python-api api saucelabs

testobject-python-api's Introduction

testobject-python-api

Build Status Build status codecov PyPI version

NOTE: This project is now archived. Please consider using Sauce Labs' Unified Platform instead.

A Python library client for TestObject API

For more on the API you can visit TestObject's docs here.

Getting Started

Installing

To install on your machine run:

pip install testobject

Once installed you can run something like:

import testobject
client = testobject.TestObject('myusername','my_api_key', password='password')
# Password only needed if using Session Reports
response = client.devices.get_devices()
devices = response.json()
us_devices = devices['US']

Running the tests

Tests are done with pytest. To run these simply run:

pytest

Docs

Get All Devices

response = client.devices.get_devices()
devices = response.json()
us_devices = devices['US']

Get Available Devices

response = client.devices.get_available_devices()
devices = response.json()
us_devices = devices['US']

Get Device

response = client.devices.get_device('iPhone_5_free')
device = response.json()

Get Session Reports

response = client.devices.get_session_reports(last_days=30, offset=1, limit=50)
reports = response.json()

Update Appium Suite

data = {}
data['title'] = "New Suite Title"
response = client.suites.update_suite(suite_number,data)
content = response.json()

Start Appium Suite Report

report = {'className': 'TOTestClass', 'dataCenterId': 'US', 'methodName': 'testMethod', 'deviceId': 'iPhone_5_free'}
data = [report] # If more than one test and/or class add more reports to the data list
response = to.suites.start_suite(suite_number, data)
content = response.json()

Stop Appium Suite Report

response = to.suites.stop_suite(suite_number, suite_report_number)
content = response.json()

Stop Appium Suite Test

response = to.suites.stop_suite_test(suite_number, suite_report_number, suite_test_number, True)
content = response.json()

Skip Appium Suite Test

response = to.suites.stop_suite_test(suite_number, suite_report_number, suite_test_number)
content = response.json()

Skip Appium Test Report

response = to.watcher.skip_test_report(appium_session_id)

Send Appium Test Report

response = to.watcher.report_test_result(appium_session_id,True)

Upload Application to Project

response = to.storage.upload_app(upload_app_path, display_name, False)

Get Test Report

response = to.reports.get_test_report(test_report_id)

Get Screenshot

response = to.reports.get_screenshot(test_report_id, screenshot_id)

Get Session Video

response = to.reports.get_video(video_id)

Get Appium Log

response = to.reports.get_appium_log(test_report_id)

Get Device Log

response = to.reports.get_device_log(test_report_id)

Get Device Vitals Log

response = to.reports.get_vitals_log(test_report_id)

Get XCUITest Log

response = to.reports.get_xcuitest_log(test_report_id)

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details

testobject-python-api's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

testobject-python-api's Issues

Make request method return a Response object rather than just json

This makes the wrapper for flexible and gives the user more things to do with whatever TO is sending. Another big reason is that one of the watcher methods doesn't respond with any content and this breaks the request logic since it can't parse the text into json.

Get TestObject reports through wrapper API

As of now, in the wrapper API, we do not have a way to capture reports of devices (rest/v1/devices/reports).

This issue is to track the functionality to implement the same.

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.