mirror of
https://github.com/github/codeql.git
synced 2026-01-07 19:50:22 +01:00
53 lines
2.0 KiB
XML
53 lines
2.0 KiB
XML
<!DOCTYPE qhelp PUBLIC
|
|
"-//Semmle//qhelp//EN"
|
|
"qhelp.dtd">
|
|
<qhelp>
|
|
<overview>
|
|
<p>
|
|
This metric measures the number of tests below this location in the tree.
|
|
At a file level, this would just be the number of tests in the file.
|
|
</p>
|
|
|
|
<p>
|
|
A function or method is considered to be a "test" if one of the major
|
|
testing frameworks would invoke it as part of a test run.
|
|
Recognized frameworks include unittest, pytest, doctest and nose.
|
|
</p>
|
|
|
|
<p>
|
|
In general, having many test cases is a good thing rather than a bad
|
|
thing. However, at the file level, tests should typically be grouped
|
|
by the functionality they relate to, which makes a file with an
|
|
exceptionally high number of tests a strong candidate for splitting
|
|
up. At a higher level, this metric makes it possible to compare the
|
|
number of tests in different components, potentially flagging
|
|
functionality that is comparatively under-tested.
|
|
</p>
|
|
</overview>
|
|
<recommendation>
|
|
<p>
|
|
Since it is typically not a problem to have too many tests, this
|
|
metric is usually included for the purposes of collecting
|
|
information, rather than finding problematic areas in the code. With
|
|
that in mind, it is usually a good idea to avoid an excessive number
|
|
of tests in a single file, and to maintain a broadly comparable
|
|
level of testing across components.
|
|
</p>
|
|
|
|
<p>
|
|
When assessing the thoroughness of a code base's test suite, the number
|
|
of tests provides only part of the story. Test coverage
|
|
statistics allow a more detailed examination of which parts of the
|
|
code deserve improvements in this area.
|
|
</p>
|
|
</recommendation>
|
|
<references>
|
|
|
|
<li>Python Standard Library: <a href="https://docs.python.org/library/unittest.html">unitest</a>.</li>
|
|
<li>Python Standard Library: <a href="https://docs.python.org/2/library/doctest.html">doctest</a>.</li>
|
|
<li><a href="http://pytest.org/latest/">http://pytest.org</a>.</li>
|
|
<li>Read the docs: <a href="http://nose.readthedocs.org/en/latest/">http://nose.readthedocs.org/en/latest</a>.</li>
|
|
|
|
</references>
|
|
</qhelp>
|