diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..52f8fa9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +/vendor +/composer.lock +.DS_Store +.idea +*.yml diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..6f9ec13 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..e14ec6e --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +jira-codeception-extension +============================= +This package provides an extension for Codeception to create Jira issues automatically when a test fails. diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..ed63f01 --- /dev/null +++ b/composer.json @@ -0,0 +1,25 @@ +{ + "name": "ueslialmeida/simple-jira-codeception", + "description": "This package provides an extension for Codeception to create Jira issues automatically when a test fails.", + "keywords": [ + "jira", + "issue", + "codeception", + "extension" + ], + "authors": [ + { + "name": "Uesli Almeida", + "email": "almeida.uesli@gmail.com", + "homepage": "https://github.com/ueslialmeida", + "role": "Tester/Developer" + } + ], + "autoload": { + "psr-4": { + "Codeception\\": "src" + } + }, + "require": {} + } + \ No newline at end of file diff --git a/src/Extension/JiraExtension.php b/src/Extension/JiraExtension.php new file mode 100644 index 0000000..a0a7fb4 --- /dev/null +++ b/src/Extension/JiraExtension.php @@ -0,0 +1,37 @@ +use \Codeception\Events; + +class JiraExtension extends \Codeception\Extension +{ + // list events to listen to + // Codeception\Events constants used to set the event + + public static $events = array( + Events::SUITE_AFTER => 'afterSuite', + Events::TEST_BEFORE => 'beforeTest', + Events::STEP_BEFORE => 'beforeStep', + Events::TEST_FAIL => 'testFailed', + Events::RESULT_PRINT_AFTER => 'print', + ); + + // methods that handle events + + public function afterSuite(\Codeception\Event\SuiteEvent $e) { + echo('### THIS IS THE AFTER SUITE EVENT ###'); + } + + public function beforeTest(\Codeception\Event\TestEvent $e) { + echo('@@@ THIS IS THE BEFORE TEST EVENT @@@'); + } + + public function beforeStep(\Codeception\Event\StepEvent $e) { + echo('%%% THIS IS THE BEFORE STEP EVENT %%%'); + } + + public function testFailed(\Codeception\Event\FailEvent $e) { + echo('$$$ THIS IS THE TEST FAILED EVENT $$$'); + } + + public function print(\Codeception\Event\PrintResultEvent $e) { + echo('&&& THIS IS THE RESULT PRINT AFTER EVENT &&&'); + } +} \ No newline at end of file