Replies: 5 comments
-
Yes, since Stryker 1.0 you can do it! |
Beta Was this translation helpful? Give feedback.
-
But that would mean that I would need to add a comment to every single line of code where I do logging, so if I have a method where I have 5 log statements, I need to add 5 comments before each logging statement. Is there a way to do this by some filter like with "ignore-methods" field? We have a huge codebase and there's a lot of logging going on, and it would be good to exclude logging statements on the stryker level so that if someone adds new logging statements they don't have to remember to add a comment before it. |
Beta Was this translation helpful? Give feedback.
-
This sounds like an oversight and should probably be added to ignore methods. You could create a feature request for this. However I also don't really see the issue with making this specific in your code. If you run in to it you can make the choice to test it or to ignore it. It forces you to every time consider whether it should be tested or not. Can you really say that logging statements should never ever be tested? If you blanket ignore them you'll never be forced to reconsider your choice. |
Beta Was this translation helpful? Give feedback.
-
Yes I agree, but at the same time what if you really want to disable mutation for all the logging. You'd be forced to make changes to the whole codebase instead of just adding single line of configuration for Stryker. Would be a handy feature. I'll create a feature request. |
Beta Was this translation helpful? Give feedback.
-
Hi,
Is there a way to exclude mutation for some lines of code like logging? I know we can exclude logging mutation by using "ignore-methods" field, but this only excludes mutation of arguments of the method. What I want to do is to completely exclude mutation of the lines of code where we call logger, because otherwise mutants are created that delete logging line and it reports it like mutant has survived. We don't want to unit test our logger calls since it's not a business logic.
Beta Was this translation helpful? Give feedback.
All reactions