A quick fork later and I now have JsUnit 1.3-db. So far, this fork adds:
* Callstack reporting for errors and failures
* Text test result output, not just XML
* File and line numbers in all error messages
* Upgraded Rhino
Previously, if you hit an error, you'd get this:
[INFO] [jsunit2:jsunit-test {execution: test}]Then, you'd have to dig into the
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
target/surefire-reports/TEST-MyTestCase.xml
to find this:<testcase name="TestFieldTest.testRender" time="0.006">Not helpful. Now, you get this:
<error message="ReferenceError: "bar" is not defined." type=""/>
</testcase>
[INFO] [jsunit2:jsunit-test {execution: test}]For fellow Maven folks, you can find the releases at my repo:
TestRunner (1 test cases available)
> Starting test suite "TextFieldTest"
- Running test 1: "TextFieldTest.testRender"
ERROR in TextFieldTest.testRender: ReferenceError: "bar" is not defined. (TextField.js:7)
Stack trace:
1: TextField.js:7
2: TextFieldTest.js:6 (TextFieldTest_testRender)
3: JsUnit.js:827 (TestCase_runTest)
4: JsUnit.js:808 (TestCase_runBare)
5: JsUnit.js:386
6: JsUnit.js:409 (TestResult_runProtected)
7: JsUnit.js:390 (TestResult_run)
8: JsUnit.js:797 (TestCase_run)
9: JsUnit.js:1033 (TestSuite_runTest)
10: JsUnit.js:1014 (TestSuite_run)
11: JsUnit.js:2614 (EmbeddedTextTestRunner_run)
12: Components:4
< Completed test suite "TextFieldTest"
1 error, 0 failures.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
http://twdata-m2-repository.googlecode.com/svn/de/berlios/jsunit/jsunit-maven2-plugin
Did you see the test runner that Shaoting cooked up for JavaScript tests?
ReplyDeletehttp://blogs.atlassian.com/developer/2009/09/run_your_jsunit_tests_as_normal_junit4_tests.html
With this you can run them directly in your IDE using its built in JUnit support.
Nice, we should fold that back into jsunit. It would be nice to get the surefire integration it provides without all the setup that is needed currently with his solution. Since his uses jsunit, I'm guessing it shares the same issues as I found wrt poor error reporting and the lack of call stack reports.
ReplyDeleteyou have a nice site.thanks for sharing this site. various kinds of ebooks are available here
ReplyDeletehttp://feboook.blogspot.com
very useful codes, java script makes website more beautiful and attractive.. please share more codes like this
ReplyDelete