小编Rec*_*234的帖子

如何获得Java代码覆盖率的全面覆盖?Junit 测试用例

我正在做一门课程的作业,我需要全面了解这种方法

使用 JaCoco 的 Eclipse 中的代码覆盖率图像

这些是属性和构造函数,它是咖啡机的程序,这是 Recipe 类

public class Recipe {
private String name;
private int price;
private int amtCoffee;
private int amtMilk;
private int amtSugar;
private int amtChocolate;

/**
 * Creates a default recipe for the coffee maker.
 */
public Recipe() {
    this.name = "";
    this.price = 0;
    this.amtCoffee = 0;
    this.amtMilk = 0;
    this.amtSugar = 0;
    this.amtChocolate = 0;
}
Run Code Online (Sandbox Code Playgroud)

我用过

    /*
 * setPrice test
 */
@Test
public void testSetPrice_1() throws RecipeException {
    r1.setPrice("25");
    r1.setPrice("0");
}

/*
 * setPrice test
 */ …
Run Code Online (Sandbox Code Playgroud)

java junit jacoco

3
推荐指数
1
解决办法
2624
查看次数

标签 统计

jacoco ×1

java ×1

junit ×1