Update MessageBuilder when runner generate messages#1882
Conversation
* Delete a portion of the RSpec double verification that is not auto enabled * Add in a bit of a split for some of the glue code
* Remove ruby 2.1 patch * Moved top level errors out of runtime to bespoke errors file * Re-order errors according to names * Re-order requires and pivot to more optimal require relatives * Tidy up of rubocop autogen file
* Remove all references to strict * Fix up missing spec issue from strict mode * Remove strict from default options * Dry run with undefined scenarios will still pass as undefined is a permissible item * Add warning for retry_failing_tests invalid failure * Fix up retry_failing_tests to be more conformant now * Clean up rerun formatter * Fix erroneous message class * Remove erroneous scenario * Update the junit_formatter.feature for the strict removal * When strict is removed, test cases with pending and undefined steps will always be reported as failed by the junit formatter. * Remove redundant scenario * Switch in v17 of core and fix up missing constants --------- Co-authored-by: Björn Rasmusson <B.Rasmusson@computer.org>
…as actually undefined steps
* When strict is removed from cucumber-ruby-core pending and undefined steps will fail the test run (the exit code will be non-zero).
* Changes when the runner generate test_case_started/finished messages at the source.
* Changes when the runner generate test_step_started/finished messages at the source.
* Pass also the id_generator to the runner.
4007e67 to
402b6ea
Compare
| return unless event.envelope.test_case_started | ||
|
|
||
| @current_test_case_started_id = event.envelope.test_case_started.id | ||
| @current_test_run_hook_started_id = nil |
There was a problem hiding this comment.
From my understanding doesn't this "reset" always need to happen. Then line 60 can become
@current_test_case_started_id = event.envelope.test_case_started.id if event.envelope.test_case_started
There was a problem hiding this comment.
It is equivalent to write line 58-63 as:
if event.envelope.test_case_started
@current_test_case_started_id = event.envelope.test_case_started.id
@current_test_run_hook_started_id = nil
@repository.update(event.envelope)
end
but rubocop will complain "Use a guard clause (return unless event.envelope.test_case_started) instead of wrapping the code inside a conditional expression."
Another equivalent alternative is
@current_test_case_started_id = event.envelope.test_case_started.id if event.envelope.test_case_started
@current_test_run_hook_started_id = nil if event.envelope.test_case_started
@repository.update(event.envelope) if event.envelope.test_case_started
but I'm not sure about using the same trailing if on three lines in a row.
There was a problem hiding this comment.
I more meant this.
@current_test_case_started_id = event.envelope.test_case_started.id if event.envelope.test_case_started
@current_test_run_hook_started_id = nil
@repository.update(event.envelope)
There was a problem hiding this comment.
@current_test_run_hook_started_id = nil
is completely wrong. What you get if you inline store_current_test_run_hook_started_id and snip the line that are not relevant is:
@current_test_run_hook_started_id = event.envelope.test_run_hook_started.id if event.envelope.test_run_hook_started
@current_test_run_hook_started_id = nil
@repository.update(event.envelope) is not completely wrong, but it is not necessary to update the repository with every type of message. Actually since the only usage of the repository in message_builder is:
@repository.test_step_by_id[event.test_step.id].pickle_step_id
(in generate_snippet_envelope)
@repository.update(event.envelope) is not needed at all here. It is sufficient that the repository is updated with the test_case_ready envelopes in on_test_case_ready.
This should also work:
@current_test_case_started_id = event.envelope.test_case_started.id if event.envelope.test_case_started
@current_test_run_hook_started_id = nil if event.envelope.test_case_started
|
Requires cucumber-core 18.1+ |
Description
Depend on cucumber/cucumber-ruby-core#331
Type of change
Please delete options that are not relevant.
Please add an entry to the relevant section of CHANGELOG.md as part of this pull request.
Checklist:
Your PR is ready for review once the following checklist is
complete. You can also add some checks if you want to.
bundle exec rubocopreports no offenses