Pitest-突变测试失败 - 否定条件→幸存
我在我的代码中添加了一个条件运算符,例如:
String test;//assigned with some value
result = test != null ? test : "";
这在突变测试中失败,原因是否定的条件→幸存
我添加了很少的单位测试用例,可以用“”分配值
,null
,“ value”
喜欢
asserThat(testValue.equals(""));
,但没有什么可以为此提供解决方案。
我可以从任何人那里得到有关此特定流程的突变覆盖范围的帮助吗?
I added a conditional operator in my code like:
String test;//assigned with some value
result = test != null ? test : "";
This fails in mutation testing with the reason of negated conditional → SURVIVED
I added few unit test cases to assign the value with ""
, null
, "value"
like
asserThat(testValue.equals(""));
But nothing is giving the solution for this.
Can I get help from anyone about the mutation coverage for this specific flow?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不是功能性的断言。假设您正在使用assertj,则应该这样做。
目前尚不清楚您的代码和测试从您发布的小片段中的外观。但是被否定的有条件在以下代码中被杀死,并在提供的测试中被杀死。
Is not a functioning assertion. Assuming you are using AssertJ, this should be.
It is not entirely clear what your code and tests look like from the small snippets you have posted. But the negated conditional is killed in the following code with the supplied test.