A tester uses a web browser to access the console. The console manages the virtual service. The system under test (application under test) connects directly to the virtual service on different ports.
Here is an example of how that could look like for a scenario where the virtual service is replaying messages to an external queue.
To record from or replay to JMS brokers you will need to tell Traffic Parrot how to connect to them.
Those connections are displayed in the dropdown menus on the record and replay panels, for example:
The "Internal broker" connection is populated in the dropdown by default when you choose to use an internal broker in the Broker panel.
To define a new connection that will be available in the dropdown in the record and replay panels:[ { "connectionId": "1", "connectionName": "Test Payments Broker", "connectionData": { "jmsProvider": "IBM_MQ_7_5", "hostname": "mqserver.example.com", "port": 1415, "queueManager": "PAYMENT.QM", "channel": "PAYMENT.SVRCONN", "username": "payuser", "password": "paypassword222" } }, { "connectionId": "2", "connectionName": "TrafficParrot External Payment Broker", "connectionData": { "jmsProvider": "IBM_MQ_7_5", "hostname": "mqserver.example.com", "port": 1414, "queueManager": "TRAFFICPARROT.DEV.AWS.QM", "channel": "TP.PUBLIC.JUNIT", "username": "tpuser", "password": "tppass333" } }, { "connectionId": "3", "connectionName": "Test Order System Broker", "connectionData": { "jmsProvider": "ACTIVE_MQ", "hostname": "localhost", "port": 61616 } } ]
In the current Traffic Parrot version you edit JMS connections directly in the jms-connections.json file. In near future you will be able to do it via the Web UI as well.
If you would like to change the location of the jms-connections.json file, change the value of property
trafficparrot.virtualservice.jmsConnectionsUrl=classpath:jms-connections.jsonto for example
trafficparrot.virtualservice.jmsConnectionsUrl=file:/home/john/git/project/trafficparrot-jms-connections.jsonThis can be useful if you would like to version control it with your application source code.
In order to connect to IBM® MQ 7.5.x you need jar files that will allow Traffic Parrot to establish connections with MQ.
Before you proceed please read these instructions to double check your actions are inline with the supported way to install WebSphere MQ Java jar files.
Copy those files to trafficparrot-enterprise-release-x.y.z/lib/external and restart Traffic Parrot.
If you do not have the required JAR files yet, follow the instructions to obtain them. These are typically found in /opt/mqm/java/lib on a UNIX system, but may be found in a different location depending on your environment.
As with HTTP recording Traffic Parrot, during recording incoming and outgoing messages are matched up to provide mappings. Then upon playback receipt of a matching incoming message will trigger generation of an outgoing message.
The method which requires least configuration is to use Traffic Parrot's internal broker. Via this method you can record traffic to and from your application by just modifying the broker URL to which your application connects.
This diagram shows how two production systems connect:
One system generates messages onto a queue; another system consumes these messages and puts responses onto a second queue, which the first system consumes. If our goal is to test the system-under-test in isolation, we must record these interactions in order to replay them.
As you can see in the diagram, the recording simply introduces two extra queues, to which the system under test connects, as shown in the diagram below:
As the system-under-test generates messages they are listed in the bottom table 'Current recording session'. As the second system generates responses to these messages, they are also listed at the bottom, but in addition mappings are generated in the 'Mappings' table showing incoming and outgoing messages that Traffic Parrot has paired up.
In this scenario we don't want to use Traffic Parrot's internal broker - we want Traffic Parrot to work with an existing external broker. This scenario is useful mainly when you would like to work with brokers that are unsupported internally by Traffic Parrot, for example IBM® MQ.
Instead of pointing the system under test at a different broker, we will create extra queues on our existing broker that will be used by the virtual service. Then we will reconfigure the system-under-test to connect to these queues instead of the original ones. Traffic Parrot will move messages between these queues and the original queues, recording and creating mappings as it does so.
To replay the recorded mappings we will need the same virtual service queues in place as shown on the image below.
You can use Traffic Parrot's internal broker to record and replay topic messages. For the purpose fo the examples below, we will use a configuration where the production systems connect in a way described on the diagram below:
The system-under-test generates messages onto a topic which are received by a number of other systems. One of these systems generates responses onto a different topic (which are received by a number of systems, one of which is the system-under-test).
We will configure Traffic Parrot to connect to the request and response topics and record the messages appearing on both, generating mappings as it goes, as shown on diagram Recording topics using an internal broker
Recording and playback of topics using an external broker is less intrusive than queues or internal broker topics, because Traffic Parrot can subscribe to a topic just like any other application and receive messages, without affecting the delivery of those messages to other applications.
This diagram shows how the production systems connect:
The system-under-test generates messages onto a topic which are received by a number of other systems. One of these systems generates responses onto a different topic (which are received by a number of systems, one of which is the system-under-test).
We will configure Traffic Parrot to connect to the request and response topics and record the messages appearing on both, generating mappings as it goes, as shown on diagram Recording topics using an external broker
This documentation is for an old version of Traffic Parrot. There is a more recent Traffic Parrot version available for download at trafficparrot.com