Testing clj-browserchannel

 10 months ago
source link: https://thegeez.net/2012/07/10/test_selenium_browserchannel.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Testing clj-browserchannel

10 Jul 2012

The clj-browserchannel project now also contains a test project. The test project contains a small executable test that tests the whole browserchannel stack, by using the chat-demo application. The test project is meant to test the server-side component of the BrowserChannel protocol in clj-browserchannel. Together with the client-side implementation as part of the Google Closure library this provides real-time bi-directional communication for web apps.

The test is done by mimicking people chatting in the chat-demo application. Testing the server component in clj-browserchannel by itself is nearly impossible. This is because the server-side is fully dependent on cooperation with the client-side to comply to the BrowserChannel protocol. However both the protocol and the client-side implementation are very sparsely documented. The client-side implementation is a black box that can not easily be mocked or stubbed. Therefore the approach is to do simulation testing.

The people chatting in the chat-demo are programmed through the clj-webdriver wrapper for Selenium. A chatter can send and receive messages. Chatters can also cancel connections to create connection failures. This tests the basic promise of the BrowserChannel protocol to be resilient to connection failures. At the end of a test there is a check to see if all the messages that have been sent have been received and have been received in the proper order.

The test project currently contains one scenario, but different scenarios can be generated and tested. These scenarios could check different write/read ratios, chatter counts, failure rates and different browsers. The knobs to tune these parameters are in place.

About Joyk

Aggregate valuable and interesting links.
Joyk means Joy of geeK