Class: TestRail::Adaptor
- Inherits:
-
Object
- Object
- TestRail::Adaptor
- Defined in:
- lib/testrail/adaptor.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#end_test_run ⇒ Object
Checks to see if any of the tests in a particular test run have failed, if they have then the it will leave the run opened.
-
#initialize(enabled: true, test_suite: nil, url:, username:, password:, project_id:, suite_id:) ⇒ Adaptor
constructor
A new instance of Adaptor.
-
#start_test_run ⇒ Object
This method initiates a test run against a project, and specified testsuite.
-
#submit(_test) ⇒ Object
A new test result is submitted to TestRails.
Constructor Details
#initialize(enabled: true, test_suite: nil, url:, username:, password:, project_id:, suite_id:) ⇒ Adaptor
Returns a new instance of Adaptor.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/testrail/adaptor.rb', line 22 def initialize( enabled: true, test_suite: nil, url:, username:, password:, project_id:, suite_id: ) @enabled = enabled return unless @enabled if test_suite.nil? testrail_client = TestRail::APIClient.new(url) testrail_client.user = username testrail_client.password = password @test_suite = TestRail::TestRailClient.new(testrail_client).get_suite( project_id: project_id, suite_id: suite_id ) else @test_suite = test_suite end end |
Instance Method Details
#end_test_run ⇒ Object
Checks to see if any of the tests in a particular test run have failed, if they have then the it will leave the run opened. If there are no failed tests then it will call close the particular run.
65 66 67 68 69 |
# File 'lib/testrail/adaptor.rb', line 65 def end_test_run return if !@enabled || @test_run.nil? @test_run.submit_results @test_run.close unless @test_run.failure_count > 0 end |
#start_test_run ⇒ Object
This method initiates a test run against a project, and specified testsuite. ruby functional test file (.rb) containing a range of test cases. Each test case (in the ruby functional test file) will have a corresponding Test Case in TestRail. These Test Rail test cases will belong to a test suite that has the title of the corresponding ruby functional test file.
58 59 60 61 |
# File 'lib/testrail/adaptor.rb', line 58 def start_test_run return unless @enabled @test_run = @test_suite.start_test_run end |
#submit(_test) ⇒ Object
A new test result is submitted to TestRails. The type of test depends on the Test Suite Each adaptor implementation should be able to determine the required information from the test provided as a parameter
49 50 51 |
# File 'lib/testrail/adaptor.rb', line 49 def submit(_test) raise 'submit should be overrided by Adaptor implementations' end |