[敏捷开发培训] SonarQube中的Metric Definition — Tests

SonarQube中的 Metric Definition — Tests

度量指标 算法和说明
条件覆盖率 Condition coverage(branch_coverage)

On each line of code containing some boolean expressions, the condition coverage simply answers the following question: 'Has each boolean expression been evaluated both to true and false?'. This is the density of possible conditions in flow control structures that have been followed during unit tests execution.

Condition coverage = (CT + CF) / (2*B)
where

  • CT = conditions that have been evaluated to 'true' at least once
  • CF = conditions that have been evaluated to 'false' at least once
  • B = total number of conditions

新代码的条件覆盖率

Condition coverage on new code (new_branch_coverage)

与条件覆盖率相同,但仅限于新的/更新的源代码。

Identical to Condition coverage but restricted to new / updated source code.

条件覆盖命中率

Condition coverage hits (branch_coverage_hits_data)

覆盖的条件列表

List of covered conditions.

Conditions by line (conditions_by_line)

Number of conditions by line.
Covered conditions by line (covered_conditions_by_line) Number of covered conditions by line.

覆盖率

Coverage (coverage)

它是行覆盖和条件覆盖的混合体。它的目标是为以下问题提供更准确的答案:单元测试覆盖了多少源代码?

It is a mix of Line coverage and Condition coverage. Its goal is to provide an even more accurate answer to the following question: How much of the source code has been covered by the unit tests?

Coverage = (CT + CF + LC)/(2*B + EL)
where

  • CT = conditions that have been evaluated to 'true' at least once
  • CF = conditions that have been evaluated to 'false' at least once
  • LC = covered lines = linestocover - uncovered_lines
  • B = total number of conditions
  • EL = total number of executable lines (lines_to_cover)
Coverage on new code (new_coverage) Identical to Coverage but restricted to new / updated source code.

行覆盖率

Line coverage (line_coverage)

在给定的代码行上,行覆盖率只是简单地回答了以下问题:这行代码是否在单元测试执行期间执行过?

它是单元测试行覆盖的密度:

On a given line of code, Line coverage simply answers the following question: Has this line of code been executed during the execution of the unit tests?. It is the density of covered lines by unit tests:

Line coverage = LC / EL
where

  • LC = covered lines (lines_to_cover - uncovered_lines)
  • EL = total number of executable lines (lines_to_cover)

新代码行覆盖率

Line coverage on new code (new_line_coverage)

与行覆盖率相同,但仅限于新的/更新的源代码。

Identical to Line coverage but restricted to new / updated source code.

行覆盖命中率

Line coverage hits (coverage_line_hits_data)

List of covered lines.

代码行覆盖数

Lines to cover (lines_to_cover)

单元测试可以覆盖的代码行数(例如,空行或完整的注释行不被视为要覆盖的行)。

Number of lines of code which could be covered by unit tests (for example, blank lines or full comments lines are not considered as lines to cover).

新代码覆盖的行数

Lines to cover on new code (new_lines_to_cover)

与要覆盖的行相同,但仅限于新的/更新的源代码。

Identical to Lines to cover but restricted to new / updated source code.

跳过的单元测试

Skipped unit tests (skipped_tests)

跳过的单元测试数。

Number of skipped unit tests.

未覆盖条件

Uncovered conditions (uncovered_conditions)

单元测试未覆盖的条件数。

Number of conditions which are not covered by unit tests.

新代码的未覆盖条件

Uncovered conditions on new code (new_uncovered_conditions)

与未覆盖的条件相同,但仅限于新的/更新的源代码。

Identical to Uncovered conditions but restricted to new / updated source code.

未覆盖代码行数

Uncovered lines (uncovered_lines)

单元测试未覆盖的代码行数。

Number of lines of code which are not covered by unit tests.

新代码的未覆盖行数

Uncovered lines on new code (new_uncovered_lines)

与未覆盖的行相同,但仅限于新的/更新的源代码。

Identical to Uncovered lines but restricted to new / updated source code.

单元测试数

Unit tests (tests)

单元测试数量

Number of unit tests.

单元测试执行时间

Unit tests duration (test_execution_time)

执行所有单元测试需要的时间

Time required to execute all the unit tests.

单元测试错误数

Unit test errors (test_errors)

单元测试失败的数量

Number of unit tests that have failed.

单元测试失败数

Unit test failures (test_failures)

由于意外异常而失败的单元测试数

Number of unit tests that have failed with an unexpected exception.

单元测试成功密度(%)

Unit test success density (%) (test_success_density)

Test success density = (Unit tests - (Unit test errors + Unit test failures)) / Unit tests * 100
   
发布了619 篇原创文章 · 获赞 185 · 访问量 66万+

猜你喜欢

转载自blog.csdn.net/seagal890/article/details/100677972