Minimal example
- Design simple framework messages mapping:
- Select Edit > Preferences > General settings > Frameworks.
- Create a new framework called: "SimpleDraw".
- In the Framework settings section, enable the WebSocket checkbox and click on the wrench-like button to configure it using the following:
Request ID extraction:
Regular expression: ^Create\(([^)]*)\)
Value template: $1$
Response ID extraction:
Regular expression: ^Created\([^,]*,([^)]*)\)
Value template: $1$
Note: you can use test field to test your regular expression. Click the content link to add a content to match.
- Record a new Virtual User.
- In the Dynamic Parameters step, keep the option Use Framework rules enabled.
- In the next step of the wizard, select the framework rule you want to apply. If no framework rule has been detected for WebSocket messages mapping, verify the recorded request, the recorded response, and the framework settings.
- Set the WebSocket requests in synchronous mode.
- Set the “websocket_request” to synchronous mode
Note: the Mapping ID in the WebSocket request and the message mapping in the WebSocket channel are auto-filled by the ID extracted at the end of the recording thanks to the request ID extractor configured in the Framework settings.
- Set the variable extractor for the delete operation.
If you try to apply a check VU on your scenario, you can see the last response is :"Oops 28262 does not exist". The identifier of the shape has changed, therefore you need to extract the new ID to replay the scenario.
- In the Virtual User tree, go to websocket_request.
- Click the Advanced button.
- In the Advanced panel, select the Variable extractor tab (this tab is only displayed in synchronous mode).
- Click the + button.
- In the Definition tab, click the button Switch to advanced mode.
- Enter the following text:
Variable name: objectId
Regular expression to match: Created\(([0-9]*),
Value template: $1$
- Go to the second websocket_request and set Delete(${objectId}) as WebSocket request.
- You can retry a Check VU and see the result.
Home