Test Sweets is designed to be a portable, flexible, and easy to understand approach to automating javascript tests in the browser and at the command line.
It lives neatly in its own polite folder, sitting carefully as not to disturb the rest of your app, but unlocks a powerful timesaver and fascinating programming challenge.
###Quick Start
Read the Docs to get started using Test Sweets in your application.
- Constant immediate feedback on the state of your application
- An early warning system that catches the worst kind of bugs: silent failures
- A greater sense of confidence when making changes to your codebase
- A goal in life.
- List of sample assertions available in the qUnit test framework
- A sample test runner for rapid cross browser testing
- Configurations for integrating Grunt
- Testing at the command line using PhantomJS
Testing front-end code in web applications is not as straight forward as one would assume. It is very possible to write poor, brittle tests, that cost more time to maintain than any advantages gained from automated testing.
Just like how writing clean and effective code adheres to concepts like "Separation of Concerns" and "Don't Repeat Yourself", your testing philosophy will determine the quality of your test suite.
Every test you write should be able to run individually and in any order. A test should not rudely affect any other test.
One way to achieve this is to append any markup required for the test to the <div id="qunit-fixture"></div>
, which will be magically wiped clean after every test, while waiting dutifully for the next test to run.
Think milliseconds fast. Long winded tests that take several seconds (or worse, minutes) to complete will deter your fellow developers from running the tests on every compile. Speed can be achieved through mocking connections to remote servers, and overriding animation timers to 0 seconds.
Tests should be robust and run obediently until they have something useful to report. They should not be tightly coupled, brittle pieces of code that require constant attention.
###TODO:
Setting up Test Sweets
- Setup Video
Pitfalls that make testing Javascript very difficult
- Tips on writing testable code
Example Project
- Something incredibly chill