承接 lirik44/phpunit-teamcity-extended 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

lirik44/phpunit-teamcity-extended

最新稳定版本:v1.0.3

Composer 安装命令:

composer require lirik44/phpunit-teamcity-extended

包简介

Extended support teamcity testMetadata in php STDOUT output for phpunit

README 文档

README

Extended support for testMetadata in PHPUnit STDOUT.

Added Description Trait for parse @description annotation in tests

Installation

composer require lirik44/phpunit-teamcity-extended

Using Descripton trait

Specify @description annotation before test function

class MyTest extends PHPUnit\Framework\TestCase
{
    /**
     * @description This test check something on page
     */
    public function testSomethingOnPage()
    {
        // test something ...
    }

Use DescriptionTrait in Selenium Helper:

class SeleniumHelper extends TestCase
{
    protected $testHelper;
    
    public function setUp():void
    {
        $testName=$this->getName();
        $this->testHelper->setupSeleniumSession($testName);
        date_default_timezone_set( 'Europe/Moscow' );
    }
    
    use DescriptionTrait;
    
    public function tearDown():void
    {
        //If test fails get description from @description
        if ($this->hasFailed())
        {
            //Get description text
            $this->description = $this->getTestDescription();
        }

Other testMetadata features

Similar as a description you can specify different testMetadata in teadDown() section:

public function tearDown():void
    {
        //Take metaData if test has failed
        if ($this->hasFailed())
        {
            //Get browser URL in the moment of test error occur
            $this->browserLink = $this->webDriver->getCurrentURL();
            //Get browser screenshot in the moment of test error occur
            $this->screenshotErr = $this->testHelper->getErrorScreenshot($testName);
            //Get php_errors.log after test fails
            $this->errLog = $this->testHelper->getPhpErrorLog($testName);
            //Get mono.log after test fails
            $this->monoLog = $this->testHelper->getMonoLog($testName);
            }
        }

Also it is possible to get any information into setUp() section and publish that as a buildTag:

public function setUp():void
    {
        $testName=$this->getName();
        $this->testHelper->setupSeleniumSession($testName);
        date_default_timezone_set( 'Europe/Moscow' );
        //Get current application git branch
        $this->buildTag = $this->getUsedBranch();
    }

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2023-11-07