Class: EasyqaApi::TestCase

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

Overview

Test case 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

#attributesHash

Returns item attributes from response body in your requests.

Returns:

  • (Hash)

    item attributes from response body in your requests



23
# File 'lib/easyqa_api/items/test_case.rb', line 23

attr_accessor :title, :id, :attributes, :project_token, :module_id

#idFixnum

Returns The uniq identeficator item on EasyQA website.

Returns:

  • (Fixnum)

    The uniq identeficator item on EasyQA website



23
# File 'lib/easyqa_api/items/test_case.rb', line 23

attr_accessor :title, :id, :attributes, :project_token, :module_id

#module_idString

Returns Test module id on EasyQA.

Returns:

  • (String)

    Test module id on EasyQA



23
# File 'lib/easyqa_api/items/test_case.rb', line 23

attr_accessor :title, :id, :attributes, :project_token, :module_id

#project_tokenString

Returns your project token.

Returns:

  • (String)

    your project token



23
# File 'lib/easyqa_api/items/test_case.rb', line 23

attr_accessor :title, :id, :attributes, :project_token, :module_id

#titleString

Returns Test case title on EasyQA.

Returns:

  • (String)

    Test case title on EasyQA



23
24
25
# File 'lib/easyqa_api/items/test_case.rb', line 23

def title
  @title
end

Class Method Details

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

List of all test cases

Parameters:

  • attrs (Hash)

    attributes for action

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

    authenticated user in EasyQA

Options Hash (attrs):

  • :project_token (String)

    project_token on EasyQA website

  • :parent_name (String)

    Can be “test_plan” or “test_module”.

  • :parent_id (Fixnum)

    Id of test plan and test module according

Returns:

  • (Array)

    list of test_cases on EasyQA website

See Also:



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

def self.all(attrs, user = @@default_user)
  send_request("#{attrs[:parent_name]}/#{attrs[:parent_id]}/test_cases", :get) do |req|
    req.params = {
      auth_token: user.auth_token,
      token: attrs[:project_token]
    }
  end
end

Instance Method Details

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

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

Parameters:

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

    authenticated user in EasyQA

  • attrs (Hash)

    attributes for action

Options Hash (attrs):

  • :project_token (String) — default: @project_token

    Project token on EasyQA

  • :title (String)

    test case title on EasyQA website

  • :pre_steps (String)

    test case pre steps

  • :steps (String)

    Test Case steps.

  • :expected_result (String)

    Test Case expected result.

  • :case_type (String)

    Type of test case. Can be ‘positive’, ‘negative’, ‘boundary’, ‘integration’, ‘ui’ or ‘localization’

  • :test_module_id (Fixnum)

    Test module id

Returns:

  • (Hash)

    item attribtues on EasyQA website

See Also:



47
48
49
50
51
52
53
54
55
56
# File 'lib/easyqa_api/items/test_case.rb', line 47

def create(attrs, user = @@default_user)
  attrs = { project_token: @project_token, module_id: @module_id }.merge(attrs)
  @attributes = send_request("test_modules/#{attrs[:module_id]}/test_cases", :post) do |req|
    req.body = {
      test_case: attrs.except(:project_token, :module_id),
      token: attrs[:project_token],
      auth_token: user.auth_token
    }
  end
end

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

Delete Test Case 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:



85
86
87
88
89
90
91
92
# File 'lib/easyqa_api/items/test_case.rb', line 85

def delete(project_token = @project_token, id = @id, user = @@default_user)
  @attributes = send_request("test_cases/#{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 Case 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:



60
61
62
63
64
65
66
67
# File 'lib/easyqa_api/items/test_case.rb', line 60

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

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

Update Test Case on EasyQA website. Have a class method analog

Parameters:

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

    authenticated user in EasyQA

  • attrs (Hash)

    attributes for action

Options Hash (attrs):

  • :project_token (String) — default: @project_token

    Project token on EasyQA

  • :title (String)

    test case title on EasyQA website

  • :pre_steps (String)

    test case pre steps

  • :steps (String)

    Test Case steps.

  • :expected_result (String)

    Test Case expected result.

  • :case_type (String)

    Type of test case. Can be ‘positive’, ‘negative’, ‘boundary’, ‘integration’, ‘ui’ or ‘localization’

  • :id (Fixnum) — default: @id

    item id

Returns:

  • (Hash)

    item attribtues on EasyQA website

See Also:



72
73
74
75
76
77
78
79
80
81
# File 'lib/easyqa_api/items/test_case.rb', line 72

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