We have tried to introduce unit testing front end logic on a recent project and the value of the tests are being questioned.
We were not code reviewing the tests so the quality of them is poor, developers copied poor tests creating more poor tests and so we have a lot of crap tests.
I still believe there is value in testing the presenters (we use MVP) but getting people on board with this is more difficult than I originally thought.
How can I get people into thinking front end tests are valuable and has anyone got any good resources to point me to, to back me up with this?
Thanks...
Unit testing This is crucial for any frontend application, testing your components and features against how you expect them to behave in production, leading to a stable codebase and a reliable app for your customers.
Unit tests should contain as little logic as possible For each test, it's important to be as clear as possible about what is being tested. This both helps to make sure the tests do what we expect as well as to help the tests serve as documentation for how the code should be called and should work.
Unit testing front end logic is extremely hard since there are many parts that make it up like server side code changes to the front end and client side changes can all affect how the application appears.
On the Google testing blog they talked about the value of testing all the parts of a MVP and the value of testing AJAX by stubbing the expensive parts here. Misko Hevery talks about the different tests here and I feel that the Front End tests fall into his large test category so always have the chance of false negatives/positives but they need to be sorted because they still offer a lot of value
Front end tests are extremely valuable as they check the user functionality hasn't dropped off. This is why tools like Selenium and Watir are so popular.
Fix the broken window. here is a link to the theory http://en.wikipedia.org/wiki/Fixing_Broken_Windows
A successful strategy for preventing poor code quality is to always keep your code base clean and in prestige condition. This means clean up all the bad code. It might be painful, and time consuming, but you will need to do it anyway.
After we removed all the compile warnings on our project, we found that our code quality has been improving. People start to care what they check in, since we send out a signal that it is not ok to checkin bad code(even warning is not ok), and no one wants to be the first one to break the window.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With