Open nwalker-et opened 3 months ago
thanks for your detail reporting. Indeed, base call constructor are not considered as constructor invocation and it appears to be a bug.
Before engaging into a fix, I would like to stress out that you will still need to add to ignore methods the constructor for SomeException
. Are you comfortable with this?
As a work around, you can use Stryker comments to disable mutations around constructors. You an use online documentation on how to use them.
thanks for your detail reporting. Indeed, base call constructor are not considered as constructor invocation and it appears to be a bug. Before engaging into a fix, I would like to stress out that you will still need to add to ignore methods the constructor for
SomeException
. Are you comfortable with this? As a work around, you can use Stryker comments to disable mutations around constructors. You an use online documentation on how to use them.
I imagine that if I have an entry in ignore-methods
like "Exception.ctor" (note the ), that any call to the constructors of SomeException
, Exception
, or any other class ending in "Exception" would all be ignored. I would assume that in the case of SomeException
's constructors, any call to this
would be ignored due to SomeException.ctor
matching *Exception.ctor
, and any call to base
would be ignored due to the constructors of its base class (i.e., Exception.ctor
) also matching the same pattern. Does that line up with your understanding, @dupdob?
Yes, thank you. I just wanted to make it clear that there would be no class hierarchy search.
this
was identified as to be supported as well. That being said, fixing this requires redesigning significant parts of Stryker.
Describe the bug I'd like to use
ignore-methods
to ignore calls to exception constructors, as I'm not interested in testing the contents of exception messages. This works when the exception message appears in anew Exception("...")
expression, but not when the exception message appears in a call tobase
orthis
from another constructor.Logs log-20240808.txt
Expected behavior Since
base
andthis
are both means of invoking constructors, I feel they should be ignored by the same settings that would ignore direct calls to those same constructors. For example, if myignore-methods
setting contains the string "Exception.ctor", then I expect Stryker to ignore calls tothis
from constructors of classes whose name matches the string "Exception", as well as calls tobase
from constructors of classes which extend classes whose name matches the string "*Exception".Desktop (please complete the following information):
Additional context Here is the source code I've used to reproduce this issue: