I need to test with CloudTest an API using socket.io . What is the best approach to do it? Can the library be included in the test script? Should I implement it from scratch using WebSocket?
You can test any API or website with CloudTest (WebSockets included) as long as the communication is via http(s). You don't need to include any library as all CloudTest does is http(s) requests.
Having said that, for testing an application using socket.io, the approach should be the same as with any other application in CloudTest:
- Can you access the application in a browser (application does some WebSockets calls in the browser while navigating in the application), can it be hit in the browser? If yes, use the Conductor Installing SOASTA Conductor for recording the traffic with CloudTest and go from there.
- If API, can you hit it with curl, SoapUI or postman? If yes, you'll need to set the Conductor as a proxy Using a Conductor as a Proxy, depending on what you are using, it will be different instructions to set a proxy.
- If nothing from the above, just be aware that CloudTest does support WebSockets testing, check CloudTest Videos, "WebSockets Testing" video. You can then manually create a WebSockets target, create a new clip, save it, add the target and add any WebSocket relate requests. There is no video or document in how to do this for WebSockets, but there is a video in CloudTest Videos called "Web Services Testing" that explains how to manually create a target, create clip, save it, add messages, etc. Creating a WebSockets test from scratch using CloudTest is pretty similar.
Thanks. In my case socket.io uses Web Socket Secure so I'm trying to capture the events using the conductor. SSL is adding some fun...
The problem with socket.io is that it usually doesn't get the proxy configuration from the environment variable. In my case I had to force the use of a proxy using proxychains
So you were able to record the http(s) traffic of your application at the end?
Retrieving data ...