-
Notifications
You must be signed in to change notification settings - Fork 11
Discussion: mutation score on 0 mutants #30
Comments
I agree with A reporter should display N/A (or something like that), since that makes the most sense for the end user. I feel like The also doesn't (strictly) break the current apis of the calculation modules, so cheap to implement. @hugo-vrijswijk |
Valid mutants. The score is based on valid. So for mutation score based on covered code it would be based on covered mutants. Or when mutants are ignored, that also doesn't count towards the score |
NaN is an implementation detail pretty specific to javascript no? I am at least not familiar with using NaN in any other language. So in what context should I place this discussion? It feels weird to me to return NaN as a result from mutation score calculation because it implies to me that we tried to do the calculation but could not get a result that is a number. Instead, the calculation should never take place if there are no mutations. Having valid mutations is a precondition to calculating a mutation score. There is no result from the calculation, number or otherwise/Nan. optional/nullable makes most sense to me. |
Nope:
I agree somewhat. It can be either way for me. Making it nullable / optional will introduce some more code on the scala side. |
Let me rephrase, I've never used it in c# and I hadn't heard of it before I looked it up and noticed that it does indeed exist 😛 It doesn't feel like the natural choice to me simply because I haven't heard of it. I think it's more common to use optional or exceptions instead in c#. |
I don't like this. It doesn't make sense. We should always be able to (and we can) calculate metrics when given valid data. Making it nullable/optional would take away from that. It's confusing from a library API standpoint to me.
But this is what happens. We try to divide by 0, and the result from that cannot be expressed as a number. This is also how the NaN constant is defined in both Java and .NET |
I disagree. Not having mutants for a file is a completely valid and expected result that we can account for by not trying to do calculations and simply returning no-result. You're still arguing from the point of doing the calculation, in which case you're right the result would be NaN. But we can simply not do the calculation and then NaN makes no sense. |
After a short discussion with @nicojs yesterday I think it's best to open an issue.
Right now there's no discussed way of calculating what the score should be when there are 0 mutants. I'm not talking about showing the score as there's already a PR for this in elements: stryker-mutator/mutation-testing-elements#52.
We already have standardized ways of calculating metrics, and I think this is a hole in that standardized way that should be filled.
There's 3 options (I think) that all have a valid argument:
Personally, I prefer NaN. Would like to hear your thoughts. cc: @nicojs @simondel @richardwerkman @Mobrockers
The text was updated successfully, but these errors were encountered: