ngraf / slack-codeception-extension Goto Github PK
View Code? Open in Web Editor NEWProvides an extension for Codeception to broadcast test results in Slack messenger
License: MIT License
Provides an extension for Codeception to broadcast test results in Slack messenger
License: MIT License
Hello!
Is it possible to use different configs for environments? For example, enable notifications only for specific environment, not for all?
Thanks
Hi,
I've just tried the plugin, but I can't get it to work. I'm using codeception 2.3 with visualception module.
When I run my acceptance tests with -vvv I can see the following trace:
Exception trace:
Codeception\Subscriber\ErrorHandler->errorHandler() at /home/fester/PhpstormProjects/razvigor-tests/vendor/ngraf/slack-codeception-extension/src/Extension/SlackExtension.php:258
Codeception\Extension\SlackExtension->sendFailMessage() at /home/fester/PhpstormProjects/razvigor-tests/vendor/ngraf/slack-codeception-extension/src/Extension/SlackExtension.php:216
Codeception\Extension\SlackExtension->sendTestResults() at /home/fester/PhpstormProjects/razvigor-tests/vendor/symfony/event-dispatcher/EventDispatcher.php:212
Symfony\Component\EventDispatcher\EventDispatcher->doDispatch() at /home/fester/PhpstormProjects/razvigor-tests/vendor/symfony/event-dispatcher/EventDispatcher.php:44
Symfony\Component\EventDispatcher\EventDispatcher->dispatch() at /home/fester/PhpstormProjects/razvigor-tests/vendor/codeception/codeception/src/Codeception/Codecept.php:206
Codeception\Codecept->printResult() at /home/fester/PhpstormProjects/razvigor-tests/vendor/codeception/codeception/src/Codeception/Command/Run.php:376
Codeception\Command\Run->execute() at /home/fester/PhpstormProjects/razvigor-tests/vendor/symfony/console/Command/Command.php:252
Symfony\Component\Console\Command\Command->run() at /home/fester/PhpstormProjects/razvigor-tests/vendor/symfony/console/Application.php:865
Symfony\Component\Console\Application->doRunCommand() at /home/fester/PhpstormProjects/razvigor-tests/vendor/symfony/console/Application.php:241
Symfony\Component\Console\Application->doRun() at /home/fester/PhpstormProjects/razvigor-tests/vendor/symfony/console/Application.php:143
Symfony\Component\Console\Application->run() at /home/fester/PhpstormProjects/razvigor-tests/vendor/codeception/codeception/src/Codeception/Application.php:108
Codeception\Application->run() at /home/fester/PhpstormProjects/razvigor-tests/vendor/codeception/codeception/package/bin:37
require() at phar:///usr/local/bin/codecept/autoload.php:12
require_once() at /usr/local/bin/codecept:5
Let me know if I can provide more information.
Hey,
I have gotten following error when I try to use your extension with Codeception ^2.4. Looks like your extension expects to receive an older version of PHPUnit results class.
PHP Fatal error: Uncaught TypeError: Argument 1 passed to Codeception\Extension\SlackExtension::sendSuccessMessage() must be an instance of PHPUnit_Framework_TestResult, instance of PHPUnit\Framework\TestResult given, called in .../vendor/ngraf/slack-codeception-extension/src/Extension/SlackExtension.php on line 206 and defined in .../vendor/ngraf/slack-codeception-extension/src/Extension/SlackExtension.php:226
Stack trace:
#0 .../vendor/ngraf/slack-codeception-extension/src/Extension/SlackExtension.php(206): Codeception\Extension\SlackExtension->sendSuccessMessage(Object(PHPUnit\Framework\TestResult))
#1 .../vendor/symfony/event-dispatcher/EventDispatcher.php(212): Codeception\Extension\SlackExtension->sendTestResults(Object(Codeception\Event\PrintResultEvent), 'result.print.af...', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#2 .../vendor/symfony/event-dispatche in .../vendor/ngraf/slack-codeception-extension/src/Extension/SlackExtension.php on line 226
Unfortunately, even with everything correct installed, no notifications were received in slack.
Tested it with setting the extension active via Codeception.yaml
and as an alternative, via the command line --ext SlackExtension
I had installed a second extension 'ProgressReporter', just to get sure, everything's on the Codeception side ist fully functional. And Progress Reporter runs just fine...
Verbose output doesn't even mention SlackExtension....
am I missing something?
Here is my Codeception.yaml:
extensions:
enabled:
- Codeception\ProgressReporter\ProgressReporter
- Codeception\Extension\SlackExtension
config:
Codeception\Extension\SlackExtension:
messagePrefix: '*Smoke-Test*'
webhook: https://hooks.slack.com/services/...
strategy: always
extended: true
extendedMaxLength: 150
channel: '#channelname'
IIUC, the package needs to be on packagist in order to be able to install it using composer and I think the author is the one that is able to add it there. If that's the case, it would be great if you could do that. Thanks.
If i set webhook
option to be empty string, your extension throws ExtensionException
and it crashes tests run. Instead of doing it, your extension needs to skip sending reports to slack.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.