gpt4 book ai didi

java - 自动化测试仪器

转载 作者:行者123 更新时间:2023-11-29 08:32:13 25 4
gpt4 key购买 nike

<分区>

写java程序获取JUnit测试用例的语句覆盖率?

例如:

public Integer addIfXGreaterThanY(int x, int y){
Integer z = null;

if (x > y) {
z = x + y;
}
else {
z = x - y;
}

return z;
}

输出:

Test case 1 inputs:  10, 15
output(line numbers covered): 1, 2, 5, 6
and another call will produce:
Test Case 2 inputs: 15, 10
output(line numbers covered): 1, 2, 3, 6

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com