How to test WebSockets or XMPP app

Jun 22, 2021

Imagine you have a WebSockets or XMPP app that would require you to test that messages sent by User 1 get to User 2 instantaneously. How do you do that?

To properly end-to-end test this scenario you would need to emulate actual situation. I.e. have 2 devices or browsers running 2 different users at the same time. Sounds like a challenge? Not for testRigor. In testRigor it is trivial to kick off additional browser or device from the test code with just this command:

start browser "User 2" and switch

Overall, the full test for this specific scenario might look like this:

tap "Messages"
start device "User 2" and switch
save value stored value "username2" as "username"
save value stored value "password2" as "password"
tap "Messages"
tap "Send message to User 1"
generate by regex "[A-Z][a-z]{30}", then enter into "Message" and save as "message"
tap "Send"
switch to device "default"
validate that screen contains stored value "message"

As you can see above the message being sent is also unique to avoid false-positives from previous tests.

That is it. It is as simple as that. And I bet you understood what the code above is doing even though you never used testRigor before :)

BTW, testRigor has a free trial that you can request here.

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.