Skip to content

Commit

Permalink
added pending, skipped, and message features
Browse files Browse the repository at this point in the history
  • Loading branch information
prashanth-sams committed Jul 24, 2019
1 parent 7ca7b1a commit 1dbe06a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
18 changes: 15 additions & 3 deletions lib/testrail-rspec/update-testrails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,26 @@ def upload_result
response = {}
case_id = @scenario.metadata[:description].split(' ').first.scan(/\d+/).first rescue nil

status_id = get_status_id 'passed'.to_sym if @scenario.exception == nil
status_id = get_status_id 'failed'.to_sym if @scenario.exception != nil
if (@scenario.exception) && (!@scenario.exception.message.include? 'pending')
status_id = get_status_id 'failed'.to_sym
message = @scenario.exception.message
elsif @scenario.skipped?
status_id = get_status_id 'blocked'.to_sym
message = "This test scenario is skipped from test execution"
elsif @scenario.pending?
status_id = get_status_id 'blocked'.to_sym
message = "This test scenario is pending for test execution"
else
status_id = get_status_id 'passed'.to_sym
message = "This test scenario was automated and passed successfully"
end

run_id = @config['run_id']

if case_id && run_id
response = client.send_post(
"add_result_for_case/#{run_id}/#{case_id}",
{ status_id: status_id }
{ status_id: status_id, comment: message }
)
else
raise 'unable to get case id or run id'
Expand Down
2 changes: 1 addition & 1 deletion lib/testrail-rspec/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module TestrailRspec
VERSION = '0.1.1'.freeze
VERSION = '0.1.2'.freeze
end
10 changes: 9 additions & 1 deletion spec/features/google_search_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,20 @@
@app.google_home.load
end

scenario 'C845 verify the Google home page' do
scenario 'C845 verify the Google home page to pass' do
expect(page).to have_content('Google')
end

scenario 'C847 verify the Google home page to fail' do
expect(page).to have_content('Goo gle')
end

scenario 'C850 verify the Google home page to be pending' do
pending
end

scenario 'C853 verify the Google home page to skip' do
skip "skipping this test"
end

end
4 changes: 2 additions & 2 deletions testrail-rspec.gemspec
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Gem::Specification.new do |s|
s.name = "testrail-rspec"
s.version = "0.1.1"
s.version = "0.1.2"
s.licenses = ['MIT']
s.author = ["Prashanth Sams"]
s.email = ['sams.prashanth@gmail.com']
s.summary = "Sync Rspec test results with your testrail suite"
s.summary = "Sync Rspec test results with your testrail suite. Discover an example with Capybara in this gem source"
s.files = ["lib/testrail-rspec.rb", "lib/testrail-rspec/api-client.rb", "lib/testrail-rspec/update-testrails.rb", "lib/testrail-rspec/version.rb"]
s.require_paths = ["lib"]
s.metadata = { "documentation_uri" => "https://www.rubydoc.info/github/prashanth-sams/testrail-rspec/master", "source_code_uri" => "https://github.com/prashanth-sams/testrail-rspec", "bug_tracker_uri" => "https://github.com/prashanth-sams/testrail-rspec/issues" }
Expand Down

0 comments on commit 1dbe06a

Please sign in to comment.