Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when handling nil values in handle_end_test_suite #42

Open
ghost opened this issue Jun 7, 2017 · 0 comments
Open

Error when handling nil values in handle_end_test_suite #42

ghost opened this issue Jun 7, 2017 · 0 comments

Comments

@ghost
Copy link

ghost commented Jun 7, 2017

We keep running into the following error sporadically in our build.
17:02:38 /usr/local/lib/ruby/gems/2.3.0/gems/ocunit2junit-1.4/bin/ocunit2junit:160:in `-': nil can't be coerced into Fixnum (TypeError) 17:02:38 from /usr/local/lib/ruby/gems/2.3.0/gems/ocunit2junit-1.4/bin/ocunit2junit:160:in `handle_end_test_suite' 17:02:38 from /usr/local/lib/ruby/gems/2.3.0/gems/ocunit2junit-1.4/bin/ocunit2junit:99:in `block in parse_input' 17:02:38 from /usr/local/lib/ruby/gems/2.3.0/gems/ocunit2junit-1.4/bin/ocunit2junit:55:in `each' 17:02:38 from /usr/local/lib/ruby/gems/2.3.0/gems/ocunit2junit-1.4/bin/ocunit2junit:55:in `each' 17:02:38 from /usr/local/lib/ruby/gems/2.3.0/gems/ocunit2junit-1.4/bin/ocunit2junit:55:in `parse_input' 17:02:38 from /usr/local/lib/ruby/gems/2.3.0/gems/ocunit2junit-1.4/bin/ocunit2junit:43:in `initialize' 17:02:38 from /usr/local/lib/ruby/gems/2.3.0/gems/ocunit2junit-1.4/bin/ocunit2junit:236:in `new' 17:02:38 from /usr/local/lib/ruby/gems/2.3.0/gems/ocunit2junit-1.4/bin/ocunit2junit:236:in `<top (required)>' 17:02:38 from /usr/local/bin/ocunit2junit:23:in `load' 17:02:38 from /usr/local/bin/ocunit2junit:23:in `<main>'

It happens when end_time is nil in handle_end_test_suite.
def handle_end_test_suite(test_name,end_time) unless @ended_current_test_suite current_file = File.open("#{TEST_REPORTS_FOLDER}/TEST-#{test_name}.xml", 'w') host_name = string_to_xml Socket.gethostname test_name = string_to_xml test_name test_duration = (end_time - @cur_start_time).to_s total_tests = @total_failed_test_cases + @total_passed_test_cases

We have tried to resolve this by adding a if statement before the arithmetic operation.
end_time=0 if end_time.nil?

will this work or break something else?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants