This works similarly to other nUnit testing frameworks, though somewhat customized for javascript. It is exceedingly small, but also surprisingly powerful.
Go to HowToWriteAndRunTests to learn how to use this framework.
Ant Based Javascript Testing Framework
In its original form RhinoUnit is run from an ANT scriptdef task using the Rhino engine - and uses all the helpful things that ANT provides for that. It is intended, however, that in the future the framework can be reused in other forms.
Unit Testing Javascript
It will do all the normal tests
- string and object comparisons
- regexp comparisons
- collection comparisons (contains, containsExactly, etc)
And does them in a more natural form. For example assert.that("string", not(matches(/somethingelse/))); checks that the string "string" doesn't match the regular expression /somethingelse/.
Advanced Tests
RhinoUnit provides some more advanced tests. You can
- ensure that a function has been called (by wrapping it with assert.mustCall(), or using an assert.functionThatMustBeCalled()). See AssertMustCall
- ensure that an exception is thrown (using shouldThrowException(...)
- ensure that the global namespace isn't polluted by poor variable scoping
See APIDescription for a list of all assertions and functions that are available.
'프로그래밍 > Script' 카테고리의 다른 글
[jQuery] Free jQuery Slideshows and Carousels (0) | 2013.09.23 |
---|---|
[javascript] TogetherJS: Easy collaboration for your website (0) | 2013.09.23 |
[jQuery] 모든 라디오버튼, 체크박스 클릭시 로그인하라는 경고 보여주시 (0) | 2013.09.13 |
[jquery] 영문만, 숫자만, 한글만 입력. (0) | 2013.09.12 |
[jQuery] jQuery.textcomplete: Autocomplete for textarea, 자동완성 (0) | 2013.09.12 |