Typical Node.js applications extensively rely on packages hosted in the npm registry. As such packages may be used by thousands of other packages or applications, it is important to assess their code coverage. Moreover, increasing code coverage may help detect previously unknown issues. In this paper, we introduce TESA, a new tool that automatically assembles a test suite for any package in the npm registry. The test suite includes 1) tests written for the target package and usually hosted in its development repository, and 2) tests selected from dependent packages. The former tests allow assessing the code coverage of the target package, while the latter ones can increase code coverage by exploiting third-party tests that also exercise code in the target package. We use TESA to assess the code coverage of 500 popular npm packages. Then, we demonstrate that TESA can significantly increase code coverage by including tests from dependent packages. Finally, we show that the test suites assembled by TESA increase the effectiveness of existing dynamic program analyses to identify performance issues that are not detectable when only executing the developer's tests.
翻译:典型的 Node.js 应用程序广泛依赖 npm 登记册中托管的软件包。 由于这些软件包可能被数千个其他软件包或应用程序使用,因此有必要评估其代码覆盖范围。 此外,增加代码覆盖可能有助于检测先前未知的问题。 在本文中,我们引入了TESA这一新工具,该工具自动组装了 npm 登记册中任何软件包的测试套件。测试套件包括:(1) 为目标软件包编写并通常在开发存储库中托管的测试,以及(2) 从依赖软件包中选择的测试。前一种测试允许评估目标软件包的代码覆盖范围,而后一种测试可以通过在目标软件包中同时运行代码的第三方测试来增加代码覆盖范围。我们利用TESA来评估500 npm 通用软件包的代码覆盖范围。 然后,我们证明TESA 能够通过包含依赖软件包的测试来大幅扩大代码覆盖范围。 最后,我们证明由 TESA 组装的测试套件提高了现有动态程序分析的有效性,以便确定仅在进行开发者测试时无法检测的性问题。