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

feat(elements): realtime reporting #2453

Merged
merged 23 commits into from Apr 28, 2023
Merged

Conversation

xandervedder
Copy link
Contributor

@xandervedder xandervedder commented Apr 20, 2023

Realtime reporting

With this PR the report now supports realtime reporting. This means that users no longer have to wait for the testing proces to complete, but can get updates while a mutation testing is in progress.

Issues

This PR has some issues that could be resolved now or at a later time:

  • small: When opening the testresources, the realtime example does not work (because of an unknown port number).
  • small(?): Test should be related to mutants, so that these will show up in the drawer.
  • medium: The entire report is updated now, we would like to only update what's necessary (this could be done later). (later)
  • small: We should use a better type for the partial mutants, and probably do some validations (?).

Note

This was tested using the implementation of Stryker.NET, although this does not support the test tab yet. This is something I need to test.

closes #2434

When a user has the drawer openened and we are pushing an update
through, we want to test if the drawer and selected mutant stay the
same.
Has some issues that I would like to resolve, for instance:
- Use a better type for the mutants.
- When opening the realtime report from webpack, support the use of SSE
  (currently it doesn't work in non integration test context since the
  port is unknown).
@xandervedder
Copy link
Contributor Author

Not sure why the tests were pending, will check tomorrow

There were too many similarities between what we had and what was in
the calculateMetrics version. It would still be nice to use the better
reactivity that LitElement provides.

Also fixed the drawer that wasn't being updated, that works now too.
@xandervedder
Copy link
Contributor Author

xandervedder commented Apr 22, 2023

@nicojs I reverted the changes we made to the rootmodel yesterday, since we were doing things that were already being done in the calculateMutationTestMetrics function. It made more sense to me to update the report property instead.

The changes made will also work for the coveredBy and killedBy properties now (which are also now updated when the drawer stays open 😄 ). This is not the best solution, but I feel like we should focus on reactivity in a different pr (I still want to figure out debounce, scheduledUpdates etc.).

@xandervedder xandervedder marked this pull request as ready for review April 23, 2023 11:34
Copy link
Member

@nicojs nicojs left a comment

Choose a reason for hiding this comment

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

Looks great so far. I'm not a fan of the way reactivity is built in now. I would rather see a call to requestUpdate() instead of hacking in some solution.

packages/elements/src/components/app/app.component.ts Outdated Show resolved Hide resolved
packages/elements/src/components/app/app.component.ts Outdated Show resolved Hide resolved
packages/elements/src/components/app/app.component.ts Outdated Show resolved Hide resolved
packages/elements/package.json Outdated Show resolved Hide resolved
This is a better way to updat the report than what was done previously.
Would also eventually allow us to make these updates more finegrained.
Copy link
Member

@nicojs nicojs left a comment

Choose a reason for hiding this comment

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

I had limited time to review this; feel free to merge this and pick my remarks up later. I would also like to review the whole once it is done.

packages/metrics/src/model/mutant-model.ts Outdated Show resolved Hide resolved
this.childResults.forEach((result) => result.updateParent(this));
}

public updateAllMetrics() {
Copy link
Member

Choose a reason for hiding this comment

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

As I mentioned in one of our meetings: we shouldnt' need this method. In fact, we shouldn't need any public calculate method at all. Instead, we could move all this calculation magic inside the class and only recalculate on the fly when the metrics are requested and they are dirty (undefined).

So we start out with #metrics: TMetrics | undefined and in the getter of metrics() calculate when they are undefined. If we later update coverage or killed by from a child, we walk up the files and mark them dirty (setting #metrics to undefined).

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I assume that we would mark the #metrics undefined when we update the state of a mutant too? How does it work in that case?

Should we create a release with the tag realtime-beta when this gets merged?

Copy link
Member

Choose a reason for hiding this comment

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

If we feel confident enough to merge we should feel confident enough to release. No need for a beta release, we don't have a release process for beta's in mutation-testing elements anyway.

In the future we should do updates in the way that was suggested:
#2453 (comment)
@rouke-broersma rouke-broersma merged commit 09ea493 into master Apr 28, 2023
11 checks passed
@rouke-broersma rouke-broersma deleted the feat/realtime-reporting branch April 28, 2023 12:28
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.

Add support for realtime reporting in mutation-testing-elements
3 participants