mutation-testing-elements icon indicating copy to clipboard operation
mutation-testing-elements copied to clipboard

Allow configuration of default checked statuses

Open rachied opened this issue 1 year ago • 7 comments

Hello, in the Stryker Playground, we utilize the HTML report to present the results of a mutation run. Recently, a feature request was received to have killed mutants displayed by default. I am in alignment with the suggestion made in https://github.com/stryker-mutator/mutation-testing-elements/issues/2207, which proposes including timed out mutants in the default display as well.

Is it feasible to introduce configurability for these default settings? For example, by allowing the user to pass a JSON object containing the overridden defaults?

rachied avatar Jun 21 '23 12:06 rachied

Hi there @rachied 👋

For example, by allowing the user to pass a JSON object containing the overridden defaults?

How would a user pass these config?

nicojs avatar Jun 21 '23 21:06 nicojs

In the same manner the mutation json is now being passed. Thinking about that, maybe the mutation schema could be extended? We could introduce a new (optional) field in which a list of statuses can be passed. If that field is populated, the report could read it and behave accordingly?

rachied avatar Jun 23 '23 12:06 rachied

Why would we use settings as JSON for these? In HTML, you generally add settings as attributes. For example:

<mutation-test-report-app enable-killed-filter></mutation-test-report-app>

You can go wild with this and make everything configurable, but I would only want to make things requested/needed configurable as they come with overhead. In the features docs, we specify that we adhere to the custom elements best practices, which means that attributes and properties can be set at a later time.

As for #2207, I think everyone agrees that Timeout should be unchecked by default, Timeout means that a mutant was detected after all.

nicojs avatar Jun 25 '23 12:06 nicojs

We currently have 8 different mutant states + total. Are we going to add an attribute for each one? And one for each test state as well? That seems like too much.

A simpler idea: if you can check/uncheck them, just save the settings in localStorage. That way the user can specify what they want or don't want, instead of the framework/dashboard deciding for the user

hugo-vrijswijk avatar Jun 26 '23 08:06 hugo-vrijswijk

As for https://github.com/stryker-mutator/mutation-testing-elements/issues/2207, I think everyone agrees that Timeout should be unchecked by default, Timeout means that a mutant was detected after all.

You're right, that seems to be the consensus (I misread earlier). For the playground we thought it may be better to display timeouts by default because we're teaching people about these concepts, and would rather not hide them behind yet another button to improve discoverability.

Are we going to add an attribute for each one

I agree that the attributes for each state would be adding too much bloat. Regarding your simpler idea: Are you suggesting that the Blazor app should interact with the mutation report DOM to toggle checkboxes? That may work, and if nothing else I'll probably just do that.

Though I was hoping for a less hacky way, and something that could benefit all downstream dependents of the mutation report.

rachied avatar Jun 28 '23 09:06 rachied

No what I meant was to make the statuses configurable by the user, not the playground or any tool

hugo-vrijswijk avatar Jun 28 '23 10:06 hugo-vrijswijk

A simpler idea: if you can check/uncheck them, just save the settings in localStorage. That way the user can specify what they want or don't want, instead of the framework/dashboard deciding for the user

I don't like simple ideas. Can we make this more complicated somehow? 😉

I like this idea. But we can still allow a single setting to help with newcomers that use the playground for the first time. How about enable-all-filters as an attribute?

nicojs avatar Jun 28 '23 21:06 nicojs