Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 55 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,33 @@ on:
- 'master'

jobs:
build:
build71:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: shivammathur/setup-php@v2
with:
php-version: '7.1.3'
- name: Install
run: composer install
- name: Install
run: composer validate
- name: Test
run: composer test
build72:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: shivammathur/setup-php@v2
with:
php-version: '7.2'
- name: Install
run: composer install
- name: Install
run: composer validate
- name: Test
run: composer test
build73:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
Expand All @@ -20,3 +46,31 @@ jobs:
run: composer install
- name: Install
run: composer validate
- name: Test
run: composer test
build74:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- name: Install
run: composer install
- name: Install
run: composer validate
- name: Test
run: composer test
build80:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
- name: Install
run: composer install
- name: Install
run: composer validate
- name: Test
run: composer test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
vendor/*
composer.phar
composer.lock
/build/
.phpunit.result.cache

21 changes: 21 additions & 0 deletions codeception.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
namespace: Yandex\Allure\Codeception
suites:
unit:
path: .

settings:
lint: true
paths:
tests: test/codeception
output: build
support: test/codeception/_support
data: test/codeception
extensions:
enabled:
- Yandex\Allure\Codeception\AllureCodeception
config:
Yandex\Allure\Codeception\AllureCodeception:
deletePreviousResults: true
outputDirectory: allure-results


32 changes: 27 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,37 @@
"source": "https://github.com/allure-framework/allure-codeception"
},
"require": {
"php": ">=5.6",
"codeception/codeception": "^2.3|^3.0|^4.0",
"allure-framework/allure-php-api": "~1.2.1",
"symfony/filesystem": ">=2.6",
"symfony/finder": ">=2.6"
"php": ">=7.1.3",
"ext-json": "*",
"codeception/codeception": "^2.5 | ^3 | ^4",
"allure-framework/allure-php-api": "^1.3",
"symfony/filesystem": "^2.7 | ^3 | ^4 | ^5",
"symfony/finder": "^2.7 | ^3 | ^4 | ^5"
},
"require-dev": {
"ext-dom": "*",
"phpunit/phpunit": "^7.2 | ^8 | ^9"
},
"autoload": {
"psr-0": {
"Yandex": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Yandex\\Allure\\Codeception\\": [
"test/report/",
"test/unit/"
]
}
},
"scripts": {
"test-report": [
"vendor/bin/codecept run --no-exit --report",
"vendor/bin/phpunit --testsuite=report"
],
"test": [
"@test-report"
]
}
}
12 changes: 12 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/7.2/phpunit.xsd"
colors="true"
defaultTestSuite="unit">
<testsuites>
<testsuite name="report">
<directory>test/report/</directory>
</testsuite>
</testsuites>
</phpunit>
68 changes: 68 additions & 0 deletions test/codeception/AnnotationTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php

declare(strict_types=1);

namespace Yandex\Allure\Codeception;

use Codeception\Test\Unit;
use Yandex\Allure\Adapter\Annotation\Description;
use Yandex\Allure\Adapter\Annotation\Features;
use Yandex\Allure\Adapter\Annotation\Parameter;
use Yandex\Allure\Adapter\Annotation\Severity;
use Yandex\Allure\Adapter\Annotation\Stories;
use Yandex\Allure\Adapter\Annotation\Title;
use Yandex\Allure\Adapter\Model\DescriptionType;
use Yandex\Allure\Adapter\Model\ParameterKind;
use Yandex\Allure\Adapter\Model\SeverityLevel;

class AnnotationTest extends Unit
{

/**
* @Title ("Test title")
*/
public function testTitleAnnotation(): void
{
$this->expectNotToPerformAssertions();
}

/**
* @Description ("Test description with `markdown`", type = DescriptionType::MARKDOWN)
*/
public function testDescriptionAnnotation(): void
{
$this->expectNotToPerformAssertions();
}

/**
* @Severity (level = SeverityLevel::MINOR)
*/
public function testSeverityAnnotation(): void
{
$this->expectNotToPerformAssertions();
}

/**
* @Parameter (name = "foo", value = "bar", kind = ParameterKind::ARGUMENT)
*/
public function testParameterAnnotation(): void
{
$this->expectNotToPerformAssertions();
}

/**
* @Stories ("Story 1", "Story 2")
*/
public function testStoriesAnnotation(): void
{
$this->expectNotToPerformAssertions();
}

/**
* @Features ("Feature 1", "Feature 2")
*/
public function testFeaturesAnnotation(): void
{
$this->expectNotToPerformAssertions();
}
}
96 changes: 96 additions & 0 deletions test/codeception/StepsTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?php

declare(strict_types=1);

namespace Yandex\Allure\Codeception;

use Codeception\Lib\ModuleContainer;
use Codeception\Scenario;
use Codeception\Step\Assertion;
use Codeception\Step\Comment;
use Codeception\Step\Meta;
use Codeception\Step\TryTo;
use Codeception\Test\Unit;
use Exception;
use PHPUnit\Framework\Assert;

class StepsTest extends Unit
{

public function testNoStepsSuccess(): void
{
$this->expectNotToPerformAssertions();
}

/**
* @throws Exception
*/
public function testNoStepsError(): void
{
throw new Exception('Error');
}

public function testNoStepsFailure(): void
{
self::fail('Failure');
}

public function testNoStepsSkipped(): void
{
self::markTestSkipped('Skipped');
}

public function testSingleSuccessfulStepWithTitle(): void
{
$this->expectNotToPerformAssertions();
$scenario = new Scenario($this);
$scenario->runStep(new Comment('Step 1 name'));
}

public function testTwoSuccessfulSteps(): void
{
$this->expectNotToPerformAssertions();

$scenario = new Scenario($this);
$scenario->runStep(new Comment('Step 1 name'));
$scenario->runStep(new Comment('Step 2 name'));
}

public function testTwoStepsFirstFails(): void
{
$this->expectNotToPerformAssertions();

$scenario = new Scenario($this);
$scenario->runStep($this->createFailingStep('Step 1 name', 'Failure'));
$scenario->runStep(new Comment('Step 2 name'));
}

public function testTwoStepsSecondFails(): void
{
$this->expectNotToPerformAssertions();

$scenario = new Scenario($this);
$scenario->runStep(new Comment('Step 1 name'));
$scenario->runStep($this->createFailingStep('Step 2 name', 'Failure'));
}

private function createFailingStep(string $name, string $failure): \Codeception\Step
{
return new class ($failure, $name) extends Meta {

private $failure;

public function __construct(string $failure, $action, array $arguments = [])
{
parent::__construct($action, $arguments);
$this->failure = $failure;
}

public function run(ModuleContainer $container = null)
{
$this->setFailed(true);
Assert::fail($this->failure);
}
};
}
}
Empty file.
Loading