Unit Testing CSS
This workshop gives an overview of unit testing, especially Test Driven Development and also shows that CSS can also be unit tested.
Those who have written unit tests would know how much confidence it gives to the developers and how much it impacts maintainability due to frequent refactoring. And needless to say the faster feedback cycle it gives by following the “Red-Green-Refactoring”.
But for CSS usually the practice is to rely on end to end tools such as Selenium, which are brittle and slow.
It will be a live coding session, based on the Sample setup which uses:
- Quixote - Library for Unit Testing CSS
- Karma - the Test Runner, to run the tests across multiple web browsers, including mobile browsers
The format of the session will be:
- Introduction to Unit Testing, specifically TDD, why its so important
- Unit test [2-3 trivial cases where CSS have logic, such as display block/none, position attribute with fixed value etc.]
- Test Driving some of the CSS3 tricks, mentioned in https://github.com/rupl/fun-games-css
- Introduction to tools like wraith, which can be used in complement to unit testing, for end to end testing including responsiveness
- Suggestions on how to help the participants apply the above learnings on their daily work