Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 2 prototype #78

Merged
merged 2 commits into from
Oct 20, 2021
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
25 changes: 25 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Define the line ending behavior of the different file extensions
# Set default behavior, in case users don't have core.autocrlf set.
* text text=auto eol=lf

.php diff=php

# Declare files that will always have CRLF line endings on checkout.
*.bat eol=crlf

# Declare files that will always have LF line endings on checkout.
*.pem eol=lf

# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
*.gif binary
*.ico binary
*.mo binary
*.pdf binary
*.phar binary
*.woff binary
*.woff2 binary
*.ttf binary
*.otf binary
*.eot binary
100 changes: 40 additions & 60 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,68 +10,48 @@ on:
- 'hotfix-*'

jobs:
build71:
runs-on: ubuntu-latest
tests:
name: PHP ${{ matrix.php-version }} on ${{ matrix.os }} (${{ matrix.composer-options }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
php-version:
- "8.0"
- "8.1"
os:
- ubuntu-latest
- windows-latest
- macOS-latest
composer-options:
- ""
- "--prefer-lowest"
steps:
- uses: actions/checkout@v2.3.4
- uses: shivammathur/setup-php@2.14.0
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@v2.3.4
- uses: shivammathur/setup-php@2.14.0
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@v2.3.4
- uses: shivammathur/setup-php@2.14.0
with:
php-version: '7.3'
- name: Install
run: composer install
- name: Install
- name: Checkout
uses: actions/checkout@v2.3.4

- name: Validate composer.json and composer.lock
run: composer validate
- name: Test
run: composer test
build74:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
- uses: shivammathur/setup-php@2.14.0

- name: Set up PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- name: Install
run: composer install
- name: Install
run: composer validate
- name: Test
php-version: ${{ matrix.php-version }}
extensions: pcntl, posix, intl
coverage: xdebug
ini-values: error_reporting=E_ALL

- name: Install dependencies
run: composer update
--prefer-dist
--no-progress
${{ matrix.composer-options }}

- name: Run tests
if: ${{ matrix.php-version != '8.1' }}
run: composer test
build80:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
- uses: shivammathur/setup-php@2.14.0
with:
php-version: '8.0'
- name: Install
run: composer install
- name: Install
run: composer validate
- name: Test

- name: Run tests (experimental)
if: ${{ matrix.php-version == '8.1' }}
continue-on-error: true
run: composer test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ vendor/*
composer.phar
composer.lock
/build/
/test/codeception/_support/_generated/
.phpunit.result.cache

26 changes: 11 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Allure Codeception Adapter

[![Latest Stable Version](http://poser.pugx.org/allure-framework/allure-codeception/v)](https://packagist.org/packages/allure-framework/allure-codeception)
[![Build](https://github.com/allure-framework/allure-codeception/actions/workflows/build.yml/badge.svg)](https://github.com/allure-framework/allure-codeception/actions/workflows/build.yml)
[![Type Coverage](https://shepherd.dev/github/allure-framework/allure-codeception/coverage.svg)](https://shepherd.dev/github/allure-framework/allure-codeception)
[![Psalm Level](https://shepherd.dev/github/allure-framework/allure-codeception/level.svg)](https://shepherd.dev/github/allure-framework/allure-codeception)
[![Total Downloads](http://poser.pugx.org/allure-framework/allure-codeception/downloads)](https://packagist.org/packages/allure-framework/allure-codeception)
[![License](http://poser.pugx.org/allure-framework/allure-codeception/license)](https://packagist.org/packages/allure-framework/allure-codeception)

This is an official [Codeception](http://codeception.com) adapter for Allure Framework.

Expand All @@ -15,45 +20,36 @@ In order to use this adapter you need to add a new dependency to your **composer
```
{
"require": {
"php": ">=5.4.0",
"allure-framework/allure-codeception": ">=1.1.0"
"php": "^8",
"allure-framework/allure-codeception": "^2"
}
}
```
To enable this adapter in Codeception tests simply put it in "enabled" extensions section of **codeception.yml**:
```yaml
extensions:
enabled:
- Yandex\Allure\Codeception\AllureCodeception
- Qameta\Allure\Codeception\AllureCodeception
config:
Yandex\Allure\Codeception\AllureCodeception:
deletePreviousResults: false
Qameta\Allure\Codeception\AllureCodeception:
outputDirectory: allure-results
ignoredAnnotations:
- env
- dataprovider
```

`deletePreviousResults` will clear all `.xml` files from output directory (this
behavior may change to complete cleanup later). It is set to `false` by default.

`outputDirectory` is used to store Allure results and will be calculated
relatively to Codeception output directory (also known as `paths: log` in
codeception.yml) unless you specify an absolute path. You can traverse up using
`..` as usual. `outputDirectory` defaults to `allure-results`.

`ignoredAnnotations` is used to define extra custom annotations to ignore. It is empty by default.

To generate report from your favourite terminal,
[install](https://github.com/allure-framework/allure-cli#installation)
allure-cli and run following command (assuming you're in project root and using
default configuration):

```bash
allure generate --report-version 1.4.5 --report-path tests/_output/allure-report -- tests/_output/allure-results
allure generate -o ./build/allure-report ./build/allure-results
```

Report will be generated in `tests/_output/allure-report`.
Report will be generated in `build/allure-report`.

## Main features
See respective [PHPUnit](https://github.com/allure-framework/allure-phpunit#advanced-features) section.
12 changes: 4 additions & 8 deletions codeception.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
namespace: Yandex\Allure\Codeception
suites:
unit:
path: .
namespace: Qameta\Allure\Codeception\Test

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


56 changes: 40 additions & 16 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,45 +8,69 @@
{
"name": "Ivan Krutov",
"email": "vania-pooh@aerokube.com",
"role": "Developer"
"role": "Developer"
},
{
"name": "Edward Surov",
"email": "zoohie@gmail.com",
"role": "Developer"
}
],
"support": {
"email": "allure@qameta.io",
"source": "https://github.com/allure-framework/allure-codeception"
},
"require": {
"php": ">=7.1.3",
"php": "^8",
"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"
"codeception/codeception": "^4.1",
"allure-framework/allure-php-commons": "2.0.0-rc3"
},
"require-dev": {
"ext-dom": "*",
"phpunit/phpunit": "^7.2 | ^8 | ^9"
"phpunit/phpunit": "^9",
"psalm/plugin-phpunit": "^0.16.1",
"remorhaz/php-json-data": "^0.5.3",
"remorhaz/php-json-path": "^0.7.7",
"squizlabs/php_codesniffer": "^3.6.1",
"vimeo/psalm": "^4.10"
},
"conflict": {
"codeception/phpunit-wrapper": "<9.0.1"
},
"autoload": {
"psr-0": {
"Yandex": "src/"
"psr-4": {
"Qameta\\Allure\\Codeception\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Yandex\\Allure\\Codeception\\": [
"test/report/",
"test/unit/"
"Qameta\\Allure\\Codeception\\Test\\Functional\\": "test/codeception/functional/",
"Qameta\\Allure\\Codeception\\Test\\Acceptance\\": "test/codeception/acceptance/",
"Qameta\\Allure\\Codeception\\Test\\Unit\\": "test/codeception/unit/",
"Qameta\\Allure\\Codeception\\Test\\": [
"test/codeception/_support/",
"test/report/"
]
}
},
"scripts": {
"test-report": [
"vendor/bin/codecept run --no-exit --report",
"vendor/bin/phpunit --testsuite=report"
"build": [
"vendor/bin/codecept build",
"vendor/bin/codecept gherkin:snippets acceptance"
],
"test-cs": "vendor/bin/phpcs -sp",
"test-report-generate": [
"rm -rf ./build/log/",
"vendor/bin/codecept run --no-exit --report"
],
"test-report-check": "vendor/bin/phpunit --testsuite=report",
"test-psalm": "vendor/bin/psalm --shepherd",
"test": [
"@test-report"
"@test-cs",
"@test-report-generate",
"@test-report-check",
"@test-psalm"
]
}
}
15 changes: 15 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ruleset name="Qameta Coding Standards">
<description>Qameta Coding Standards</description>

<file>src</file>
<file>test</file>

<arg name="colors"/>

<rule ref="PSR12" />

<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
<exclude-pattern>*/test/*Test.php</exclude-pattern>
</rule>
</ruleset>
2 changes: 1 addition & 1 deletion phpunit.xml → phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?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"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
colors="true"
defaultTestSuite="unit">
<testsuites>
Expand Down
17 changes: 17 additions & 0 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<psalm
errorLevel="1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd">
<projectFiles>
<directory name="src"/>
<directory name="test/report/"/>
<ignoreFiles>
<directory name="vendor"/>
</ignoreFiles>
</projectFiles>
<plugins>
<pluginClass class="Psalm\PhpUnitPlugin\Plugin"/>
</plugins>
</psalm>
Loading