【问题标题】:Understanding the coverage summary for dotCover in TeamCity了解 TeamCity 中 dotCover 的覆盖率摘要
【发布时间】:2013-06-28 11:17:18
【问题描述】:

我正在 Teamcity 中运行 dotCover 覆盖。在构建之后,它会构建覆盖率报告,您可以在其中深入了解各个类的覆盖率。

我有一个包含 1 个方法的类,该方法产生以下摘要。

类,%
100% (1/1)

方法,%
86.7% (13/15)

声明,%
91.7% (55/60)

类和语句结果看起来很简单,但我看不出如何解释方法结果。

我得到了 15 个(其中 13 个被覆盖)?

更新

这是课程的要点

    public static class MyClass
    {
        public static List<B> Bye(X x, B b)
        {
            List<B> bList = new List<B>();

            if (x is A)
            {
                // Do something
            }
            else if (x is B)
            {
                // Do something else
            }

            if (b.Something)
            {
               x.Where.ToList().Foreach(x => x.Work());
            }

             if (b.Something)
            {
               x.Where.ToList().Foreach(x => x.Work());
            }

             if (b.Something)
            {
               x.Where.ToList().Foreach(x => x.Work());
            }

             if (b.Something)
            {
               x.Where.ToList().Foreach(x => x.Work());
            }

             if (b.Something)
            {
               x.Where.ToList().Foreach(x => x.Work());
            }

             if (b.Something)
            {
               x.Where.ToList().Foreach(x => x.Work());
            }

             if (b.Something)
            {
               x.Where.ToList().Foreach(x => x.Work());
            }

            return bList;
        }  
    }

【问题讨论】:

    标签: teamcity code-coverage dotcover


    【解决方案1】:

    我会说它涵盖了 15 种方法中的 13 种(或者在标记为已覆盖/已访问的每个方法中至少执行了一条语句)。如果您看不到所有方法,请记住 get/set 属性也是方法;它们也可能包含该图中的默认构造函数,但我会认为它不太可能。

    对于我使用过的大多数覆盖率工具,我使用语句覆盖率作为我的主要价值和方法覆盖率(访问过)。

    【讨论】:

    • 如问题所述...类中只有一种方法
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-03-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多