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

[WIP] Testers/formatters refactoring #457

Merged
merged 56 commits into from
Mar 12, 2014
Merged

[WIP] Testers/formatters refactoring #457

merged 56 commits into from
Mar 12, 2014

Conversation

everzet
Copy link
Member

@everzet everzet commented Mar 5, 2014

This is unfinished testers/formatters refactoring. Basically I refactored both testers and formatters to use composition instead of inheritance.

Things to do:

  • Properly output hooks side-effects in pretty output
  • Recreate progress formatter
  • Cleanup code after refactoring

everzet added 4 commits March 5, 2014 08:53
Removed notion of events and hooks from the testers, but added instead
an extension point (setup routines) so both events and hooks could be
added back through their own extensions
EventDispatcher extension now extends testers infrastructure with event-
dispatching testers. This is a follow-up to the previous testers
refactoring
This commit decouples hooks from both testers and event dispatcher. Now
hooks dispatching routine is handled through a simple event subscriber.
This is a follow-up to the previous refactoring
Refactored pretty formatter to be an event listening tree. This helps
decoupling flow control and presentation logic and keep overall
formatter code very clean and precise
@everzet
Copy link
Member Author

everzet commented Mar 5, 2014

@stof I still didn't finish (look checkboxes), but it should give you an idea of where is it going.

@everzet
Copy link
Member Author

everzet commented Mar 5, 2014

@docteurklein I think it'll help if you can take a look too :)

@everzet everzet added this to the 3.0.0 milestone Mar 5, 2014
@everzet everzet self-assigned this Mar 5, 2014
@stof
Copy link
Member

stof commented Mar 5, 2014

@everzet could you temporary change the Travis config so that it can run the suite ? It currently fails entirely because of the missing progress formatter

) {
$event = new OutlineTested($environment, $feature, $outline, $result);
$this->eventDispatcher->dispatch(OutlineTested::AFTER, $event);
$this->baseTester->setUp($environment, $feature, $outline, $skip, $result);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this call tearDown instead ?

@everzet
Copy link
Member Author

everzet commented Mar 6, 2014

@stof overall feeling about refactoring?

@stof
Copy link
Member

stof commented Mar 6, 2014

@everzet this refactoring looks good to me. I haven't tried to update the ChainedStepsExtension yet, but I'm quite sure it is now possible to implement it.
It would be great to re-implement the other formatters to see how much code can be shared between them

$formatter->getOutputPrinter()->writeln();
}

$this->printArguments($formatter, $step->getArguments());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is an exact copy-paste of PrettyStepPrinter::printStep minus the last line. Wouldn't it be possible to avoid the duplication ?

*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
interface ExceptionResult extends TestResult
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this one is generic enough to be in Testwork rather than Behat. What do you think ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fully agree.

@stof
Copy link
Member

stof commented Mar 11, 2014

I haven't tried to update the ChainedStepsExtension yet to see whether it can be implemented properly now (from my review, I think it can). However, I like the new architecture. Much more flexible than the previous one.

It is unfortunate that you chose to tag Behat as RC for previous releases though. BC breaks between each RC are not really an indicator of being ready for a release...

@everzet
Copy link
Member Author

everzet commented Mar 11, 2014

@stof there were literally two last bits left that I hated about RC - testers and formatters. And this refactoring handles them both. After cleaning codebase up following this refactoring, it's a release.

@stof
Copy link
Member

stof commented Mar 11, 2014

@everzet I would actually make a RC3 to have a real RC before the stable release to let extension authors update their code for the BC breaks done after RC2.

@everzet
Copy link
Member Author

everzet commented Mar 11, 2014

@stof fully agree.

@everzet
Copy link
Member Author

everzet commented Mar 11, 2014

@stof my plan is:

  1. Fix things you've found
  2. Cleanup
  3. Tag RC3
  4. Give it week or two while I'm finishing behat.org
  5. Go gold

@stof
Copy link
Member

stof commented Mar 12, 2014

@everzet this plan looks good to me

@everzet
Copy link
Member Author

everzet commented Mar 12, 2014

@stof I fixed most of the things in this PR and started working on others in cleanup. Do you think this one is mergable or do you want to take more time to take a look at it? If it's ok - merge it, we'll gradually and quickly improve from that point with much smaller PRs :)

@stof
Copy link
Member

stof commented Mar 12, 2014

Merging as is. It will be easier to review small improvements

stof added a commit that referenced this pull request Mar 12, 2014
@stof stof merged commit d56cdd0 into 3.0 Mar 12, 2014
@stof stof deleted the feature/testers-refactoring branch March 12, 2014 01:01
@everzet
Copy link
Member Author

everzet commented Mar 12, 2014

@stof it'll also be much easier with scrutinizer help: https://scrutinizer-ci.com/g/Behat/Behat :) Thanks @schmittjoh

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

Successfully merging this pull request may close these issues.

3 participants