定制 shawnveltman/testmetrics 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

shawnveltman/testmetrics

Composer 安装命令:

composer require shawnveltman/testmetrics

包简介

A few helpers to profile your test suite

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

An easy way to find slow tests within your application. Since Laravel Parallel Testing allows for JUnit logging, this is simply a JUnit xml parser that grabs simple stats (setup time, average test time after setup) for each test suite, to hilight those that are the slowest.

Installation

You can install the package via composer:

composer require shawnveltman/testmetrics

After installation, be sure to add the following lines to your phpunit.xml file:

<logging>
    <junit outputFile="junit.xml"/>
</logging>

Finally, be sure to add the junit.xml to your gitignore.

Usage

Now, after you run your parallel tests, you will have the junit.xml file. Grab the contents of that file as a string, and pass it to the test_results_parser method, then print your results. That's it!

$testmetrics = new Shawnveltman\Testmetrics();
echo $testmetrics->test_results_parser(contents: $file_contents)->print_results();

Alternately, you can pass a filepath instead of string contents.

$testmetrics = new \Shawnveltman\Testmetrics\Testmetrics();
$path = base_path('junit.xml');
echo $testmetrics->test_results_parser(path: $path)->print_results();

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 223
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-08-13