remi-san/ouroboros

此软件包的最新版本(v0.1.1)没有提供许可信息。

一个简化端到端(e2e)测试的库。

v0.1.1 2017-04-21 12:16 UTC

This package is auto-updated.

Last update: 2024-09-21 23:05:50 UTC


README

"εν το παν"

Ouroboros是一个简单的库,允许您使用您喜欢的PHP测试框架创建端到端(e2e)测试。就像其灵感来源的蛇吞自己的尾巴一样,Ouroboros库将使您轻松创建、销毁应用程序进行测试,并为每个测试重新开始。

如何使用它?

初始化您的TestHelper

$this->testHelper = new TestHelper(
    new MakefileInfrastructureHelper($appBasePath), // or any other infra helper
    new CommandLauncherApplicationHelper($appBasePath, 'make run'), // or any other app helper
    new LoggerConditionWaiter( // if you want to follow a logfile for completion condition
        $logFile,
        new TextConditionMatcherFactory(
            [
                self::CONDITION_ONE => 'This is my first condition',
                self::CONDITION_TWO => 'This is my second condition',
            ]
        ),
        $logger,
        5
    )
);

在您的测试文件中使用它(这里使用phpunit

/**
 * Init.
 */
public function setUp()
{
    $this->testHelper->setUp();
}

/**
 * Close.
 */
public function tearDown()
{
    $this->testHelper->tearDown();
}

/**
 * @test
 */
public function itShouldWaitForAllConditionsAndSucceed()
{
    $this->testHelper->wait([self::CONDITION_ONE, self::CONDITION_TWO]);
}