2017 © Pedro Peláez
 

library behat-swarrot-context

Behat Swarrot Context to test AMQP messages, based on Swarrot library and PECL AMQP php extension.

image

ygalescot/behat-swarrot-context

Behat Swarrot Context to test AMQP messages, based on Swarrot library and PECL AMQP php extension.

  • Thursday, July 19, 2018
  • by ygalescot
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

ygalescot/behat-swarrot-context

This project is an extension built for Behat that allows you to test AMQP messages., (*1)

It is based on Swarrot library and PECL AMQP php extension., (*2)

Setup

Simply add the SwarrotContext to your behat.yml config:, (*3)

default:
    suites:
        your_suite:
            ...
            contexts:
                - ...
                - 'Ygalescot\BehatSwarrotContext\Context\SwarrotContext'

By default the SwarrotContext uses the default connection to RabbitMQ:, (*4)

host: localhost
port: 5672
vhost: /
login: guest
password: guest

But you can override this configuration with your own values when you add the SwarrotContext to your behat.yml file:, (*5)

default:
    suites:
        your_suite:
            ...
            contexts:
                - ...
                - 'Ygalescot\BehatSwarrotContext\Context\SwarrotContext':
                    host: your_custom_host
                    port: 5672
                    vhost: /
                    login: your_custom_login
                    password: your_custom_password

How to use

In your Behat test scenarios you can use these steps to test your AMQP Messages:, (*6)

  • Given I purge queue :queue_name (will purge all messages in that queue)
  • Then I set message properties: (with properties described as YAML in a Gherkin PyStringNode)
  • Then I set message body: (with body as a Gherkin PyStringNode)
  • Then I publish message with routing key :routingKey (this will publish a message to RabbitMQ with previously set properties and/or body)
  • Then I consume a message from queue :queue_name
  • Then the message should have property :property equal to :value
  • Then the message should have header :header equal to :value
  • Then the message body should contain :body
  • Then the message body should have JSON node :node equal to :value
  • Then print the message body (to display the content of your message in console)
  • Then print the message properties (to display the message properties in console)

For a fully functional example see our Behat feature file: features/context.feature, (*7)

Licence

MIT, (*8)

The Versions

19/07 2018

dev-master

9999999-dev

Behat Swarrot Context to test AMQP messages, based on Swarrot library and PECL AMQP php extension.

  Sources   Download

MIT

The Requires

 

by Avatar ygalescot

19/07 2018

0.1

0.1.0.0

Behat Swarrot Context to test AMQP messages, based on Swarrot library and PECL AMQP php extension.

  Sources   Download

MIT

The Requires

 

by Avatar ygalescot