Class: TestRail::TestCase
- Inherits:
-
Object
- Object
- TestRail::TestCase
- Defined in:
- lib/testrail/test_case.rb
Instance Method Summary collapse
- #build_test_case_hash(release, test_name) ⇒ Object
- #create(test_name, section, project) ⇒ Object
- #find(test_name, suite, section, project) ⇒ Object
- #find_or_create(test_name, suite, section, project) ⇒ Object
-
#initialize(api_client) ⇒ TestCase
constructor
A new instance of TestCase.
Constructor Details
Instance Method Details
#build_test_case_hash(release, test_name) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/testrail/test_case.rb', line 28 def build_test_case_hash(release,test_name) test_case = Hash.new test_case["title"] = test_name test_case["milestone_id"] = release["id"] test_case end |
#create(test_name, section, project) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/testrail/test_case.rb', line 17 def create(test_name, section, project) release = @release.find_or_create(project) test_case_data = build_test_case_hash(release,test_name) test_path = "add_case/#{section["id"]}" @api_client.send_post(test_path, test_case_data) end |
#find(test_name, suite, section, project) ⇒ Object
11 12 13 14 15 |
# File 'lib/testrail/test_case.rb', line 11 def find(test_name, suite, section, project) test_path = "get_cases/#{project["id"]}&suite_id=#{suite["id"]}§ion_id=#{section["id"]}" tests = @api_client.send_get(test_path) tests.select{ |x| x["title"]== test_name }.first end |
#find_or_create(test_name, suite, section, project) ⇒ Object
24 25 26 |
# File 'lib/testrail/test_case.rb', line 24 def find_or_create(test_name, suite, section, project) find(test_name, suite, section, project) || create(test_name, section, project) end |