Generate test_case_started/finished messages at the source#331
Generate test_case_started/finished messages at the source#331brasmusson wants to merge 4 commits into
Conversation
|
I get the premise of this, but there's a few questions I have regarding how this is used as on first inspection some of these ivars won't change |
|
Code wise this pull request is read - the TestCaseStarted/Finished messages and TestStepStarted/Finished messages are emitted by the runner. The
The decision to retry or not is handled outside the runner (outside cucumber-ruby-core), and the BacktraceFilter is defined in Cucumber::Formatter in cucumber-ruby. To avoid direct dependencies to cucumber-ruby, the runner have two new arguments so the relevant information can be passed in. Probably the snippets message should also be emitted by the runner in relation to the TestStepFinishded message, but the generation of the snippets are also handled outside cucumber-ruby-core, so maybe it is the undefined action created from the step matching that should carry snippet data so it can be extracted by the runner. |
luke-hill
left a comment
There was a problem hiding this comment.
Sort of half reviewed this so far. Got a couple of things that might need amending
| @event_bus = event_bus | ||
| @max_attempts = max_attempts | ||
| @backtrace_filter = backtrace_filter | ||
| @id_generator = Cucumber::Messages::Helpers::IdGenerator::UUID.new |
There was a problem hiding this comment.
This needs to lean on the cucumber config - as this can be variable
| attr_reader :event_bus, :running_test_case, :running_test_step, :id_generator | ||
| private :event_bus, :running_test_case, :running_test_step, :id_generator | ||
|
|
||
| def initialize(event_bus, backtrace_filter = nil, max_attempts = 1) |
There was a problem hiding this comment.
Shouldn't this come from the config for the retries on the current flag
|
|
||
| def test_case(test_case, &descend) | ||
| @attempt = @current_test_case == test_case ? @attempt + 1 : 1 | ||
| @current_test_case = test_case |
There was a problem hiding this comment.
This is overwriting a check above? And the current check above would always be nil to start with? So are we saying we should always start at 1 then do something else. It's not that clear
| end | ||
| end | ||
|
|
||
| def create_test_case_started_message(test_case) |
There was a problem hiding this comment.
Can we use a #to_xxx structure. So this could be test_case_started_to_envelope - Unless we're able to directly put these on the event - which is something I'm trying to do (Make the #to_envelope definitions as close to their requirement as poss).
Description
Generating messages at the source means that the Runner shall generate test_case_started/finished and test_step_started/finished (at least)
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.
Note to other contributors
If your change may impact future contributors, explain it here, and remember to update README.md and CONTRIBUTING.md accordingly.
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