Class: EasyqaApi::TestRun

Inherits:
Item
  • Object
show all
Defined in:
lib/easyqa_api/items/test_run.rb

Overview

Test Run representation from EasyQA website

Constant Summary

Constants inherited from Item

Item::CONNECTION

Constants included from ClassMethodsSettable

ClassMethodsSettable::METHODS

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Item

#initialize, #install_variables!, json_connection, multipart_connection, operation_status, send_request

Methods included from ClassMethodsSettable

#install_class_methods!

Constructor Details

This class inherits a constructor from EasyqaApi::Item

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



25
26
27
# File 'lib/easyqa_api/items/test_run.rb', line 25

def attributes
  @attributes
end

#idObject

Returns the value of attribute id.



25
26
27
# File 'lib/easyqa_api/items/test_run.rb', line 25

def id
  @id
end

#project_tokenObject

Returns the value of attribute project_token.



25
26
27
# File 'lib/easyqa_api/items/test_run.rb', line 25

def project_token
  @project_token
end

#titleObject

Returns the value of attribute title.



25
26
27
# File 'lib/easyqa_api/items/test_run.rb', line 25

def title
  @title
end

Class Method Details

.all(project_token, user = @@default_user) ⇒ Array

List of all test runs in project

Parameters:

  • user (Easyqapi::User) (defaults to: @@default_user)

    authenticated user in EasyQA

  • project_token (String)

    token of project

Returns:

  • (Array)

    list of test runs on EasyQA website

See Also:



34
35
36
37
38
39
40
41
# File 'lib/easyqa_api/items/test_run.rb', line 34

def self.all(project_token, user = @@default_user)
  send_request('test_runs', :get) do |req|
    req.params = {
      auth_token: user.auth_token,
      token: project_token
    }
  end
end

Instance Method Details

#create(attrs, user = @@default_user) ⇒ Hash

Note:

If you add test plan id to tes_run_result_attributes all test cases from this test plan has been included to your test run

Create test run on EasyQA website. Have a class method analog

Parameters:

  • user (Easyqapi::User) (defaults to: @@default_user)

    authenticated user in EasyQA

  • attrs (Hash)
    • :project_token (String) [@project_token] Project token on EasyQA

    • :title (String) test run title on EasyQA website

    • :assigner_id (Fixnum) test run assigner id on EasyQA website

    • :test_plan_id (Fixnum) test plan id on EasyQA website

    • :description (String) test run description on EasyQA website

    • :test_run_result_attributes (Array<Hash>) attributes of test run results.

      • :test_plan_id (Fixnum) id of test plan

      • :test_case_id (Fixnum) test case id

      • :id (Fixnum) test run result id

      • :_destroy (TrueClass, FalseClass) if you set this attribute true with attribute id, this test run result will be deleted

Returns:

  • (Hash)

    item attribtues on EasyQA website

See Also:



45
46
47
48
49
50
51
52
53
54
# File 'lib/easyqa_api/items/test_run.rb', line 45

def create(attrs, user = @@default_user)
  attrs = { project_token: @project_token }.merge(attrs)
  @attributes = send_request('test_runs', :post) do |req|
    req.body = {
      test_run: attrs.except(:project_token),
      token: attrs[:project_token],
      auth_token: user.auth_token
    }
  end
end

#delete(project_token = @project_token, id = @id, user = @@default_user) ⇒ Hash

Delete test run on EasyQA website. Have a class method analog

Parameters:

  • user (Easyqapi::User) (defaults to: @@default_user)

    authenticated user in EasyQA

  • project_token (String) (defaults to: @project_token)

    token of project

  • id (String) (defaults to: @id)

    item id

Returns:

  • (Hash)

    item attribtues on EasyQA website

See Also:



83
84
85
86
87
88
89
90
# File 'lib/easyqa_api/items/test_run.rb', line 83

def delete(project_token = @project_token, id = @id, user = @@default_user)
  @attributes = send_request("test_runs/#{id}", :delete) do |req|
    req.params = {
      token: project_token,
      auth_token: user.auth_token
    }
  end
end

#show(project_token = @project_token, id = @id, user = @@default_user) ⇒ Hash

Show test run from EasyQA website. Have a class method analog

Parameters:

  • user (Easyqapi::User) (defaults to: @@default_user)

    authenticated user in EasyQA

  • project_token (String) (defaults to: @project_token)

    token of project

  • id (String) (defaults to: @id)

    item id

Returns:

  • (Hash)

    item attribtues on EasyQA website

See Also:



58
59
60
61
62
63
64
65
# File 'lib/easyqa_api/items/test_run.rb', line 58

def show(project_token = @project_token, id = @id, user = @@default_user)
  @attributes = send_request("test_runs/#{id}", :get) do |req|
    req.params = {
      token: project_token,
      auth_token: user.auth_token
    }
  end
end

#update(attrs, user = @@default_user) ⇒ Hash

Note:

If you add test plan id to tes_run_result_attributes all test cases from this test plan has been included to your test run

Update test run on EasyQA website. Have a class method analog

Parameters:

  • user (Easyqapi::User) (defaults to: @@default_user)

    authenticated user in EasyQA

  • attrs (Hash)
    • :project_token (String) [@project_token] Project token on EasyQA

    • :title (String) test run title on EasyQA website

    • :assigner_id (Fixnum) test run assigner id on EasyQA website

    • :test_plan_id (Fixnum) test plan id on EasyQA website

    • :description (String) test run description on EasyQA website

    • :test_run_result_attributes (Array<Hash>) attributes of test run results.

      • :test_plan_id (Fixnum) id of test plan

      • :test_case_id (Fixnum) test case id

      • :id (Fixnum) test run result id

      • :_destroy (TrueClass, FalseClass) if you set this attribute true with attribute id, this test run result will be deleted

Options Hash (attrs):

  • :id (Fixnum) — default: @id

    test run id

Returns:

  • (Hash)

    item attribtues on EasyQA website

See Also:



70
71
72
73
74
75
76
77
78
79
# File 'lib/easyqa_api/items/test_run.rb', line 70

def update(attrs, user = @@default_user)
  attrs = { id: @id, project_token: @project_token }.merge(attrs)
  @attributes = send_request("test_runs/#{attrs[:id]}", :put) do |req|
    req.body = {
      test_run: attrs.except(:project_token, :id),
      token: attrs[:project_token],
      auth_token: user.auth_token
    }
  end
end