dmcneil / qtest-ruby

A client for the QTest REST API.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

QTest::Ruby

A REST client for the QTest.

Installation

Add this line to your application's Gemfile:

gem 'qtest-ruby'

And then execute:

$ bundle

Or install it yourself as:

$ gem install qtest-ruby

Configure/Authenticate

Require the gem in your code.

require 'qtest'

Create a QTest::Client and configure it with the base host/address of your QTest instance and call the auth method passing in a Hash with your QTest credentials.

QTest::Client.new.configure do |c|
  c.base_uri = 'http://qtest.yourcompany.com'
  c.auth username: 'foo', password: 'bar'
end

The client is set on all QTest:: objects and will be used for requests.

Usage

The typical entry point for the API begins with a QTest::Project.

@project = QTest::Project.find_by(id: 1)

With a QTest::Project you can begin to dive down into child objects such as releases, test cycles, and test suites by chaining relationships.

# Get a Release with an ID of 3 under the current Project
@release = @project.release(id: 3)

# Get a Test Cycle with an id of 4 under the Release
@test_cycle = @release.test_cycle(id: 4)

# Get all Test Suites under the Test Cycle
@test_suites = @test_cycle.test_suites

# Get all Test Runs under the first Test Suite
@test_runs = @test_suites.first.test_runs

Of course, you can skip having to chain parent to children to find what you need by using the find_by method.

# Find a specific Test Suite under the current Project
@test_suite = QTest::TestSuite.find_by(project: @project, id: 5)

You don't have to pass in an object for the parent, you can simply use an ID.

# Find a specific Test Suite under a Project
@test_suite = QTest::TestSuite.find_by(project: 3, id: 5)

Query parameters can also be passed:

# Get all Test Cases after page 5 with properties expanded under a Project Module
@test_cases = QTest::TestCase.find_by(project: 3, module: 2, page: 5, expand_properties: true)

Some APIs are curently missing (TODO: list of NYI).

The complete QTest API documentation can be found here.

License

The gem is available as open source under the terms of the MIT License.

About

A client for the QTest REST API.

License:MIT License


Languages

Language:Ruby 100.0%