So you've written (or want to write) an awesome Sass toolkit, framework, or even a small function or mixin, and you want to share it with the world. Fantastic! That's what's great about open-source software development -- you get to collaborate on code with other supportive developers in the community to create useful software that many can benefit from.
But, not so fast! It's very important to test your software before releasing it. One of the most efficient ways to do this is with unit tests, which are automated scripts that test if a single function of a single unit of code behaves according to a defined specification.
Sass gives you the ability to manipulate data using functions, operators, variables, and control directives and expressions. The return value of a @function can also be tested directly against the expected value. For CSS output and visual regression testing, a tool like PhantomCSS is better suited for the job, though @mixins can be tested in the latest version of True.
We will be using Eric Suzanne's True testing framework for unit testing sample functions in Sass, but the guidelines presented are applicable for any Sass testing framework. For simple tests, you might want to use a minimalistic (and awesome) Sass testing framework such as Hugo Giraudel's SassyTester.
Continue reading %Creating Tests for Your Sass Framework%
by David Khourshid via SitePoint
No comments:
Post a Comment