During JavaScript refactoring, I hope to introduce an easy-to-use testing framework to ensure smooth refactoring. In the future, I will continue to use the testing code to ensure the correctness of the JavaScript logic. JsUnit (http://sourceforge.net/projects/jsunit/,http://www.jsunit.n...
During JavaScript refactoring, I hope to introduce an easy-to-use testing framework to ensure smooth refactoring. In the future, I will continue to use the testing code to ensure the correctness of the JavaScript logic.
Http://sourceforge.net/projects/jsunit/,http://www.jsunit.net/ (JsUnit)
JsUnit is an independent JavaScript unit testing framework, which is similar to JUnit and has no difficulty in getting started, including the traditional setUp and tearDown methods. The assert method provided is similar to JUnit, besides the JavaScript-specific methods such as assertNaN and assertUndefined. The test page must be inIntroduce the jsUnitCore. js file.
Test Suite support: Provides addTestPage and addTestSuite;
Test log support: it includes three log levels: warn, info, and debug. The front-end code is not similar to the background code. Too many logs should not be used in the official code. Besides, log is only supported under FF.
The following is an example:
Js Code