In behat.yml, enable context:
default:
suites:
default:
contexts:
- JeanBeru\Context\RabbitMqContext
host
: RabbitMQ hostport
: RabbitMQ portuser
: RabbitMQ userpassword
: RabbitMQ passwordvhost
(default : "/"): Optional RabbitMQ vhost
To connect context to RabbitMq, define host, port and credentials:
default:
suites:
default:
contexts:
- JeanBeru\Context\RabbitMQContext:
host: rabbitmq
port: 5672
user: guest
password: guest
vhost: /
Declare an exchange of a specific type (default direct
)
@Given There is a :exchange exchange
@Given There is a :exchange :type exchange
Declare a queue
@Given There is a :queue queue
Declare a queue/exchange binding with or without a routing key
@Given There is a queue binding from :exchange to :queue
@Given There is a queue binding from :exchange to :queue with :routingKey routing key
@Given There is an exchange binding from :exchangeSource to :exchangeDestination
@Given There is an exchange binding from :exchangeSource to :exchangeDestination with :routingKey routing key
Declare a queue and a binding with or without a routing key
@Given There is a :queue queue bind to :exchange
@Given There is a :queue queue bind to :exchange with :routingKey routing key
Delete an exchange/queue
@When I delete :exchange exchange
@When I delete :queue queue
Purge a queue
@When I purge queue :queue
Publish a message
@When I publish a message :body to :exchange
@When I publish a message :body to :exchange with :routing_key routing key
Count and parse messages
@Then I should have :count message(s) in :queue
@Then I should have :count message(s) containing :text in :queue
@Then I print queue :queue