├── .github └── workflows │ ├── browser-tests.yaml │ ├── ci.yaml │ └── pr-check.yaml ├── .gitignore ├── .php_cs ├── LICENSE ├── README.md ├── composer.json ├── dependencies.json ├── phpunit.php ├── phpunit.xml ├── src └── Yandex │ └── Allure │ └── Adapter │ ├── Allure.php │ ├── AllureException.php │ ├── Annotation │ ├── AnnotationManager.php │ ├── AnnotationProvider.php │ ├── Description.php │ ├── Features.php │ ├── Issues.php │ ├── Parameter.php │ ├── Parameters.php │ ├── Severity.php │ ├── Stories.php │ ├── TestCaseId.php │ ├── TestType.php │ └── Title.php │ ├── Event │ ├── AddAttachmentEvent.php │ ├── AddParameterEvent.php │ ├── ClearStepStorageEvent.php │ ├── ClearTestCaseStorageEvent.php │ ├── Event.php │ ├── RemoveAttachmentsEvent.php │ ├── StepCanceledEvent.php │ ├── StepEvent.php │ ├── StepFailedEvent.php │ ├── StepFinishedEvent.php │ ├── StepStartedEvent.php │ ├── Storage │ │ ├── StepStorage.php │ │ ├── TestCaseStorage.php │ │ └── TestSuiteStorage.php │ ├── TestCaseBrokenEvent.php │ ├── TestCaseCanceledEvent.php │ ├── TestCaseEvent.php │ ├── TestCaseFailedEvent.php │ ├── TestCaseFinishedEvent.php │ ├── TestCasePendingEvent.php │ ├── TestCaseStartedEvent.php │ ├── TestCaseStatusChangedEvent.php │ ├── TestSuiteEvent.php │ ├── TestSuiteFinishedEvent.php │ └── TestSuiteStartedEvent.php │ ├── Model │ ├── Attachment.php │ ├── ConstantChecker.php │ ├── Description.php │ ├── DescriptionType.php │ ├── Entity.php │ ├── Failure.php │ ├── Label.php │ ├── LabelType.php │ ├── Parameter.php │ ├── ParameterKind.php │ ├── Provider.php │ ├── SeverityLevel.php │ ├── Status.php │ ├── Step.php │ ├── TestCase.php │ └── TestSuite.php │ └── Support │ ├── AttachmentSupport.php │ ├── StepSupport.php │ └── Utils.php └── test └── Yandex └── Allure └── Adapter ├── AllureTest.php ├── Annotation ├── AnnotationManagerTest.php ├── AnnotationProviderTest.php └── Fixtures │ ├── ClassWithAnnotations.php │ ├── ClassWithIgnoreAnnotation.php │ ├── ExampleTestSuite.php │ └── TestAnnotation.php ├── Event ├── AddAttachmentEventTest.php ├── AddParameterEventTest.php ├── RemoveAttachmentsEventTest.php ├── StepCanceledEventTest.php ├── StepFailedEventTest.php ├── StepFinishedEventTest.php ├── StepStartedEventTest.php ├── StepStatusChangedEventTest.php ├── Storage │ ├── Fixtures │ │ └── MockedRootStepStorage.php │ ├── StepStorageTest.php │ ├── TestCaseStorageTest.php │ └── TestSuiteStorageTest.php ├── TestCaseBrokenEventTest.php ├── TestCaseCanceledEventTest.php ├── TestCaseFailedEventTest.php ├── TestCaseFinishedEventTest.php ├── TestCasePendingEventTest.php ├── TestCaseStartedEventTest.php ├── TestCaseStatusChangedEventTest.php ├── TestSuiteFinishedEventTest.php └── TestSuiteStartedEventTest.php ├── Fixtures ├── GenericStepEvent.php ├── GenericTestCaseEvent.php └── GenericTestSuiteEvent.php ├── Model ├── ConstantCheckerTest.php └── Fixtures │ └── TestConstants.php ├── Support ├── AttachmentSupportTest.php ├── MockedLifecycle.php ├── StepSupportTest.php └── UtilsTest.php ├── XMLValidationTest.php └── allure-1.4.0.xsd /.github/workflows/browser-tests.yaml: -------------------------------------------------------------------------------- 1 | name: Browser tests 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | - '[0-9]+.[0-9]+' 8 | pull_request: ~ 9 | 10 | jobs: 11 | dxp-integration: 12 | name: "Ibexa DXP integration tests" 13 | uses: ibexa/gh-workflows/.github/workflows/browser-tests.yml@main 14 | with: 15 | project-edition: 'oss' 16 | project-version: '^4.0.x-dev' 17 | test-suite: '--mode=standard --profile=browser --suite=admin-ui --tags=@richtext' 18 | secrets: 19 | SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} 20 | -------------------------------------------------------------------------------- /.github/workflows/ci.yaml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | - '[0-9]+.[0-9]+' 8 | pull_request: ~ 9 | 10 | jobs: 11 | tests: 12 | name: Tests 13 | runs-on: "ubuntu-20.04" 14 | timeout-minutes: 10 15 | 16 | strategy: 17 | fail-fast: false 18 | matrix: 19 | php: 20 | - '7.3' 21 | - '7.4' 22 | - '8.0' 23 | - '8.1' 24 | composer_options: [ "" ] 25 | experimental: [false] 26 | 27 | steps: 28 | - uses: actions/checkout@v2 29 | 30 | - name: Setup PHP Action 31 | uses: shivammathur/setup-php@v2 32 | with: 33 | php-version: ${{ matrix.php }} 34 | coverage: none 35 | 36 | - uses: "ramsey/composer-install@v1" 37 | with: 38 | dependency-versions: "highest" 39 | composer-options: "${{ matrix.composer_options }}" 40 | 41 | - name: Setup problem matchers for PHPUnit 42 | run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" 43 | 44 | - name: Run test suite 45 | run: composer run-script --timeout=600 test 46 | 47 | cs_fix: 48 | name: Run code style check 49 | runs-on: "ubuntu-20.04" 50 | strategy: 51 | matrix: 52 | php: 53 | - '7.3' 54 | steps: 55 | - uses: actions/checkout@v2 56 | 57 | - name: Setup PHP Action 58 | uses: shivammathur/setup-php@v2 59 | with: 60 | php-version: ${{ matrix.php }} 61 | coverage: none 62 | tools: cs2pr 63 | 64 | - uses: "ramsey/composer-install@v1" 65 | with: 66 | dependency-versions: "highest" 67 | 68 | - name: Run code style check 69 | run: composer run-script check-cs -- --format=checkstyle | cs2pr 70 | -------------------------------------------------------------------------------- /.github/workflows/pr-check.yaml: -------------------------------------------------------------------------------- 1 | name: PR check 2 | on: 3 | pull_request: 4 | types: 5 | - opened 6 | - synchronize 7 | - reopened 8 | - edited 9 | 10 | jobs: 11 | test-base-branch: 12 | uses: ibexa/gh-workflows/.github/workflows/pr-check.yml@main 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /vendor/ 2 | composer.lock 3 | composer.phar 4 | -------------------------------------------------------------------------------- /.php_cs: -------------------------------------------------------------------------------- 1 | setFinder(PhpCsFixer\Finder::create() 7 | ->in(__DIR__ . '/src') 8 | ->files()->name('*.php') 9 | ); -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2014 Yandex LLC 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Allure PHP API 2 | This repository contains PHP API for Allure framework with eZ Systems modifications for newer JMS Serializer. The main idea is to reuse this API when creating adapters for different test frameworks. 3 | 4 | ## Getting started 5 | In order to use this API you simply need to add the following to **composer.json**: 6 | ```json 7 | { 8 | "require": { 9 | "php": "^5.4.0 || ^7.1.3", 10 | "ezsystems/allure-php-api": "~3.0.0" 11 | } 12 | } 13 | ``` 14 | Basic usage idiom is to fire an event like the following: 15 | ```php 16 | Allure::lifecycle()->fire(new TestCaseFinishedEvent()); 17 | ``` 18 | 19 | ## Events 20 | The following events are available right now: 21 | * AddAttachmentEvent 22 | * AddParameterEvent 23 | * ClearStepStorageEvent 24 | * ClearTestCaseStorageEvent 25 | * RemoveAttachmentsEvent 26 | * StepCanceledEvent 27 | * StepEvent 28 | * StepFailedEvent 29 | * StepFinishedEvent 30 | * StepStartedEvent 31 | * TestCaseBrokenEvent 32 | * TestCaseCanceledEvent 33 | * TestCaseEvent 34 | * TestCaseFailedEvent 35 | * TestCaseFinishedEvent 36 | * TestCasePendingEvent 37 | * TestCaseStartedEvent 38 | * TestCaseStatusChangedEvent 39 | * TestSuiteEvent 40 | * TestSuiteFinishedEvent 41 | * TestSuiteStartedEvent 42 | 43 | ## Usage examples 44 | See [allure-phpunit](https://github.com/allure-framework/allure-phpunit) project. -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ezsystems/allure-php-api", 3 | "keywords":["php", "report", "allure", "api"], 4 | "description": "PHP API for Allure adapter", 5 | "homepage": "http://allure.qatools.ru/", 6 | "license": "Apache-2.0", 7 | "authors": [ 8 | { 9 | "name": "Ivan Krutov", 10 | "email": "vania-pooh@yandex-team.ru", 11 | "role": "Developer" 12 | }, 13 | { 14 | "name": "eZ qa-team modifications", 15 | "homepage": "https://github.com/ezsystems/allure-php-commons/graphs/contributors" 16 | } 17 | ], 18 | "support": { 19 | "email": "allure@yandex-team.ru", 20 | "source": "https://github.com/allure-framework/allure-php-api" 21 | }, 22 | "require": { 23 | "php": "^7.3 || ^8.0", 24 | "jms/serializer": "^3.0", 25 | "ramsey/uuid": "^3.0.0", 26 | "symfony/http-foundation": "^5.0", 27 | "symfony/mime": "^5.0" 28 | }, 29 | "require-dev": { 30 | "ezsystems/ezplatform-code-style": "^0.1.0", 31 | "friendsofphp/php-cs-fixer": "^2.16.0", 32 | "ibexa/ci-scripts": "^0.2@dev", 33 | "phpunit/phpunit": "^9.0" 34 | }, 35 | "autoload": { 36 | "psr-0": { 37 | "Yandex": ["src/", "test/"] 38 | } 39 | }, 40 | "scripts": { 41 | "fix-cs": "php-cs-fixer fix -v --show-progress=estimating", 42 | "check-cs": "@fix-cs --dry-run", 43 | "test": "phpunit -c phpunit.xml" 44 | }, 45 | "extra": { 46 | "branch-alias": { 47 | "dev-master": "3.4.x-dev" 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /dependencies.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "requirement": "^3.4.x-dev", 4 | "repositoryUrl": "https://github.com/ezsystems/allure-behat", 5 | "package": "ezsystems/allure-behat", 6 | "shouldBeAddedAsVCS": false 7 | } 8 | ] 9 | -------------------------------------------------------------------------------- /phpunit.php: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 15 | test/Yandex/Allure/Adapter/ 16 | 17 | 18 | 19 | 20 | src/ 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Allure.php: -------------------------------------------------------------------------------- 1 | stepStorage = new StepStorage(); 45 | $this->testCaseStorage = new TestCaseStorage(); 46 | $this->testSuiteStorage = new TestSuiteStorage(); 47 | } 48 | 49 | /** 50 | * @return Allure 51 | */ 52 | public static function lifecycle() 53 | { 54 | if (!isset(self::$lifecycle)) { 55 | self::setDefaultLifecycle(); 56 | } 57 | 58 | return self::$lifecycle; 59 | } 60 | 61 | public static function setLifecycle(Allure $lifecycle) 62 | { 63 | self::$lifecycle = $lifecycle; 64 | } 65 | 66 | public static function setDefaultLifecycle() 67 | { 68 | self::$lifecycle = new Allure(); 69 | } 70 | 71 | public function fire(Event $event) 72 | { 73 | if ($event instanceof StepStartedEvent) { 74 | $this->processStepStartedEvent($event); 75 | } elseif ($event instanceof StepFinishedEvent) { 76 | $this->processStepFinishedEvent($event); 77 | } elseif ($event instanceof TestCaseStartedEvent) { 78 | $this->processTestCaseStartedEvent($event); 79 | } elseif ($event instanceof TestCaseFinishedEvent) { 80 | $this->processTestCaseFinishedEvent($event); 81 | } elseif ($event instanceof TestSuiteFinishedEvent) { 82 | $this->processTestSuiteFinishedEvent($event); 83 | } elseif ($event instanceof TestSuiteEvent) { 84 | $this->processTestSuiteEvent($event); 85 | } elseif ($event instanceof ClearStepStorageEvent) { 86 | $this->processClearStepStorageEvent(); 87 | } elseif ($event instanceof ClearTestCaseStorageEvent) { 88 | $this->processClearTestCaseStorageEvent(); 89 | } elseif ($event instanceof TestCaseEvent) { 90 | $this->processTestCaseEvent($event); 91 | } elseif ($event instanceof StepEvent) { 92 | $this->processStepEvent($event); 93 | } else { 94 | throw new AllureException('Unknown event: ' . get_class($event)); 95 | } 96 | $this->lastEvent = $event; 97 | } 98 | 99 | protected function processStepStartedEvent(StepStartedEvent $event) 100 | { 101 | $step = new Step(); 102 | $event->process($step); 103 | $this->getStepStorage()->put($step); 104 | } 105 | 106 | protected function processStepFinishedEvent(StepFinishedEvent $event) 107 | { 108 | $step = $this->getStepStorage()->pollLast(); 109 | $event->process($step); 110 | $this->getStepStorage()->getLast()->addStep($step); 111 | } 112 | 113 | protected function processStepEvent(StepEvent $event) 114 | { 115 | $step = $this->getStepStorage()->getLast(); 116 | $event->process($step); 117 | } 118 | 119 | protected function processTestCaseStartedEvent(TestCaseStartedEvent $event) 120 | { 121 | //init root step if needed 122 | $this->getStepStorage()->getLast(); 123 | 124 | $testCase = $this->getTestCaseStorage()->get(); 125 | $event->process($testCase); 126 | $this->getTestSuiteStorage()->get($event->getSuiteUuid())->addTestCase($testCase); 127 | } 128 | 129 | protected function processTestCaseFinishedEvent(TestCaseFinishedEvent $event) 130 | { 131 | $testCase = $this->getTestCaseStorage()->get(); 132 | $event->process($testCase); 133 | $rootStep = $this->getStepStorage()->pollLast(); 134 | foreach ($rootStep->getSteps() as $step) { 135 | $testCase->addStep($step); 136 | } 137 | foreach ($rootStep->getAttachments() as $attachment) { 138 | $testCase->addAttachment($attachment); 139 | } 140 | $this->getTestCaseStorage()->clear(); 141 | } 142 | 143 | protected function processTestCaseEvent(TestCaseEvent $event) 144 | { 145 | $testCase = $this->getTestCaseStorage()->get(); 146 | $event->process($testCase); 147 | } 148 | 149 | protected function processTestSuiteEvent(TestSuiteEvent $event) 150 | { 151 | $uuid = $event->getUuid(); 152 | $testSuite = $this->getTestSuiteStorage()->get($uuid); 153 | $event->process($testSuite); 154 | } 155 | 156 | protected function processTestSuiteFinishedEvent(TestSuiteFinishedEvent $event) 157 | { 158 | $suiteUuid = $event->getUuid(); 159 | $testSuite = $this->getTestSuiteStorage()->get($suiteUuid); 160 | $event->process($testSuite); 161 | $this->getTestSuiteStorage()->remove($suiteUuid); 162 | $this->saveToFile($suiteUuid, $testSuite); 163 | } 164 | 165 | protected function saveToFile($testSuiteUuid, TestSuite $testSuite) 166 | { 167 | if ($testSuite->size() > 0) { 168 | $xml = $testSuite->serialize(); 169 | $fileName = $testSuiteUuid . '-testsuite.xml'; 170 | $filePath = Provider::getOutputDirectory() . \DIRECTORY_SEPARATOR . $fileName; 171 | file_put_contents($filePath, $xml); 172 | } 173 | } 174 | 175 | protected function processClearStepStorageEvent() 176 | { 177 | $this->getStepStorage()->clear(); 178 | } 179 | 180 | protected function processClearTestCaseStorageEvent() 181 | { 182 | $this->getTestCaseStorage()->clear(); 183 | } 184 | 185 | /** 186 | * @return \Yandex\Allure\Adapter\Event\Storage\StepStorage 187 | */ 188 | public function getStepStorage() 189 | { 190 | return $this->stepStorage; 191 | } 192 | 193 | /** 194 | * @return \Yandex\Allure\Adapter\Event\Storage\TestCaseStorage 195 | */ 196 | public function getTestCaseStorage() 197 | { 198 | return $this->testCaseStorage; 199 | } 200 | 201 | /** 202 | * @return \Yandex\Allure\Adapter\Event\Storage\TestSuiteStorage 203 | */ 204 | public function getTestSuiteStorage() 205 | { 206 | return $this->testSuiteStorage; 207 | } 208 | 209 | /** 210 | * @return \Yandex\Allure\Adapter\Event\Event 211 | */ 212 | public function getLastEvent() 213 | { 214 | return $this->lastEvent; 215 | } 216 | } 217 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/AllureException.php: -------------------------------------------------------------------------------- 1 | labels = []; 35 | $this->parameters = []; 36 | $this->processAnnotations($annotations); 37 | } 38 | 39 | private function processAnnotations(array $annotations) 40 | { 41 | foreach ($annotations as $annotation) { 42 | if ($annotation instanceof Title) { 43 | $this->title = $annotation->value; 44 | } elseif ($annotation instanceof Description) { 45 | $this->description = new Model\Description( 46 | $annotation->type, 47 | $annotation->value 48 | ); 49 | } elseif ($annotation instanceof Features) { 50 | foreach ($annotation->getFeatureNames() as $featureName) { 51 | $this->labels[] = Model\Label::feature($featureName); 52 | } 53 | } elseif ($annotation instanceof Stories) { 54 | foreach ($annotation->getStories() as $issueKey) { 55 | $this->labels[] = Model\Label::story($issueKey); 56 | } 57 | } elseif ($annotation instanceof Issues) { 58 | foreach ($annotation->getIssueKeys() as $issueKey) { 59 | $this->labels[] = Model\Label::issue($issueKey); 60 | } 61 | } elseif ($annotation instanceof TestCaseId) { 62 | foreach ($annotation->getTestCaseIds() as $testCaseId) { 63 | $this->labels[] = Model\Label::testId($testCaseId); 64 | } 65 | } elseif ($annotation instanceof Severity) { 66 | $this->labels[] = Model\Label::severity( 67 | ConstantChecker::validate('Yandex\Allure\Adapter\Model\SeverityLevel', $annotation->level) 68 | ); 69 | } elseif ($annotation instanceof TestType) { 70 | $this->labels[] = Model\Label::testType($annotation->type); 71 | } elseif ($annotation instanceof Parameter) { 72 | $this->parameters[] = new Model\Parameter( 73 | $annotation->name, 74 | $annotation->value, 75 | $annotation->kind 76 | ); 77 | } elseif ($annotation instanceof Parameters) { 78 | foreach ($annotation->parameters as $parameter) { 79 | $this->parameters[] = new Model\Parameter( 80 | $parameter->name, 81 | $parameter->value, 82 | $parameter->kind 83 | ); 84 | } 85 | } 86 | } 87 | } 88 | 89 | public function updateTestSuiteEvent(TestSuiteStartedEvent $event) 90 | { 91 | if ($this->isTitlePresent()) { 92 | $event->setTitle($this->getTitle()); 93 | } 94 | 95 | if ($this->isDescriptionPresent()) { 96 | $event->setDescription($this->getDescription()); 97 | } 98 | 99 | if ($this->areLabelsPresent()) { 100 | $event->setLabels($this->getLabels()); 101 | } 102 | } 103 | 104 | public function updateTestCaseEvent(TestCaseStartedEvent $event) 105 | { 106 | if ($this->isTitlePresent()) { 107 | $event->setTitle($this->getTitle()); 108 | } 109 | 110 | if ($this->isDescriptionPresent()) { 111 | $event->setDescription($this->getDescription()); 112 | } 113 | 114 | if ($this->areLabelsPresent()) { 115 | $event->setLabels($this->getLabels()); 116 | } 117 | 118 | if ($this->areParametersPresent()) { 119 | $event->setParameters($this->getParameters()); 120 | } 121 | } 122 | 123 | /** 124 | * @return Model\Description 125 | */ 126 | public function getDescription() 127 | { 128 | return $this->description; 129 | } 130 | 131 | /** 132 | * @return array 133 | */ 134 | public function getLabels() 135 | { 136 | return $this->labels; 137 | } 138 | 139 | /** 140 | * @return array 141 | */ 142 | public function getParameters() 143 | { 144 | return $this->parameters; 145 | } 146 | 147 | /** 148 | * @return string 149 | */ 150 | public function getTitle() 151 | { 152 | return $this->title; 153 | } 154 | 155 | public function isTitlePresent() 156 | { 157 | return isset($this->title); 158 | } 159 | 160 | public function isDescriptionPresent() 161 | { 162 | return isset($this->description); 163 | } 164 | 165 | public function areLabelsPresent() 166 | { 167 | return !empty($this->labels); 168 | } 169 | 170 | public function areParametersPresent() 171 | { 172 | return !empty($this->parameters); 173 | } 174 | } 175 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Annotation/AnnotationProvider.php: -------------------------------------------------------------------------------- 1 | getClassAnnotations($ref); 35 | } 36 | 37 | /** 38 | * Returns a list of method annotations. 39 | * 40 | * @param $instance 41 | * @param $methodName 42 | * 43 | * @return array 44 | */ 45 | public static function getMethodAnnotations($instance, $methodName) 46 | { 47 | $ref = new \ReflectionMethod($instance, $methodName); 48 | 49 | return self::getIndexedReader()->getMethodAnnotations($ref); 50 | } 51 | 52 | /** 53 | * @return IndexedReader 54 | */ 55 | private static function getIndexedReader() 56 | { 57 | if (!isset(self::$indexedReader)) { 58 | self::$indexedReader = new IndexedReader(self::getAnnotationReader()); 59 | } 60 | 61 | return self::$indexedReader; 62 | } 63 | 64 | /** 65 | * @return AnnotationReader 66 | */ 67 | private static function getAnnotationReader() 68 | { 69 | if (!isset(self::$annotationReader)) { 70 | self::$annotationReader = new AnnotationReader(); 71 | } 72 | 73 | return self::$annotationReader; 74 | } 75 | 76 | /** 77 | * Allows to ignore framework-specific annotations. 78 | * 79 | * @param array $annotations 80 | */ 81 | public static function addIgnoredAnnotations(array $annotations) 82 | { 83 | foreach ($annotations as $annotation) { 84 | self::getAnnotationReader()->addGlobalIgnoredName($annotation); 85 | } 86 | } 87 | 88 | /** 89 | * Remove the singleton instances. Useful in unit-testing. 90 | */ 91 | public static function tearDown(): void 92 | { 93 | static::$indexedReader = null; 94 | static::$annotationReader = null; 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Annotation/Description.php: -------------------------------------------------------------------------------- 1 | featureNames; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Annotation/Issues.php: -------------------------------------------------------------------------------- 1 | issueKeys; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Annotation/Parameter.php: -------------------------------------------------------------------------------- 1 | 15 | * @Required 16 | */ 17 | public $parameters; 18 | } 19 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Annotation/Severity.php: -------------------------------------------------------------------------------- 1 | stories; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Annotation/TestCaseId.php: -------------------------------------------------------------------------------- 1 | testCaseIds; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Annotation/TestType.php: -------------------------------------------------------------------------------- 1 | filePathOrContents = $filePathOrContents; 26 | $this->caption = $caption; 27 | $this->type = $type; 28 | } 29 | 30 | public function process(Entity $context) 31 | { 32 | if ($context instanceof Step && $this->filePathOrContents) { 33 | $newFileName = $this->getAttachmentFileName($this->filePathOrContents, $this->type); 34 | $attachment = new Attachment($this->caption, $newFileName, $this->type); 35 | $context->addAttachment($attachment); 36 | } 37 | } 38 | 39 | public function getAttachmentFileName($filePathOrContents, $type) 40 | { 41 | $filePath = $filePathOrContents; 42 | if (!@file_exists($filePath) || !@is_file($filePath)) { 43 | //Save contents to temporary file 44 | $filePath = tempnam(sys_get_temp_dir(), 'allure-attachment'); 45 | if (!file_put_contents($filePath, $filePathOrContents)) { 46 | throw new AllureException("Failed to save attachment contents to $filePath"); 47 | } 48 | } 49 | 50 | if (!isset($type)) { 51 | $type = $this->guessFileMimeType($filePath); 52 | $this->type = $type; 53 | } 54 | 55 | $fileExtension = $this->guessFileExtension($type); 56 | 57 | $fileSha1 = sha1_file($filePath); 58 | $outputPath = $this->getOutputPath($fileSha1, $fileExtension); 59 | if (!copy($filePath, $outputPath)) { 60 | throw new AllureException("Failed to copy attachment from $filePath to $outputPath."); 61 | } 62 | 63 | return $this->getOutputFileName($fileSha1, $fileExtension); 64 | } 65 | 66 | private function guessFileMimeType($filePath) 67 | { 68 | $type = MimeTypes::getDefault()->guessMimeType($filePath); 69 | if (!isset($type)) { 70 | return DEFAULT_MIME_TYPE; 71 | } 72 | 73 | return $type; 74 | } 75 | 76 | private function guessFileExtension($mimeType) 77 | { 78 | $candidate = current(MimeTypes::getDefault()->getExtensions($mimeType)); 79 | if (!isset($candidate)) { 80 | return DEFAULT_FILE_EXTENSION; 81 | } 82 | 83 | return $candidate; 84 | } 85 | 86 | public function getOutputFileName($sha1, $extension) 87 | { 88 | return $sha1 . '-attachment.' . $extension; 89 | } 90 | 91 | public function getOutputPath($sha1, $extension) 92 | { 93 | return Provider::getOutputDirectory() . \DIRECTORY_SEPARATOR . $this->getOutputFileName($sha1, $extension); 94 | } 95 | 96 | /** 97 | * @return mixed 98 | */ 99 | public function getCaption() 100 | { 101 | return $this->caption; 102 | } 103 | 104 | /** 105 | * @return mixed 106 | */ 107 | public function getFilePathOrContents() 108 | { 109 | return $this->filePathOrContents; 110 | } 111 | 112 | /** 113 | * @return mixed 114 | */ 115 | public function getType() 116 | { 117 | return $this->type; 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Event/AddParameterEvent.php: -------------------------------------------------------------------------------- 1 | name = $name; 19 | $this->value = $value; 20 | $this->kind = $kind; 21 | } 22 | 23 | public function process(Entity $context) 24 | { 25 | if ($context instanceof TestCase) { 26 | $context->addParameter(new Parameter($this->name, $this->value, $this->kind)); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Event/ClearStepStorageEvent.php: -------------------------------------------------------------------------------- 1 | pattern = $pattern; 16 | } 17 | 18 | public function process(Entity $context) 19 | { 20 | if ($context instanceof Step) { 21 | foreach ($context->getAttachments() as $index => $attachment) { 22 | if ($attachment instanceof Attachment) { 23 | $path = $attachment->getSource(); 24 | if (preg_match($this->pattern, $path)) { 25 | if (file_exists($path) && is_writable($path)) { 26 | unlink($path); 27 | } 28 | $context->removeAttachment($index); 29 | } 30 | } 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Event/StepCanceledEvent.php: -------------------------------------------------------------------------------- 1 | setStatus(Status::CANCELED); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Event/StepEvent.php: -------------------------------------------------------------------------------- 1 | setStatus(Status::FAILED); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Event/StepFinishedEvent.php: -------------------------------------------------------------------------------- 1 | setStop(self::getTimestamp()); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Event/StepStartedEvent.php: -------------------------------------------------------------------------------- 1 | name = $name; 21 | } 22 | 23 | public function process(Entity $context) 24 | { 25 | if ($context instanceof Step) { 26 | $context->setName($this->name); 27 | $context->setStatus(Status::PASSED); 28 | $context->setStart(self::getTimestamp()); 29 | $context->setTitle($this->title); 30 | } 31 | } 32 | 33 | public function withTitle($title) 34 | { 35 | $this->title = $title; 36 | 37 | return $this; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Event/Storage/StepStorage.php: -------------------------------------------------------------------------------- 1 | storage = new SplStack(); 24 | } 25 | 26 | /** 27 | * @return Step 28 | */ 29 | public function getLast() 30 | { 31 | if ($this->storage->isEmpty()) { 32 | $this->put($this->getRootStep()); 33 | } 34 | 35 | return $this->storage->top(); 36 | } 37 | 38 | /** 39 | * @return Step 40 | */ 41 | public function pollLast() 42 | { 43 | $step = $this->storage->pop(); 44 | if ($this->storage->isEmpty()) { 45 | $this->storage->push($this->getRootStep()); 46 | } 47 | 48 | return $step; 49 | } 50 | 51 | /** 52 | * @param Step $step 53 | */ 54 | public function put(Step $step) 55 | { 56 | $this->storage->push($step); 57 | } 58 | 59 | public function clear() 60 | { 61 | $this->storage = new SplStack(); 62 | $this->put($this->getRootStep()); 63 | } 64 | 65 | public function isEmpty() 66 | { 67 | return ($this->size() === 0) && $this->isRootStep($this->getLast()); 68 | } 69 | 70 | public function size() 71 | { 72 | return $this->storage->count() - 1; 73 | } 74 | 75 | public function isRootStep(Step $step) 76 | { 77 | return $step->getName() === self::ROOT_STEP_NAME; 78 | } 79 | 80 | /** 81 | * @return Step 82 | */ 83 | protected function getRootStep() 84 | { 85 | $step = new Step(); 86 | $step->setName(self::ROOT_STEP_NAME); 87 | $step->setTitle( 88 | "If you're seeing this then there's an error in step processing. " 89 | . 'Please send feedback to allure@yandex-team.ru. Thank you.' 90 | ); 91 | $step->setStart(self::getTimestamp()); 92 | $step->setStatus(Status::BROKEN); 93 | 94 | return $step; 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Event/Storage/TestCaseStorage.php: -------------------------------------------------------------------------------- 1 | case)) { 20 | $this->case = new TestCase(); 21 | } 22 | 23 | return $this->case; 24 | } 25 | 26 | /** 27 | * @param TestCase $case 28 | */ 29 | public function put(TestCase $case) 30 | { 31 | $this->case = $case; 32 | } 33 | 34 | public function clear() 35 | { 36 | unset($this->case); 37 | } 38 | 39 | public function isEmpty() 40 | { 41 | return !isset($this->case); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Event/Storage/TestSuiteStorage.php: -------------------------------------------------------------------------------- 1 | clear(); 17 | } 18 | 19 | /** 20 | * @param string $uuid 21 | * 22 | * @return TestSuite 23 | */ 24 | public function get($uuid) 25 | { 26 | if (!array_key_exists($uuid, $this->storage)) { 27 | $this->storage[$uuid] = new TestSuite(); 28 | } 29 | 30 | return $this->storage[$uuid]; 31 | } 32 | 33 | public function remove($uuid) 34 | { 35 | if (array_key_exists($uuid, $this->storage)) { 36 | unset($this->storage[$uuid]); 37 | } 38 | } 39 | 40 | public function clear() 41 | { 42 | $this->storage = []; 43 | } 44 | 45 | public function isEmpty() 46 | { 47 | return $this->size() === 0; 48 | } 49 | 50 | public function size() 51 | { 52 | return count($this->storage); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Event/TestCaseBrokenEvent.php: -------------------------------------------------------------------------------- 1 | setStop(self::getTimestamp()); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Event/TestCasePendingEvent.php: -------------------------------------------------------------------------------- 1 | suiteUuid = $suiteUuid; 48 | $this->name = $name; 49 | $this->labels = []; 50 | $this->parameters = []; 51 | } 52 | 53 | public function process(Entity $context) 54 | { 55 | if ($context instanceof TestCase) { 56 | $context->setName($this->getName()); 57 | $context->setStatus(Status::PASSED); 58 | $context->setStart(self::getTimestamp()); 59 | $context->setTitle($this->getTitle()); 60 | $description = $this->getDescription(); 61 | if (isset($description)) { 62 | $context->setDescription($description); 63 | } 64 | foreach ($this->getLabels() as $label) { 65 | $context->addLabel($label); 66 | } 67 | foreach ($this->getParameters() as $parameter) { 68 | $context->addParameter($parameter); 69 | } 70 | } 71 | } 72 | 73 | /** 74 | * @param string $title 75 | * 76 | * @return $this 77 | */ 78 | public function withTitle($title) 79 | { 80 | $this->setTitle($title); 81 | 82 | return $this; 83 | } 84 | 85 | /** 86 | * @param Description $description 87 | * 88 | * @return $this 89 | */ 90 | public function withDescription(Description $description) 91 | { 92 | $this->setDescription($description); 93 | 94 | return $this; 95 | } 96 | 97 | /** 98 | * @param array $labels 99 | * 100 | * @return $this 101 | */ 102 | public function withLabels(array $labels) 103 | { 104 | $this->setLabels($labels); 105 | 106 | return $this; 107 | } 108 | 109 | /** 110 | * @param array $parameters 111 | * 112 | * @return $this 113 | */ 114 | public function withParameters(array $parameters) 115 | { 116 | $this->setParameters($parameters); 117 | 118 | return $this; 119 | } 120 | 121 | /** 122 | * @return string 123 | */ 124 | public function getSuiteUuid() 125 | { 126 | return $this->suiteUuid; 127 | } 128 | 129 | /** 130 | * @param \Yandex\Allure\Adapter\Model\Description $description 131 | */ 132 | public function setDescription($description) 133 | { 134 | $this->description = $description; 135 | } 136 | 137 | /** 138 | * @param array $labels 139 | */ 140 | public function setLabels(array $labels) 141 | { 142 | $this->labels = $labels; 143 | } 144 | 145 | /** 146 | * @param string $title 147 | */ 148 | public function setTitle($title) 149 | { 150 | $this->title = $title; 151 | } 152 | 153 | /** 154 | * @param array $parameters 155 | */ 156 | public function setParameters($parameters) 157 | { 158 | $this->parameters = $parameters; 159 | } 160 | 161 | /** 162 | * @return \Yandex\Allure\Adapter\Model\Description 163 | */ 164 | public function getDescription() 165 | { 166 | return $this->description; 167 | } 168 | 169 | /** 170 | * @return array 171 | */ 172 | public function getLabels() 173 | { 174 | return $this->labels; 175 | } 176 | 177 | /** 178 | * @return array 179 | */ 180 | public function getParameters() 181 | { 182 | return $this->parameters; 183 | } 184 | 185 | /** 186 | * @return string 187 | */ 188 | public function getTitle() 189 | { 190 | return $this->title; 191 | } 192 | 193 | /** 194 | * @return string 195 | */ 196 | public function getName() 197 | { 198 | return $this->name; 199 | } 200 | } 201 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Event/TestCaseStatusChangedEvent.php: -------------------------------------------------------------------------------- 1 | setStatus($this->getStatus()); 30 | $exception = $this->exception; 31 | if (isset($exception)) { 32 | $failure = new Failure($this->message); 33 | $failure->setStackTrace($exception->getTraceAsString()); 34 | $context->setFailure($failure); 35 | } 36 | } 37 | } 38 | 39 | /** 40 | * @param string $message 41 | * 42 | * @return $this 43 | */ 44 | public function withMessage($message) 45 | { 46 | $this->message = $message; 47 | 48 | return $this; 49 | } 50 | 51 | /** 52 | * @param \Exception $exception 53 | * 54 | * @return $this 55 | */ 56 | public function withException($exception) 57 | { 58 | $this->exception = $exception; 59 | 60 | return $this; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Event/TestSuiteEvent.php: -------------------------------------------------------------------------------- 1 | uuid = $uuid; 21 | } 22 | 23 | public function process(Entity $context) 24 | { 25 | if ($context instanceof TestSuite) { 26 | $context->setStop(self::getTimestamp()); 27 | } 28 | } 29 | 30 | public function getUuid() 31 | { 32 | return $this->uuid; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Event/TestSuiteStartedEvent.php: -------------------------------------------------------------------------------- 1 | name = $name; 42 | $this->labels = []; 43 | } 44 | 45 | public function process(Entity $context) 46 | { 47 | if ($context instanceof TestSuite) { 48 | $context->setName($this->getName()); 49 | $context->setStart(self::getTimestamp()); 50 | $context->setTitle($this->getTitle()); 51 | $description = $this->getDescription(); 52 | if (isset($description)) { 53 | $context->setDescription($this->getDescription()); 54 | } 55 | foreach ($this->getLabels() as $label) { 56 | $context->addLabel($label); 57 | } 58 | } 59 | } 60 | 61 | /** 62 | * @param string $title 63 | * 64 | * @return $this 65 | */ 66 | public function withTitle($title) 67 | { 68 | $this->setTitle($title); 69 | 70 | return $this; 71 | } 72 | 73 | /** 74 | * @param Description $description 75 | * 76 | * @return $this 77 | */ 78 | public function withDescription(Description $description) 79 | { 80 | $this->setDescription($description); 81 | 82 | return $this; 83 | } 84 | 85 | /** 86 | * @param array $labels 87 | * 88 | * @return $this 89 | */ 90 | public function withLabels(array $labels) 91 | { 92 | $this->setLabels($labels); 93 | 94 | return $this; 95 | } 96 | 97 | /** 98 | * @param \Yandex\Allure\Adapter\Model\Description $description 99 | */ 100 | public function setDescription($description) 101 | { 102 | $this->description = $description; 103 | } 104 | 105 | /** 106 | * @param array $labels 107 | */ 108 | public function setLabels($labels) 109 | { 110 | $this->labels = $labels; 111 | } 112 | 113 | /** 114 | * @param string $name 115 | */ 116 | public function setName($name) 117 | { 118 | $this->name = $name; 119 | } 120 | 121 | /** 122 | * @param string $title 123 | */ 124 | public function setTitle($title) 125 | { 126 | $this->title = $title; 127 | } 128 | 129 | /** 130 | * @return \Yandex\Allure\Adapter\Model\Description 131 | */ 132 | public function getDescription() 133 | { 134 | return $this->description; 135 | } 136 | 137 | /** 138 | * @return array 139 | */ 140 | public function getLabels() 141 | { 142 | return $this->labels; 143 | } 144 | 145 | /** 146 | * @return string 147 | */ 148 | public function getName() 149 | { 150 | return $this->name; 151 | } 152 | 153 | /** 154 | * @return string 155 | */ 156 | public function getTitle() 157 | { 158 | return $this->title; 159 | } 160 | 161 | public function getUuid() 162 | { 163 | if (!isset($this->uuid)) { 164 | $this->uuid = self::generateUUID(); 165 | } 166 | 167 | return $this->uuid; 168 | } 169 | } 170 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Model/Attachment.php: -------------------------------------------------------------------------------- 1 | source = $source; 34 | $this->title = $title; 35 | $this->type = $type; 36 | } 37 | 38 | /** 39 | * @return string 40 | */ 41 | public function getSource() 42 | { 43 | return $this->source; 44 | } 45 | 46 | /** 47 | * @return string 48 | */ 49 | public function getTitle() 50 | { 51 | return $this->title; 52 | } 53 | 54 | /** 55 | * @return string 56 | */ 57 | public function getType() 58 | { 59 | return $this->type; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Model/ConstantChecker.php: -------------------------------------------------------------------------------- 1 | getConstants() as $constantValue) { 24 | if ($constantValue === $value) { 25 | return $value; 26 | } 27 | } 28 | throw new AllureException( 29 | "Value \"$value\" is not present in class $className. You should use a constant from this class." 30 | ); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Model/Description.php: -------------------------------------------------------------------------------- 1 | type = ConstantChecker::validate('Yandex\Allure\Adapter\Model\DescriptionType', $type); 30 | $this->value = $value; 31 | } 32 | 33 | /** 34 | * @return string 35 | */ 36 | public function getType() 37 | { 38 | return $this->type; 39 | } 40 | 41 | /** 42 | * @return string 43 | */ 44 | public function getValue() 45 | { 46 | return $this->value; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Model/DescriptionType.php: -------------------------------------------------------------------------------- 1 | message = $message; 29 | } 30 | 31 | /** 32 | * @return string 33 | */ 34 | public function getMessage() 35 | { 36 | return $this->message; 37 | } 38 | 39 | /** 40 | * @return string 41 | */ 42 | public function getStackTrace() 43 | { 44 | return $this->stackTrace; 45 | } 46 | 47 | /** 48 | * @param string $stackTrace 49 | */ 50 | public function setStackTrace($stackTrace) 51 | { 52 | $this->stackTrace = $stackTrace; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Model/Label.php: -------------------------------------------------------------------------------- 1 | name = $name; 31 | $this->value = $value; 32 | } 33 | 34 | /** 35 | * @return string 36 | */ 37 | public function getName() 38 | { 39 | return $this->name; 40 | } 41 | 42 | /** 43 | * @return string 44 | */ 45 | public function getValue() 46 | { 47 | return $this->value; 48 | } 49 | 50 | /** 51 | * @param $featureName 52 | * 53 | * @return Label 54 | */ 55 | public static function feature($featureName) 56 | { 57 | return new Label(LabelType::FEATURE, $featureName); 58 | } 59 | 60 | /** 61 | * @param $storyName 62 | * 63 | * @return Label 64 | */ 65 | public static function story($storyName) 66 | { 67 | return new Label(LabelType::STORY, $storyName); 68 | } 69 | 70 | /** 71 | * @param $severityLevel 72 | * 73 | * @return Label 74 | */ 75 | public static function severity($severityLevel) 76 | { 77 | return new Label(LabelType::SEVERITY, $severityLevel); 78 | } 79 | 80 | /** 81 | * @param $testType 82 | * 83 | * @return Label 84 | */ 85 | public static function testType($testType) 86 | { 87 | return new Label(LabelType::TEST_TYPE, $testType); 88 | } 89 | 90 | /** 91 | * @param $issueKey 92 | * 93 | * @return Label 94 | */ 95 | public static function issue($issueKey) 96 | { 97 | return new Label(LabelType::ISSUE, $issueKey); 98 | } 99 | 100 | /** 101 | * @param $testCaseId 102 | * 103 | * @return Label 104 | */ 105 | public static function testId($testCaseId) 106 | { 107 | return new Label(LabelType::TEST_ID, $testCaseId); 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Model/LabelType.php: -------------------------------------------------------------------------------- 1 | kind = ConstantChecker::validate('Yandex\Allure\Adapter\Model\ParameterKind', $kind); 34 | $this->name = $name; 35 | $this->value = $value; 36 | } 37 | 38 | /** 39 | * @return string 40 | */ 41 | public function getKind() 42 | { 43 | return $this->kind; 44 | } 45 | 46 | /** 47 | * @return string 48 | */ 49 | public function getName() 50 | { 51 | return $this->name; 52 | } 53 | 54 | /** 55 | * @return string 56 | */ 57 | public function getValue() 58 | { 59 | return $this->value; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Model/ParameterKind.php: -------------------------------------------------------------------------------- 1 | ") 43 | * @XmlList(entry = "step") 44 | */ 45 | private $steps; 46 | 47 | /** 48 | * @var array 49 | * @Type("array") 50 | * @XmlList(entry = "attachment") 51 | */ 52 | private $attachments; 53 | 54 | /** 55 | * @var Status 56 | * @Type("string") 57 | * @XmlAttribute 58 | */ 59 | private $status; 60 | 61 | public function __construct() 62 | { 63 | $this->steps = []; 64 | $this->attachments = []; 65 | } 66 | 67 | /** 68 | * @param string $name 69 | */ 70 | public function setName($name) 71 | { 72 | $this->name = $name; 73 | } 74 | 75 | /** 76 | * @param int $start 77 | */ 78 | public function setStart($start) 79 | { 80 | $this->start = $start; 81 | } 82 | 83 | /** 84 | * @param int $stop 85 | */ 86 | public function setStop($stop) 87 | { 88 | $this->stop = $stop; 89 | } 90 | 91 | /** 92 | * @param string $status 93 | */ 94 | public function setStatus($status) 95 | { 96 | $this->status = ConstantChecker::validate('Yandex\Allure\Adapter\Model\Status', $status); 97 | } 98 | 99 | /** 100 | * @return array 101 | */ 102 | public function getAttachments() 103 | { 104 | return $this->attachments; 105 | } 106 | 107 | /** 108 | * @return string 109 | */ 110 | public function getName() 111 | { 112 | return $this->name; 113 | } 114 | 115 | /** 116 | * @return int 117 | */ 118 | public function getStart() 119 | { 120 | return $this->start; 121 | } 122 | 123 | /** 124 | * @return array 125 | */ 126 | public function getSteps() 127 | { 128 | return $this->steps; 129 | } 130 | 131 | /** 132 | * @return int 133 | */ 134 | public function getStop() 135 | { 136 | return $this->stop; 137 | } 138 | 139 | /** 140 | * @return string 141 | */ 142 | public function getTitle() 143 | { 144 | return $this->title; 145 | } 146 | 147 | /** 148 | * @return string 149 | */ 150 | public function getStatus() 151 | { 152 | return $this->status; 153 | } 154 | 155 | /** 156 | * @param string $title 157 | */ 158 | public function setTitle($title) 159 | { 160 | $this->title = $title; 161 | } 162 | 163 | /** 164 | * @param \Yandex\Allure\Adapter\Model\Step $step 165 | */ 166 | public function addStep(Step $step) 167 | { 168 | $this->steps[] = $step; 169 | } 170 | 171 | /** 172 | * @param \Yandex\Allure\Adapter\Model\Attachment $attachment 173 | */ 174 | public function addAttachment(Attachment $attachment) 175 | { 176 | $this->attachments[] = $attachment; 177 | } 178 | 179 | /** 180 | * @param $index 181 | */ 182 | public function removeAttachment($index) 183 | { 184 | if (isset($this->attachments[$index])) { 185 | unset($this->attachments[$index]); 186 | } 187 | } 188 | } 189 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Model/TestCase.php: -------------------------------------------------------------------------------- 1 | ") 66 | * @XmlList(entry = "step") 67 | */ 68 | private $steps; 69 | 70 | /** 71 | * @var array 72 | * @Type("array") 73 | * @XmlList(entry = "attachment") 74 | */ 75 | private $attachments; 76 | 77 | /** 78 | * @Type("array") 79 | * @XmlList(entry = "label") 80 | */ 81 | private $labels; 82 | 83 | /** 84 | * @var array 85 | * @Type("array") 86 | * @XmlList(entry = "parameter") 87 | */ 88 | private $parameters; 89 | 90 | public function __construct() 91 | { 92 | $this->steps = []; 93 | $this->labels = []; 94 | $this->attachments = []; 95 | $this->parameters = []; 96 | } 97 | 98 | /** 99 | * @return array 100 | */ 101 | public function getAttachments() 102 | { 103 | return $this->attachments; 104 | } 105 | 106 | /** 107 | * @return array 108 | */ 109 | public function getLabels() 110 | { 111 | return $this->labels; 112 | } 113 | 114 | /** 115 | * @return string 116 | */ 117 | public function getName() 118 | { 119 | return $this->name; 120 | } 121 | 122 | /** 123 | * @return array 124 | */ 125 | public function getSteps() 126 | { 127 | return $this->steps; 128 | } 129 | 130 | /** 131 | * @return string 132 | */ 133 | public function getTitle() 134 | { 135 | return $this->title; 136 | } 137 | 138 | /** 139 | * @return int 140 | */ 141 | public function getStart() 142 | { 143 | return $this->start; 144 | } 145 | 146 | /** 147 | * @return int 148 | */ 149 | public function getStop() 150 | { 151 | return $this->stop; 152 | } 153 | 154 | /** 155 | * @return string 156 | */ 157 | public function getStatus() 158 | { 159 | return $this->status; 160 | } 161 | 162 | /** 163 | * @return \Yandex\Allure\Adapter\Model\Description 164 | */ 165 | public function getDescription() 166 | { 167 | return $this->description; 168 | } 169 | 170 | /** 171 | * @return \Yandex\Allure\Adapter\Model\Failure 172 | */ 173 | public function getFailure() 174 | { 175 | return $this->failure; 176 | } 177 | 178 | /** 179 | * @return array 180 | */ 181 | public function getParameters() 182 | { 183 | return $this->parameters; 184 | } 185 | 186 | /** 187 | * @param string $name 188 | */ 189 | public function setName($name) 190 | { 191 | $this->name = $name; 192 | } 193 | 194 | /** 195 | * @param int $start 196 | */ 197 | public function setStart($start) 198 | { 199 | $this->start = $start; 200 | } 201 | 202 | /** 203 | * @param int $stop 204 | */ 205 | public function setStop($stop) 206 | { 207 | $this->stop = $stop; 208 | } 209 | 210 | /** 211 | * @param string $status 212 | */ 213 | public function setStatus($status) 214 | { 215 | $this->status = ConstantChecker::validate('Yandex\Allure\Adapter\Model\Status', $status); 216 | } 217 | 218 | /** 219 | * @param \Yandex\Allure\Adapter\Model\Description $description 220 | */ 221 | public function setDescription($description) 222 | { 223 | $this->description = $description; 224 | } 225 | 226 | /** 227 | * @param \Yandex\Allure\Adapter\Model\Failure $failure 228 | */ 229 | public function setFailure($failure) 230 | { 231 | $this->failure = $failure; 232 | } 233 | 234 | /** 235 | * @param string $title 236 | */ 237 | public function setTitle($title) 238 | { 239 | $this->title = $title; 240 | } 241 | 242 | /** 243 | * @param \Yandex\Allure\Adapter\Model\Label $label 244 | */ 245 | public function addLabel(Label $label) 246 | { 247 | $this->labels[] = $label; 248 | } 249 | 250 | /** 251 | * @param \Yandex\Allure\Adapter\Model\Step $step 252 | */ 253 | public function addStep(Step $step) 254 | { 255 | $this->steps[] = $step; 256 | } 257 | 258 | /** 259 | * @param \Yandex\Allure\Adapter\Model\Attachment $attachment 260 | */ 261 | public function addAttachment(Attachment $attachment) 262 | { 263 | $this->attachments[] = $attachment; 264 | } 265 | 266 | /** 267 | * @param \Yandex\Allure\Adapter\Model\Parameter $parameter 268 | */ 269 | public function addParameter(Parameter $parameter) 270 | { 271 | $this->parameters[] = $parameter; 272 | } 273 | } 274 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Model/TestSuite.php: -------------------------------------------------------------------------------- 1 | ") 70 | * @XmlList(entry = "test-case") 71 | * @SerializedName("test-cases") 72 | */ 73 | private $testCases; 74 | 75 | /** 76 | * @var array 77 | * @Type("array") 78 | * @XmlList(entry = "label") 79 | */ 80 | private $labels; 81 | 82 | /** 83 | * @var Serializer 84 | * @Exclude 85 | */ 86 | private $serializer; 87 | 88 | /** 89 | * @var TestCase 90 | * @Type("Yandex\Allure\Adapter\Model\TestCase") 91 | * @Exclude 92 | */ 93 | private $currentTestCase; 94 | 95 | public function __construct() 96 | { 97 | $this->testCases = []; 98 | $this->labels = []; 99 | $this->version = self::DEFAULT_VERSION; 100 | } 101 | 102 | /** 103 | * @return Description 104 | */ 105 | public function getDescription() 106 | { 107 | return $this->description; 108 | } 109 | 110 | /** 111 | * @return array 112 | */ 113 | public function getLabels() 114 | { 115 | return $this->labels; 116 | } 117 | 118 | /** 119 | * @return string 120 | */ 121 | public function getName() 122 | { 123 | return $this->name; 124 | } 125 | 126 | /** 127 | * @return int 128 | */ 129 | public function getStart() 130 | { 131 | return $this->start; 132 | } 133 | 134 | /** 135 | * @return int 136 | */ 137 | public function getStop() 138 | { 139 | return $this->stop; 140 | } 141 | 142 | /** 143 | * @return string 144 | */ 145 | public function getVersion() 146 | { 147 | return $this->version; 148 | } 149 | 150 | /** 151 | * @return int 152 | */ 153 | public function getTitle() 154 | { 155 | return $this->title; 156 | } 157 | 158 | /** 159 | * @param int $start 160 | */ 161 | public function setStart($start) 162 | { 163 | $this->start = $start; 164 | } 165 | 166 | /** 167 | * @param string $name 168 | */ 169 | public function setName($name) 170 | { 171 | $this->name = $name; 172 | } 173 | 174 | /** 175 | * @param string $title 176 | */ 177 | public function setTitle($title) 178 | { 179 | $this->title = $title; 180 | } 181 | 182 | /** 183 | * @param int $stop 184 | */ 185 | public function setStop($stop) 186 | { 187 | $this->stop = $stop; 188 | } 189 | 190 | /** 191 | * @param string $version 192 | */ 193 | public function setVersion($version) 194 | { 195 | $this->version = $version; 196 | } 197 | 198 | /** 199 | * @param \Yandex\Allure\Adapter\Model\Description $description 200 | */ 201 | public function setDescription(Description $description) 202 | { 203 | $this->description = $description; 204 | } 205 | 206 | /** 207 | * @param \Yandex\Allure\Adapter\Model\TestCase $testCase 208 | */ 209 | public function addTestCase(TestCase $testCase) 210 | { 211 | $this->testCases[$testCase->getName()] = $testCase; 212 | } 213 | 214 | /** 215 | * Returns test case by name. 216 | * 217 | * @param string $name 218 | * 219 | * @return \Yandex\Allure\Adapter\Model\TestCase 220 | */ 221 | public function getTestCase($name) 222 | { 223 | return $this->testCases[$name]; 224 | } 225 | 226 | /** 227 | * Return total count of child elements (test cases or test suites). 228 | * 229 | * @return int 230 | */ 231 | public function size() 232 | { 233 | return count($this->testCases); 234 | } 235 | 236 | /** 237 | * @param \Yandex\Allure\Adapter\Model\Label $label 238 | */ 239 | public function addLabel(Label $label) 240 | { 241 | $this->labels[] = $label; 242 | } 243 | 244 | /** 245 | * @return string 246 | */ 247 | public function serialize() 248 | { 249 | return $this->getSerializer()->serialize($this, 'xml'); 250 | } 251 | 252 | /** 253 | * @param string $serialized 254 | * 255 | * @return mixed 256 | */ 257 | public function unserialize($serialized) 258 | { 259 | return $this->getSerializer()->deserialize($serialized, 'Yandex\Allure\Adapter\Model\TestSuite', 'xml'); 260 | } 261 | 262 | /** 263 | * @return Serializer 264 | */ 265 | private function getSerializer() 266 | { 267 | if (!isset($this->serializer)) { 268 | $this->serializer = SerializerBuilder::create()->build(); 269 | } 270 | 271 | return $this->serializer; 272 | } 273 | } 274 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Support/AttachmentSupport.php: -------------------------------------------------------------------------------- 1 | fire(new AddAttachmentEvent($filePathOrContents, $caption, $type)); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Support/StepSupport.php: -------------------------------------------------------------------------------- 1 | withTitle($title); 43 | } else { 44 | $event->withTitle($name); 45 | } 46 | Allure::lifecycle()->fire($event); 47 | try { 48 | $logicResult = $logic(); 49 | Allure::lifecycle()->fire(new StepFinishedEvent()); 50 | } catch (Exception $e) { 51 | $stepFailedEvent = new StepFailedEvent(); 52 | Allure::lifecycle()->fire($stepFailedEvent); 53 | Allure::lifecycle()->fire(new StepFinishedEvent()); 54 | throw $e; 55 | } 56 | } else { 57 | throw new AllureException("Step name shouldn't be null and logic should be a callable."); 58 | } 59 | 60 | return $logicResult; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/Yandex/Allure/Adapter/Support/Utils.php: -------------------------------------------------------------------------------- 1 | toString(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test/Yandex/Allure/Adapter/AllureTest.php: -------------------------------------------------------------------------------- 1 | getStepStorage()->clear(); 35 | Allure::lifecycle()->getStepStorage()->put(new Step()); 36 | Allure::lifecycle()->fire(new ClearStepStorageEvent()); 37 | $this->assertTrue(Allure::lifecycle()->getStepStorage()->isEmpty()); 38 | } 39 | 40 | public function testTestCaseStorageClear() 41 | { 42 | Allure::lifecycle()->getTestCaseStorage()->clear(); 43 | Allure::lifecycle()->getTestCaseStorage()->put(new TestCase()); 44 | Allure::lifecycle()->fire(new ClearTestCaseStorageEvent()); 45 | $this->assertTrue(Allure::lifecycle()->getTestCaseStorage()->isEmpty()); 46 | } 47 | 48 | public function testStepStartedEvent() 49 | { 50 | Allure::lifecycle()->getStepStorage()->clear(); 51 | $this->assertTrue(Allure::lifecycle()->getStepStorage()->isEmpty()); 52 | Allure::lifecycle()->fire(new StepStartedEvent(self::STEP_NAME)); 53 | $this->assertEquals(1, Allure::lifecycle()->getStepStorage()->size()); 54 | $step = Allure::lifecycle()->getStepStorage()->getLast(); 55 | $this->assertEquals(self::STEP_NAME, $step->getName()); 56 | } 57 | 58 | public function testStepFinishedEvent() 59 | { 60 | $step = new Step(); 61 | $step->setName(self::STEP_NAME); 62 | Allure::lifecycle()->getStepStorage()->put($step); 63 | Allure::lifecycle()->fire(new StepFinishedEvent()); 64 | $step = Allure::lifecycle()->getStepStorage()->getLast(); 65 | $this->assertEquals(self::STEP_NAME, $step->getName()); 66 | } 67 | 68 | public function testGenericStepEvent() 69 | { 70 | $step = new Step(); 71 | Allure::lifecycle()->getStepStorage()->clear(); 72 | Allure::lifecycle()->getStepStorage()->put($step); 73 | Allure::lifecycle()->fire(new GenericStepEvent(self::STEP_NAME)); 74 | $this->assertEquals(self::STEP_NAME, $step->getName()); 75 | } 76 | 77 | public function testTestCaseStarted() 78 | { 79 | Allure::lifecycle()->getTestCaseStorage()->clear(); 80 | Allure::lifecycle()->getTestSuiteStorage()->clear(); 81 | $this->assertTrue(Allure::lifecycle()->getTestCaseStorage()->isEmpty()); 82 | Allure::lifecycle()->fire(new TestCaseStartedEvent(self::TEST_SUITE_UUID, self::TEST_CASE_NAME)); 83 | $testCase = Allure::lifecycle() 84 | ->getTestSuiteStorage() 85 | ->get(self::TEST_SUITE_UUID) 86 | ->getTestCase(self::TEST_CASE_NAME); 87 | $this->assertNotEmpty($testCase); 88 | $this->assertEquals(self::TEST_CASE_NAME, $testCase->getName()); 89 | } 90 | 91 | public function testTestCaseFinishedEvent() 92 | { 93 | Allure::lifecycle()->getStepStorage()->clear(); 94 | Allure::lifecycle()->getStepStorage()->getLast(); //To initialize root step 95 | Allure::lifecycle()->getTestCaseStorage()->clear(); 96 | $step = new Step(); 97 | $step->setName(self::STEP_NAME); 98 | $attachment = new Attachment( 99 | self::STEP_ATTACHMENT_TITLE, 100 | self::STEP_ATTACHMENT_SOURCE, 101 | self::STEP_ATTACHMENT_TYPE 102 | ); 103 | Allure::lifecycle()->getStepStorage()->getLast()->addStep($step); 104 | Allure::lifecycle()->getStepStorage()->getLast()->addAttachment($attachment); 105 | 106 | $testCaseFromStorage = Allure::lifecycle()->getTestCaseStorage()->get(); 107 | 108 | Allure::lifecycle()->fire(new TestCaseFinishedEvent()); 109 | 110 | //Checking that attachments were moved 111 | $attachments = $testCaseFromStorage->getAttachments(); 112 | $this->assertEquals(1, sizeof($attachments)); 113 | $attachment = array_pop($attachments); 114 | $this->assertTrue( 115 | ($attachment instanceof Attachment) && 116 | ($attachment->getTitle() === self::STEP_ATTACHMENT_TITLE) && 117 | ($attachment->getSource() === self::STEP_ATTACHMENT_SOURCE) && 118 | ($attachment->getType() === self::STEP_ATTACHMENT_TYPE) 119 | ); 120 | 121 | //Checking that steps were moved 122 | $steps = $testCaseFromStorage->getSteps(); 123 | $this->assertEquals(1, sizeof($steps)); 124 | $stepFromStorage = array_pop($steps); 125 | $this->assertTrue( 126 | ($stepFromStorage instanceof Step) && 127 | ($stepFromStorage->getName() === self::STEP_NAME) 128 | ); 129 | $this->assertTrue(Allure::lifecycle()->getTestCaseStorage()->isEmpty()); 130 | } 131 | 132 | public function testGenericTestCaseEvent() 133 | { 134 | $testCase = new TestCase(); 135 | Allure::lifecycle()->getTestCaseStorage()->clear(); 136 | Allure::lifecycle()->getTestCaseStorage()->put($testCase); 137 | Allure::lifecycle()->fire(new GenericTestCaseEvent(self::TEST_CASE_NAME)); 138 | $this->assertEquals(self::TEST_CASE_NAME, $testCase->getName()); 139 | } 140 | 141 | public function testGenericTestSuiteEvent() 142 | { 143 | Allure::lifecycle()->getTestSuiteStorage()->clear(); 144 | $event = new GenericTestSuiteEvent(self::TEST_SUITE_NAME); 145 | $testSuite = Allure::lifecycle()->getTestSuiteStorage()->get($event->getUuid()); 146 | Allure::lifecycle()->fire($event); 147 | $this->assertEquals(self::TEST_SUITE_NAME, $testSuite->getName()); 148 | } 149 | 150 | public function testTestSuiteFinishedEvent() 151 | { 152 | Allure::lifecycle()->getTestSuiteStorage()->clear(); 153 | $testSuite = Allure::lifecycle()->getTestSuiteStorage()->get(self::TEST_SUITE_UUID); 154 | $testSuite->addTestCase(new TestCase()); 155 | 156 | $this->assertEquals(1, Allure::lifecycle()->getTestSuiteStorage()->size()); 157 | 158 | $outputDirectory = sys_get_temp_dir(); 159 | AnnotationRegistry::registerAutoloadNamespace( 160 | 'JMS\Serializer\Annotation', 161 | __DIR__ . "/../../../../vendor/jms/serializer/src" 162 | ); 163 | 164 | Provider::setOutputDirectory($outputDirectory); 165 | $xmlFilePath = $outputDirectory . DIRECTORY_SEPARATOR . self::TEST_SUITE_UUID . '-testsuite.xml'; 166 | 167 | Allure::lifecycle()->fire(new TestSuiteFinishedEvent(self::TEST_SUITE_UUID)); 168 | $this->assertTrue(Allure::lifecycle()->getTestSuiteStorage()->isEmpty()); 169 | $this->assertTrue(file_exists($xmlFilePath)); 170 | } 171 | } 172 | -------------------------------------------------------------------------------- /test/Yandex/Allure/Adapter/Annotation/AnnotationManagerTest.php: -------------------------------------------------------------------------------- 1 | updateTestSuiteEvent($event); 23 | 24 | $this->assertEquals('test-suite-title', $event->getTitle()); 25 | $this->assertEquals('test-suite-description', $event->getDescription()->getValue()); 26 | $this->assertEquals(DescriptionType::MARKDOWN, $event->getDescription()->getType()); 27 | $this->assertEquals(6, sizeof($event->getLabels())); 28 | 29 | //Check features presence 30 | $features = $this->getLabelsByType($event->getLabels(), LabelType::FEATURE); 31 | $this->assertEquals(2, sizeof($features)); 32 | $index = 1; 33 | foreach ($features as $feature) { 34 | $this->assertInstanceOf('Yandex\Allure\Adapter\Model\Label', $feature); 35 | $this->assertEquals("test-suite-feature$index", $feature->getValue()); 36 | $index++; 37 | } 38 | 39 | //Check stories presence 40 | $stories = $this->getLabelsByType($event->getLabels(), LabelType::STORY); 41 | $this->assertEquals(2, sizeof($stories)); 42 | $index = 1; 43 | foreach ($stories as $story) { 44 | $this->assertInstanceOf('Yandex\Allure\Adapter\Model\Label', $story); 45 | $this->assertEquals("test-suite-story$index", $story->getValue()); 46 | $index++; 47 | } 48 | 49 | //Check issues presence 50 | $issues = $this->getLabelsByType($event->getLabels(), LabelType::ISSUE); 51 | $this->assertEquals(2, sizeof($issues)); 52 | $index = 1; 53 | foreach ($issues as $issue) { 54 | $this->assertInstanceOf('Yandex\Allure\Adapter\Model\Label', $issue); 55 | $this->assertEquals("test-suite-issue$index", $issue->getValue()); 56 | $index++; 57 | } 58 | 59 | } 60 | 61 | public function testUpdateTestCaseStartedEvent() 62 | { 63 | $instance = new Fixtures\ExampleTestSuite(); 64 | $testCaseAnnotations = AnnotationProvider::getMethodAnnotations($instance, 'exampleTestCase'); 65 | $annotationManager = new AnnotationManager($testCaseAnnotations); 66 | $event = new TestCaseStartedEvent('some-uid', 'some-name'); 67 | $annotationManager->updateTestCaseEvent($event); 68 | 69 | //Check scalar properties 70 | $this->assertEquals('test-case-title', $event->getTitle()); 71 | $this->assertEquals('test-case-description', $event->getDescription()->getValue()); 72 | $this->assertEquals(DescriptionType::HTML, $event->getDescription()->getType()); 73 | $this->assertEquals(7, sizeof($event->getLabels())); 74 | 75 | //Check feature presence 76 | $features = $this->getLabelsByType($event->getLabels(), LabelType::FEATURE); 77 | $this->assertEquals(2, sizeof($features)); 78 | $index = 1; 79 | foreach ($features as $feature) { 80 | $this->assertInstanceOf('Yandex\Allure\Adapter\Model\Label', $feature); 81 | $this->assertEquals("test-case-feature$index", $feature->getValue()); 82 | $index++; 83 | } 84 | 85 | //Check stories presence 86 | $stories = $this->getLabelsByType($event->getLabels(), LabelType::STORY); 87 | $this->assertEquals(2, sizeof($stories)); 88 | $index = 1; 89 | foreach ($stories as $story) { 90 | $this->assertInstanceOf('Yandex\Allure\Adapter\Model\Label', $story); 91 | $this->assertEquals("test-case-story$index", $story->getValue()); 92 | $index++; 93 | } 94 | 95 | //Check issues presence 96 | $issues = $this->getLabelsByType($event->getLabels(), LabelType::ISSUE); 97 | $this->assertEquals(2, sizeof($issues)); 98 | $index = 1; 99 | foreach ($issues as $issue) { 100 | $this->assertInstanceOf('Yandex\Allure\Adapter\Model\Label', $issue); 101 | $this->assertEquals("test-case-issue$index", $issue->getValue()); 102 | $index++; 103 | } 104 | 105 | //Check severity presence 106 | $severities = $this->getLabelsByType($event->getLabels(), LabelType::SEVERITY); 107 | $this->assertEquals(1, sizeof($severities)); 108 | $severity = array_pop($severities); 109 | $this->assertInstanceOf('Yandex\Allure\Adapter\Model\Label', $severity); 110 | $this->assertSame(SeverityLevel::BLOCKER, $severity->getValue()); 111 | 112 | //Check parameter presence 113 | $parameters = $event->getParameters(); 114 | $this->assertEquals(1, sizeof($parameters)); 115 | $parameter = array_pop($parameters); 116 | 117 | $this->assertInstanceOf('Yandex\Allure\Adapter\Model\Parameter', $parameter); 118 | $this->assertSame('test-case-param-name', $parameter->getName()); 119 | $this->assertSame('test-case-param-value', $parameter->getValue()); 120 | $this->assertSame(ParameterKind::ARGUMENT, $parameter->getKind()); 121 | } 122 | 123 | /** 124 | * @param array $labels 125 | * @param string $labelType 126 | * @return array 127 | */ 128 | private function getLabelsByType(array $labels, $labelType) 129 | { 130 | $filteredArray = array_filter( 131 | $labels, 132 | function ($element) use ($labelType) { 133 | return ($element instanceof Label) && ($element->getName() === $labelType); 134 | } 135 | ); 136 | uasort( 137 | $filteredArray, 138 | function (Label $l1, Label $l2) { 139 | $label1Value = $l1->getValue(); 140 | $label2Value = $l2->getValue(); 141 | if ($label1Value === $label2Value) { 142 | return 0; 143 | } 144 | 145 | return ($label1Value < $label2Value) ? -1 : 1; 146 | } 147 | ); 148 | 149 | return $filteredArray; 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /test/Yandex/Allure/Adapter/Annotation/AnnotationProviderTest.php: -------------------------------------------------------------------------------- 1 | assertTrue(sizeof($annotations) === 1); 30 | $annotation = array_pop($annotations); 31 | $this->assertInstanceOf('Yandex\Allure\Adapter\Annotation\Fixtures\TestAnnotation', $annotation); 32 | $this->assertEquals(self::TYPE_CLASS, $annotation->value); 33 | } 34 | 35 | public function testGetMethodAnnotations() 36 | { 37 | $instance = new Fixtures\ClassWithAnnotations(); 38 | $annotations = AnnotationProvider::getMethodAnnotations($instance, self::METHOD_NAME); 39 | $this->assertTrue(sizeof($annotations) === 1); 40 | $annotation = array_pop($annotations); 41 | $this->assertInstanceOf('Yandex\Allure\Adapter\Annotation\Fixtures\TestAnnotation', $annotation); 42 | $this->assertEquals(self::TYPE_METHOD, $annotation->value); 43 | } 44 | 45 | public function testShouldThrowExceptionForNotImportedAnnotations() 46 | { 47 | $instance = new Fixtures\ClassWithIgnoreAnnotation(); 48 | $this->expectException(AnnotationException::class); 49 | AnnotationProvider::getClassAnnotations($instance); 50 | } 51 | 52 | public function testShouldIgnoreGivenAnnotations() 53 | { 54 | $instance = new Fixtures\ClassWithIgnoreAnnotation(); 55 | AnnotationProvider::addIgnoredAnnotations(['SomeCustomClassAnnotation', 'SomeCustomMethodAnnotation']); 56 | 57 | $this->assertEmpty(AnnotationProvider::getClassAnnotations($instance)); 58 | $this->assertEmpty(AnnotationProvider::getMethodAnnotations($instance, 'methodWithIgnoredAnnotation')); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /test/Yandex/Allure/Adapter/Annotation/Fixtures/ClassWithAnnotations.php: -------------------------------------------------------------------------------- 1 | getTestContents()); 22 | $sha1Sum = sha1_file($tmpFilename); 23 | 24 | $event = new AddAttachmentEvent($tmpFilename, $attachmentCaption, $attachmentType); 25 | $step = new Step(); 26 | $event->process($step); 27 | 28 | $attachmentFileName = $event->getOutputFileName($sha1Sum, $correctExtension); 29 | $attachmentOutputPath = $event->getOutputPath($sha1Sum, $correctExtension); 30 | $this->checkAttachmentIsCorrect( 31 | $step, 32 | $attachmentOutputPath, 33 | $attachmentFileName, 34 | $attachmentCaption, 35 | $attachmentType 36 | ); 37 | } 38 | 39 | public function testEventWithStringContents() 40 | { 41 | $attachmentCaption = self::ATTACHMENT_CAPTION; 42 | $attachmentType = 'text/plain'; 43 | $correctExtension = 'txt'; 44 | $tmpDirectory = sys_get_temp_dir(); 45 | Provider::setOutputDirectory($tmpDirectory); 46 | $contents = $this->getTestContents(); 47 | $sha1Sum = sha1($contents); 48 | 49 | $event = new AddAttachmentEvent($contents, $attachmentCaption); 50 | $step = new Step(); 51 | $event->process($step); 52 | 53 | $attachmentFileName = $event->getOutputFileName($sha1Sum, $correctExtension); 54 | $attachmentOutputPath = $event->getOutputPath($sha1Sum, $correctExtension); 55 | $this->checkAttachmentIsCorrect( 56 | $step, 57 | $attachmentOutputPath, 58 | $attachmentFileName, 59 | $attachmentCaption, 60 | $attachmentType 61 | ); 62 | } 63 | 64 | /** 65 | * @dataProvider emptyContentProvider 66 | */ 67 | public function testEmptyAttachmentIsNotParsed($emptyContent) 68 | { 69 | $event = new AddAttachmentEvent($emptyContent, self::ATTACHMENT_CAPTION); 70 | $step = new Step(); 71 | $event->process($step); 72 | 73 | $this->assertEmpty($step->getAttachments()); 74 | } 75 | 76 | private function checkAttachmentIsCorrect( 77 | Step $step, 78 | $attachmentOutputPath, 79 | $attachmentFileName, 80 | $attachmentCaption, 81 | $attachmentType 82 | ) { 83 | $this->assertTrue(file_exists($attachmentOutputPath)); 84 | $attachments = $step->getAttachments(); 85 | $this->assertEquals(1, sizeof($attachments)); 86 | $attachment = array_pop($attachments); 87 | $this->assertInstanceOf('Yandex\Allure\Adapter\Model\Attachment', $attachment); 88 | $this->assertEquals($attachmentFileName, $attachment->getSource()); 89 | $this->assertEquals($attachmentCaption, $attachment->getTitle()); 90 | $this->assertEquals($attachmentType, $attachment->getType()); 91 | } 92 | 93 | private function getTestContents() 94 | { 95 | return str_shuffle('test-contents'); 96 | } 97 | 98 | public function emptyContentProvider() 99 | { 100 | return [ 101 | [''], 102 | [null], 103 | ]; 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /test/Yandex/Allure/Adapter/Event/AddParameterEventTest.php: -------------------------------------------------------------------------------- 1 | process($testCase); 20 | $this->assertEquals(1, sizeof($testCase->getParameters())); 21 | $parameters = $testCase->getParameters(); 22 | $parameter = array_pop($parameters); 23 | $this->assertTrue( 24 | ($parameter instanceof Parameter) && 25 | ($parameter->getName() === $parameterName) && 26 | ($parameter->getValue() === $parameterValue) && 27 | ($parameter->getKind() === $parameterKind) 28 | ); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test/Yandex/Allure/Adapter/Event/RemoveAttachmentsEventTest.php: -------------------------------------------------------------------------------- 1 | assertTrue(file_exists($matchingFilename)); 21 | 22 | $notMatchingFilename = tempnam($tmpDirectory, 'excluded'); 23 | 24 | $step = new Step(); 25 | $step->addAttachment(new Attachment($attachmentTitle, $matchingFilename, ATTACHMENT_TYPE)); 26 | $step->addAttachment(new Attachment($attachmentTitle, $notMatchingFilename, ATTACHMENT_TYPE)); 27 | 28 | $this->assertEquals(2, sizeof($step->getAttachments())); 29 | 30 | $event = new RemoveAttachmentsEvent("/$pattern/i"); 31 | $event->process($step); 32 | 33 | $this->assertEquals(1, sizeof($step->getAttachments())); 34 | $this->assertFalse(file_exists($matchingFilename)); 35 | $attachments = $step->getAttachments(); 36 | $attachment = array_pop($attachments); 37 | $this->assertTrue( 38 | ($attachment instanceof Attachment) && 39 | ($attachment->getSource() === $notMatchingFilename) 40 | ); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /test/Yandex/Allure/Adapter/Event/StepCanceledEventTest.php: -------------------------------------------------------------------------------- 1 | process($step); 15 | $this->assertNotEmpty($step->getStop()); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/Yandex/Allure/Adapter/Event/StepStartedEventTest.php: -------------------------------------------------------------------------------- 1 | withTitle($stepTitle); 18 | $event->process($step); 19 | $this->assertEquals(Status::PASSED, $step->getStatus()); 20 | $this->assertEquals($stepTitle, $step->getTitle()); 21 | $this->assertNotEmpty($step->getStart()); 22 | $this->assertEquals($stepName, $step->getName()); 23 | $this->assertEmpty($step->getStop()); 24 | $this->assertEmpty($step->getSteps()); 25 | $this->assertEmpty($step->getAttachments()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /test/Yandex/Allure/Adapter/Event/StepStatusChangedEventTest.php: -------------------------------------------------------------------------------- 1 | getStepEvent(); 24 | $event->process($step); 25 | $this->assertEquals($this->getTestedStatus(), $step->getStatus()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /test/Yandex/Allure/Adapter/Event/Storage/Fixtures/MockedRootStepStorage.php: -------------------------------------------------------------------------------- 1 | setName('root-step'); 14 | 15 | return $rootStep; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/Yandex/Allure/Adapter/Event/Storage/StepStorageTest.php: -------------------------------------------------------------------------------- 1 | assertTrue($storage->isRootStep($storage->getLast())); 17 | $this->assertTrue($storage->isRootStep($storage->pollLast())); 18 | $this->assertTrue($storage->isEmpty()); 19 | } 20 | 21 | public function testNonEmptyStorage() 22 | { 23 | $storage = new Fixtures\MockedRootStepStorage(); 24 | $step = new Step(); 25 | $step->setName(self::TEST_STEP_NAME); 26 | $storage->put($step); 27 | $this->assertEquals($storage->getLast()->getName(), self::TEST_STEP_NAME); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /test/Yandex/Allure/Adapter/Event/Storage/TestCaseStorageTest.php: -------------------------------------------------------------------------------- 1 | get(); 14 | $this->assertEmpty($testCase->getName()); 15 | 16 | $name1 = 'test-name1'; 17 | $testCase->setName($name1); 18 | $this->assertEquals($name1, $storage->get()->getName()); 19 | 20 | $name2 = 'test-name1'; 21 | $testCase = new TestCase(); 22 | $testCase->setName($name2); 23 | $storage->put($testCase); 24 | $this->assertEquals($name2, $storage->get()->getName()); 25 | 26 | $storage->clear(); 27 | $this->assertEmpty($storage->get()->getName()); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /test/Yandex/Allure/Adapter/Event/Storage/TestSuiteStorageTest.php: -------------------------------------------------------------------------------- 1 | get($uuid); 15 | $this->assertEmpty($testSuite->getName()); 16 | $testSuite->setName($name); 17 | $this->assertEquals($name, $storage->get($uuid)->getName()); 18 | 19 | $storage->remove($uuid); 20 | $this->assertEmpty($storage->get($uuid)->getName()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test/Yandex/Allure/Adapter/Event/TestCaseBrokenEventTest.php: -------------------------------------------------------------------------------- 1 | process($testCase); 15 | $this->assertNotEmpty($testCase->getStop()); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/Yandex/Allure/Adapter/Event/TestCasePendingEventTest.php: -------------------------------------------------------------------------------- 1 | withTitle($testCaseTitle) 33 | ->withDescription(new Description($testCaseDescriptionType, $testCaseDescriptionValue)) 34 | ->withLabels([new Label($testCaseLabelName, $testCaseLabelValue)]) 35 | ->withParameters([new Parameter($testCaseParameterName, $testCaseParameterValue, $testCaseParameterKind)]); 36 | $event->process($testCase); 37 | 38 | $this->assertEquals(Status::PASSED, $testCase->getStatus()); 39 | $this->assertEquals($testCaseTitle, $testCase->getTitle()); 40 | $this->assertNotEmpty($testCase->getStart()); 41 | $this->assertEquals($testCaseName, $testCase->getName()); 42 | $this->assertNotEmpty($testCase->getDescription()); 43 | $this->assertEquals($testCaseDescriptionValue, $testCase->getDescription()->getValue()); 44 | $this->assertEquals($testCaseDescriptionType, $testCase->getDescription()->getType()); 45 | $this->assertEquals(1, sizeof($testCase->getLabels())); 46 | $labels = $testCase->getLabels(); 47 | $label = array_pop($labels); 48 | $this->assertTrue( 49 | ($label instanceof Label) && 50 | ($label->getName() === $testCaseLabelName) && 51 | ($label->getValue() === $testCaseLabelValue) 52 | ); 53 | $this->assertEquals(1, sizeof($testCase->getParameters())); 54 | $parameters = $testCase->getParameters(); 55 | $parameter = array_pop($parameters); 56 | $this->assertTrue( 57 | ($parameter instanceof Parameter) && 58 | ($parameter->getName() === $testCaseParameterName) && 59 | ($parameter->getValue() === $testCaseParameterValue) && 60 | ($parameter->getKind() === $testCaseParameterKind) 61 | ); 62 | $this->assertEmpty($testCase->getStop()); 63 | $this->assertEmpty($testCase->getSteps()); 64 | $this->assertEmpty($testCase->getAttachments()); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /test/Yandex/Allure/Adapter/Event/TestCaseStatusChangedEventTest.php: -------------------------------------------------------------------------------- 1 | getTestCaseStatusChangedEvent(); 27 | $event->withMessage($testMessage)->withException(new Exception()); 28 | $event->process($testCase); 29 | 30 | $this->assertEquals($this->getTestedStatus(), $testCase->getStatus()); 31 | $this->assertEquals($testMessage, $testCase->getFailure()->getMessage()); 32 | $this->assertNotEmpty($testCase->getFailure()->getStackTrace()); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /test/Yandex/Allure/Adapter/Event/TestSuiteFinishedEventTest.php: -------------------------------------------------------------------------------- 1 | process($testSuite); 16 | $this->assertNotEmpty($testSuite->getStop()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/Yandex/Allure/Adapter/Event/TestSuiteStartedEventTest.php: -------------------------------------------------------------------------------- 1 | withTitle($testSuiteTitle) 26 | ->withDescription(new Description($testSuiteDescriptionType, $testSuiteDescriptionValue)) 27 | ->withLabels(array(new Label($testSuiteLabelName, $testSuiteLabelValue))); 28 | $event->process($testSuite); 29 | 30 | $this->assertEquals($testSuiteTitle, $testSuite->getTitle()); 31 | $this->assertNotEmpty($testSuite->getStart()); 32 | $this->assertEquals($testSuiteName, $testSuite->getName()); 33 | $this->assertNotEmpty($testSuite->getDescription()); 34 | $this->assertEquals($testSuiteDescriptionValue, $testSuite->getDescription()->getValue()); 35 | $this->assertEquals($testSuiteDescriptionType, $testSuite->getDescription()->getType()); 36 | $this->assertEquals(1, sizeof($testSuite->getLabels())); 37 | $labels = $testSuite->getLabels(); 38 | $label = array_pop($labels); 39 | $this->assertTrue( 40 | ($label instanceof Label) && 41 | ($label->getName() === $testSuiteLabelName) && 42 | ($label->getValue() === $testSuiteLabelValue) 43 | ); 44 | $this->assertEmpty($testSuite->getStop()); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /test/Yandex/Allure/Adapter/Fixtures/GenericStepEvent.php: -------------------------------------------------------------------------------- 1 | name = $name; 16 | } 17 | 18 | public function process(Entity $context) 19 | { 20 | if ($context instanceof Step) { 21 | $context->setName($this->name); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test/Yandex/Allure/Adapter/Fixtures/GenericTestCaseEvent.php: -------------------------------------------------------------------------------- 1 | name = $name; 16 | } 17 | 18 | public function process(Entity $context) 19 | { 20 | if ($context instanceof TestCase) { 21 | $context->setName($this->name); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test/Yandex/Allure/Adapter/Fixtures/GenericTestSuiteEvent.php: -------------------------------------------------------------------------------- 1 | name = $name; 17 | } 18 | 19 | public function process(Entity $context) 20 | { 21 | if ($context instanceof TestSuite) { 22 | $context->setName($this->name); 23 | } 24 | } 25 | 26 | public function getUuid() 27 | { 28 | return AllureTest::TEST_SUITE_UUID; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test/Yandex/Allure/Adapter/Model/ConstantCheckerTest.php: -------------------------------------------------------------------------------- 1 | assertEquals( 16 | TestConstants::TEST_CONSTANT, 17 | ConstantChecker::validate(self::CLASS_NAME, TestConstants::TEST_CONSTANT) 18 | ); 19 | } 20 | 21 | public function testConstantIsMissing() 22 | { 23 | $this->expectException(AllureException::class); 24 | ConstantChecker::validate(self::CLASS_NAME, 'missing-value'); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/Yandex/Allure/Adapter/Model/Fixtures/TestConstants.php: -------------------------------------------------------------------------------- 1 | addAttachment($attachmentContents, $attachmentCaption, $attachmentType); 21 | $event = Allure::lifecycle()->getLastEvent(); 22 | $this->assertTrue( 23 | ($event instanceof AddAttachmentEvent) && 24 | ($event->getFilePathOrContents() === $attachmentContents) && 25 | ($event->getCaption() === $attachmentCaption) && 26 | ($event->getType() === $attachmentType) 27 | ); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /test/Yandex/Allure/Adapter/Support/MockedLifecycle.php: -------------------------------------------------------------------------------- 1 | reset(); 20 | } 21 | 22 | public function fire(Event $event) 23 | { 24 | $this->events[] = $event; 25 | } 26 | 27 | /** 28 | * @return array 29 | */ 30 | public function getEvents() 31 | { 32 | return $this->events; 33 | } 34 | 35 | public function reset() 36 | { 37 | $this->events = array(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /test/Yandex/Allure/Adapter/Support/StepSupportTest.php: -------------------------------------------------------------------------------- 1 | mockedLifecycle = new MockedLifecycle(); 30 | $this->getMockedLifecycle()->reset(); 31 | Allure::setLifecycle($this->getMockedLifecycle()); 32 | } 33 | 34 | public function testExecuteStepCorrectly() 35 | { 36 | $logicWithNoException = function () { 37 | //We do nothing, hence no error 38 | }; 39 | $this->executeStep(self::STEP_NAME, $logicWithNoException, self::STEP_TITLE); 40 | $events = $this->getMockedLifecycle()->getEvents(); 41 | $this->assertEquals(2, sizeof($events)); 42 | $this->assertTrue($events[0] instanceof StepStartedEvent); 43 | $this->assertTrue($events[1] instanceof StepFinishedEvent); 44 | } 45 | 46 | public function testExecuteFailingStep() 47 | { 48 | $logicWithException = function () { 49 | throw new Exception(); 50 | }; 51 | $this->expectException(Exception::class); 52 | $this->executeStep(self::STEP_NAME, $logicWithException, self::STEP_TITLE); 53 | $events = $this->getMockedLifecycle()->getEvents(); 54 | $this->assertEquals(3, sizeof($events)); 55 | $this->assertTrue($events[0] instanceof StepStartedEvent); 56 | $this->assertTrue($events[1] instanceof StepFailedEvent); 57 | $this->assertTrue($events[2] instanceof StepFinishedEvent); 58 | } 59 | 60 | public function testExecuteStepWithMissingData() 61 | { 62 | $this->expectException(AllureException::class); 63 | $this->executeStep(null, null, null); 64 | } 65 | 66 | protected function tearDown(): void 67 | { 68 | parent::tearDown(); 69 | Allure::setDefaultLifecycle(); 70 | } 71 | 72 | /** 73 | * @return MockedLifecycle 74 | */ 75 | private function getMockedLifecycle() 76 | { 77 | return $this->mockedLifecycle; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /test/Yandex/Allure/Adapter/Support/UtilsTest.php: -------------------------------------------------------------------------------- 1 | assertTrue(is_float($timestamp)); 14 | $this->assertGreaterThan(0, $timestamp); 15 | } 16 | 17 | public function testGenerateUUID() 18 | { 19 | $uuid1 = self::generateUUID(); 20 | $uuid2 = self::generateUUID(); 21 | $this->assertTrue(is_string($uuid1)); 22 | $this->assertNotEquals($uuid1, $uuid2); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test/Yandex/Allure/Adapter/XMLValidationTest.php: -------------------------------------------------------------------------------- 1 | prepareDirForXML(); 46 | $uuid = $this->generateXML($tmpDir); 47 | 48 | $fileName = $tmpDir . DIRECTORY_SEPARATOR . $uuid . '-testsuite.xml'; 49 | $this->assertTrue(file_exists($fileName)); 50 | $this->validateFileXML($fileName); 51 | } 52 | 53 | private function prepareDirForXML() 54 | { 55 | $tmpDir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . uniqid('allure-xml-test'); 56 | mkdir($tmpDir); 57 | $this->assertTrue( 58 | file_exists($tmpDir) && 59 | is_writable($tmpDir) 60 | ); 61 | 62 | return $tmpDir; 63 | } 64 | 65 | private function generateXML($tmpDir) 66 | { 67 | Model\Provider::setOutputDirectory($tmpDir); 68 | Allure::setDefaultLifecycle(); 69 | $testSuiteStartedEvent = new TestSuiteStartedEvent(TEST_SUITE_NAME); 70 | $uuid = $testSuiteStartedEvent->getUuid(); 71 | $testSuiteStartedEvent->setTitle(TEST_SUITE_TITLE); 72 | $testSuiteStartedEvent->setDescription(new Description(DescriptionType::HTML, DESCRIPTION)); 73 | $testSuiteStartedEvent->setLabels([ 74 | Label::feature(FEATURE_NAME), 75 | Label::story(STORY_NAME) 76 | ]); 77 | Allure::lifecycle()->fire($testSuiteStartedEvent); 78 | 79 | $testCaseStartedEvent = new TestCaseStartedEvent($uuid, TEST_CASE_NAME); 80 | $testCaseStartedEvent->setDescription(new Description(DescriptionType::MARKDOWN, DESCRIPTION)); 81 | $testCaseStartedEvent->setLabels([ 82 | Label::feature(FEATURE_NAME), 83 | Label::story(STORY_NAME), 84 | Label::severity(SeverityLevel::MINOR) 85 | ]); 86 | $testCaseStartedEvent->setTitle(TEST_CASE_TITLE); 87 | $testCaseStartedEvent->setParameters([ 88 | new Parameter(PARAMETER_NAME, PARAMETER_VALUE, ParameterKind::SYSTEM_PROPERTY) 89 | ]); 90 | Allure::lifecycle()->fire($testCaseStartedEvent); 91 | 92 | $testCaseFailureEvent = new TestCaseFailedEvent(); 93 | $testCaseFailureEvent = $testCaseFailureEvent->withMessage(FAILURE_MESSAGE)->withException(new \Exception()); 94 | Allure::lifecycle()->fire($testCaseFailureEvent); 95 | 96 | $stepStartedEvent = new StepStartedEvent(STEP_NAME); 97 | $stepStartedEvent = $stepStartedEvent->withTitle(STEP_TITLE); 98 | Allure::lifecycle()->fire($stepStartedEvent); 99 | Allure::lifecycle()->fire( 100 | new AddAttachmentEvent(STEP_ATTACHMENT_SOURCE, STEP_ATTACHMENT_TITLE, 'text/plain') 101 | ); 102 | Allure::lifecycle()->fire(new StepFinishedEvent()); 103 | 104 | Allure::lifecycle()->fire(new TestCaseFinishedEvent()); 105 | Allure::lifecycle()->fire(new TestSuiteFinishedEvent($uuid)); 106 | 107 | return $uuid; 108 | } 109 | 110 | private function validateFileXML($fileName) 111 | { 112 | libxml_use_internal_errors(true); //Comment this line to see DOMDocument XML validation errors 113 | $dom = new DOMDocument(); 114 | $dom->load($fileName); 115 | $schemaFilename = __DIR__ . DIRECTORY_SEPARATOR . 'allure-1.4.0.xsd'; 116 | $isSchemaValid = $dom->schemaValidate($schemaFilename); 117 | $this->assertTrue($isSchemaValid, 'XML file should be valid'); 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /test/Yandex/Allure/Adapter/allure-1.4.0.xsd: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | --------------------------------------------------------------------------------