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. The vast majority of the custom elements interact with the server.
In terms of client-side, While the 8 custom elements I wrote are fully tested, writing tests for the app as a whole is much harder. Tests only really make sense following a workflow where two users join as "providers", and then a "customer" adds a booking, chats with those performers, and eventually finalises a booking. The 108 custom elements don't really mean much on their own.
The server side is another story: it's made up of 43 HTTP endpoints written in node, where each one can implement GET, POST, PUT and DELETE. While the library that makes up these stores is tested, the stores themselves aren't.
Here is the point list from hell:
- It should be possible to virtually interact with the server. I am thinking for example of using a headless Chrome?
- Interaction with the server must be tested as well. That is, the server must return meaningful, correct results
- Some kind of "automatic" test writing would be very ideal. For example having an interaction with the server, with the testing subsystem logging the calls and the results
- Testing UI results would be amazing too. I clicked on this button: does the UI "look" right? (OK, this could be very tricky to say the least)
- Is should be possible to test things like Facebook login, credit card transactions, etc. I guess this would be done using dummy calls from the remote "servers"... but how?
I guess it boils down to: how on earth do you write meaningful tests for a SPA in (nearly) 2018?
Aucun commentaire:
Enregistrer un commentaire