Code Monkey home page Code Monkey logo

testdroid-api-client-ruby's Introduction

Gem Version

Testdroid API Client for Ruby

Installation

# Gemfile
gem "testdroid-api-client"
> bundle install

Sample client usage - Authenticate

require 'testdroid-api-client'

client = TestdroidAPI::Client.new('admin@localhost', 'admin')

Sample usage - get projects

 @user = client.authorize
 projects = @user.projects.list

Get project by id

project_id = 123
project123 = @user.projects.get(project_id)
#output project name
p "Project name #{project123.name}"

Get project by name

project = @user.projects.list({:filter => "s_name_eq_MyProject"})[0]

Get available frameworks

frameworks = @user.available_frameworks.list

Find specific framework

framework = @user.available_frameworks.list({:filter => "s_osType_eq_ANDROID;s_name_like_%Instrumentation"})[0]

Upload files

file_app = @user.files.upload(File.join(File.dirname(__FILE__), "BitbarSampleApp.apk"))
file_test = @user.files.upload(File.join(File.dirname(__FILE__), "BitbarSampleAppTest.apk"))

Start test run

test_run = @user.runs.create("{\"osType\": \"ANDROID\", \"projectId\": #{project.id}, \"frameworkId\":#{framework_id},
  \"deviceIds\": #{id_list}, \"files\": [{\"id\": #{file_app.id}, \"action\": \"INSTALL\" },
  {\"id\": #{file_test.id}, \"action\": \"RUN_TEST\" }]}")

#See full list of params: https://docs.bitbar.com/testing/api/tests/index.html#details-about-the-configuration-fields

Download all files from test run

test_run.device_sessions.list({:limit => 0}).each { |ds| ds.download_all_files("YOUR_PATH") }

Get all input files

files = @user.files
files.list({:limit => 40,:filter => "s_direction_eq_INPUT"}).each { 
    |f| puts "File id: #{f.id} name: #{f.name}" }

See https://cloud.bitbar.com/cloud/swagger-ui.html for more details about API V2, make sure you are logged in.

Local development

  1. Install ruby
  2. bundle install
  3. Run tests: rspec, remove spec/fixtures/cassettes if you want to execute real Http requests

testdroid-api-client-ruby's People

Watchers

 avatar  avatar

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.