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

Test visitor decorators #4

Merged
merged 13 commits into from
Dec 18, 2018
Merged

Test visitor decorators #4

merged 13 commits into from
Dec 18, 2018

Conversation

Aboisier
Copy link
Collaborator

@Aboisier Aboisier commented Dec 5, 2018

The current test runner is not extensible. For example, the test reporting is embedded in the test runner class. Implementing the Visual Studio Code adapter involved a full re-implementation of the test runner.

I believe using a decorator pattern would allow extending the test runner (and eventually other test visitors) more easily.

untitled diagram

Solves #3

@Aboisier Aboisier self-assigned this Dec 5, 2018
this.baseVisitTestSuite = baseVisitor.visitTestSuite.bind(baseVisitor);

this.baseVisitor.visitTest = this.visitTest.bind(this);
this.baseVisitor.visitTestSuite = this.visitTestSuite.bind(this);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This hack is very ugly. This is currently necessary because of the recursive nature of the visitor. When the bottommost visitor in the decorator hierarchy does its recursive call and passes this to the accept method, we lose the decorators.

I believe to move the iterating-over-children logic from the visitor to the composite might - perhaps - fix the problem.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Okay so moving back the iteration inside the tree creates more problems (aka handling before/after methods execution, filtering the nodes, etc.). The hack doesn't seem that ugly after all. Will continue thinking about this.

@Aboisier Aboisier merged commit 2e7f356 into master Dec 18, 2018
@Aboisier Aboisier deleted the test-visitor-decorators branch December 18, 2018 19:01
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.

1 participant