3

I have a pretty complex Polymer Single Page Application. It has things like Facebook login, online ordering via credit card, as well as user profiles, image uploads, services offered, real-time chat, etc. It also has real-time updating via Websockets. The app is made up of 108 custom elements, written in about 13000 lines of code client side and 40000 lines of code server side. The vast majority of the custom elements interact with the server.

At this point, I have several "levels" of testing:

  • Testing the server calls. This is the easy part: I just use Mocha and Chai, and test the end-point of the app as it is.

  • Testing the basic web components. Again, Polymer has a very established testing framework (using Selenium); elements are normally tested using sinon, which will simulate network responses etc. Again, this is a non-issue

  • Testing of the actual app. This is the tricky part: is the online app actually working? For example, it's all fun games, but for the chat to work, you need two different browsers going at the same time, and you need the web-socket connection to be established. You also need to break out of the "testing simulating network connection" mentality, and actually run the tests as a full interaction of the user, from chatting to people to receiving an offer from one of those people, to accepting that offer and paying.

This very last point is the sticky one: does it actually make sense to do it? Are there any examples out there of doing it? Or, is all testing really relegated to simulated network responses?

1 Answer 1

1

I do not think it makes sense to perform tests like opening two browsers and have them chatting against each other. It looks to me that you have step 1 and 2 well covered. What I would do is make some smoke tests to test the most important functionality. Let us say, browse the website and check if all the necessary components are loaded and can be interacted with.

If you were to write a whole test suite for this application, based on the front-end, it will be a PITA to maintain this. The lower the test-level the better.

3
  • I don't know... chat-wise, with steps 1 and 2 all I am doing is checking that the stores take my chat message. How do I know if then all the users with an open websocket and qualify to receive it would then actually receive it?
    – Merc
    Jan 14, 2018 at 0:55
  • You should write an integration test for that. No need to use the front-end. Use an integration test to set up two mocked clients and let them communicate with each other. Jan 17, 2018 at 12:49
  • You mean with Selenium right?
    – Merc
    Jan 18, 2018 at 1:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.