itriagetestrail 0.6.9 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/itriagetestrail/trcucumber13.rb +0 -1
- data/lib/itriagetestrail/trcucumber20.rb +0 -1
- data/lib/itriagetestrail/version.rb +1 -1
- data/lib/itriagetestrail.rb +18 -28
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 319c8585bc659cab5bb1b178a4c0f96503e19a04
         | 
| 4 | 
            +
              data.tar.gz: 9deb949e0b4819aa3b76ea1d106a5cbc92ad8a86
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 900862dd717e7a3dc0dc0c9e4e57ec58878987c07f1a0bb9edc42bfedf9923b60ef82a1f32442eca753089fa5ed32acf520d649828c266e033c592b24fb29164
         | 
| 7 | 
            +
              data.tar.gz: faa223b36ca36b811ba492cb4868360169d42458b4dd25a09cd488f1912a256e82d0be5f20284d3052cba051f7cccef5619e017efb41b379a99538a5fb219687
         | 
| @@ -24,7 +24,6 @@ module Itriagetestrail | |
| 24 24 | 
             
                      store_result(@scenario_title, @external_id, @scenario_steps,
         | 
| 25 25 | 
             
                        "#{ENV['RERUN'] ? 5 : 4}".to_i, "#{scenario.exception.class}\n#{scenario.exception}\n#{scenario.exception.backtrace}")
         | 
| 26 26 | 
             
                    end
         | 
| 27 | 
            -
                    update_test_run
         | 
| 28 27 | 
             
                    send_results_to_testrail
         | 
| 29 28 | 
             
                  rescue => exception
         | 
| 30 29 | 
             
                    puts "TESTRAIL ENCOUNTERED AN ERROR: #{exception}\n #{@external_id} \n\n"
         | 
| @@ -23,7 +23,6 @@ module Itriagetestrail | |
| 23 23 | 
             
                      store_result(@scenario_title, @external_id, @scenario_steps,
         | 
| 24 24 | 
             
                        "#{ENV['RERUN'] ? 5 : 4}".to_i, "#{scenario.exception.class}\n#{scenario.exception}\n#{scenario.exception.backtrace}")
         | 
| 25 25 | 
             
                    end
         | 
| 26 | 
            -
                    update_test_run
         | 
| 27 26 | 
             
                    send_results_to_testrail
         | 
| 28 27 | 
             
                  rescue => exception
         | 
| 29 28 | 
             
                    puts "TESTRAIL ENCOUNTERED AN ERROR: #{exception}\n #{@external_id} \n\n"
         | 
    
        data/lib/itriagetestrail.rb
    CHANGED
    
    | @@ -419,13 +419,28 @@ module Itriagetestrail | |
| 419 419 | 
             
                  @client.send_post("update_run/#{@run_id}", body)
         | 
| 420 420 | 
             
                end
         | 
| 421 421 |  | 
| 422 | 
            -
                def  | 
| 422 | 
            +
                def existing_cases_from_description
         | 
| 423 423 | 
             
                  # Grabs from testrail run description
         | 
| 424 424 | 
             
                  run = @client.send_get("get_run/#{@run_id}")
         | 
| 425 425 | 
             
                  @description = run["description"]
         | 
| 426 426 | 
             
                  @description.nil? ? [] : @description.split(",")
         | 
| 427 427 | 
             
                end
         | 
| 428 428 |  | 
| 429 | 
            +
                def existing_cases_from_run
         | 
| 430 | 
            +
             | 
| 431 | 
            +
                  tests = @client.send_get("get_tests/#{@run_id}") || []
         | 
| 432 | 
            +
             | 
| 433 | 
            +
                  cases = []
         | 
| 434 | 
            +
             | 
| 435 | 
            +
                  tests.each do |test|
         | 
| 436 | 
            +
             | 
| 437 | 
            +
                    record = @client.send_get("get_test/#{test["id"]}") || []
         | 
| 438 | 
            +
             | 
| 439 | 
            +
                    cases << record["case_id"]
         | 
| 440 | 
            +
                  end
         | 
| 441 | 
            +
                  cases
         | 
| 442 | 
            +
                end
         | 
| 443 | 
            +
             | 
| 429 444 | 
             
                # open a test run to submit test results
         | 
| 430 445 | 
             
                def add_testrail_run
         | 
| 431 446 | 
             
                  body = {
         | 
| @@ -495,31 +510,6 @@ module Itriagetestrail | |
| 495 510 | 
             
                  }
         | 
| 496 511 | 
             
                end
         | 
| 497 512 |  | 
| 498 | 
            -
                # this is the hack at very end to exclude tests which frameworks like MiniTest and Cucumber did not touch
         | 
| 499 | 
            -
                # including all tests at beginning is necessary so that at least some progress can be seen when
         | 
| 500 | 
            -
                # real time updating is enabled.
         | 
| 501 | 
            -
                def update_test_run(runtime = true)
         | 
| 502 | 
            -
                  if runtime
         | 
| 503 | 
            -
                    # collect all all the test cases executed during this thread and append them to the description
         | 
| 504 | 
            -
                    executed_ids = []
         | 
| 505 | 
            -
                    @results[:results].each {|id| executed_ids << id[:case_id]}
         | 
| 506 | 
            -
             | 
| 507 | 
            -
                    # Append case ids to description
         | 
| 508 | 
            -
                    existing_cases.each { |case_id| executed_ids << case_id } if @shared_run == true
         | 
| 509 | 
            -
             | 
| 510 | 
            -
                    send = {include_all: true, description: executed_ids.uniq.join(",")}
         | 
| 511 | 
            -
                  else
         | 
| 512 | 
            -
             | 
| 513 | 
            -
                    # attempt wait to ensure all threads published before changing scope
         | 
| 514 | 
            -
                    sleep 10
         | 
| 515 | 
            -
                    # tests from all threads have been pushed, eliminate non executed test cases from the run
         | 
| 516 | 
            -
                    send = {include_all: false, case_ids: existing_cases}
         | 
| 517 | 
            -
             | 
| 518 | 
            -
                  end
         | 
| 519 | 
            -
             | 
| 520 | 
            -
                  @client.send_post("update_run/#{@run_id}", send)
         | 
| 521 | 
            -
                end
         | 
| 522 | 
            -
             | 
| 523 513 | 
             
                def close_run?()
         | 
| 524 514 | 
             
                  # do not close a run if a run id was supplied.  other test suites related to the job will need it.
         | 
| 525 515 | 
             
                  close_run = false
         | 
| @@ -543,9 +533,9 @@ module Itriagetestrail | |
| 543 533 | 
             
                end
         | 
| 544 534 |  | 
| 545 535 | 
             
                def close_run(message='')
         | 
| 546 | 
            -
                  update_test_run(false)
         | 
| 547 536 | 
             
                  @client.send_post("update_run/#{@run_id}",
         | 
| 548 | 
            -
                    {description: 'Timestamp: ' + @time_zone.now.strftime('%m/%d/%Y %I:%M %p') + ("\nBranch: #{@testrail_config[:origin]}") + "\n#{message}"})
         | 
| 537 | 
            +
                    {include_all: false, case_ids: existing_cases_from_run, description: 'Timestamp: ' + @time_zone.now.strftime('%m/%d/%Y %I:%M %p') + ("\nBranch: #{@testrail_config[:origin]}") + "\n#{message}"})
         | 
| 538 | 
            +
             | 
| 549 539 | 
             
                  @client.send_post("close_run/#{@run_id}", {})
         | 
| 550 540 | 
             
                end
         | 
| 551 541 |  |