sairaasam / rhinounit

Automatically exported from code.google.com/p/rhinounit
0 stars 0 forks source link

Error obtaining Rhino Unit stack trace when unit test fails, execution interrupts #3

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. I have a rhino unit test that fails
2. I'm running this unit test through ant integration
3. When unit test fails, execution interrupts with framework error. No
further unit tests are executed

What is the expected output? What do you see instead?
When a Rhino Unit test fails, stacktrace is expected in the output.
Following error is logged instead:
<path-to>build.xml:105: javax.script.ScriptException:
sun.org.mozilla.javascript.internal.EcmaError: ReferenceError:
"getStackTraceFromRhinoException" is not defined. (<Unknown source>#100) in
<Unknown source> at line number 100

What version of the product are you using? On what operating system?
I use latest version: 1.2.1, on Windows XP.

Please provide any additional information below.
getStackTraceFromRhinoException (and
extractScriptStackTraceFromFullStackTrace) are available in
rhinoUnitUtil.js but inside of function Assert (actually inside of function
assert.callStack). If you copy these 2 methods to the top level of the
rhinoUnitUtil.js, stack trace is printed fine and execution continues to
the next unit test.

Example of stacktrace and test statistics I get:
[rhinounit] Error: testSetExpiredXDFalse, Reason: TypeError: Cannot call
method "getName" of undefined
[rhinounit] The line number of the error within the file being tested is
probably > 164 <
[rhinounit] at script(<Unknown source>#173(eval)#4(eval):164)
[rhinounit] at script(<Unknown source>#173(eval)#4(eval):248)
[rhinounit] at script.testSetExpiredXDFalse(<Unknown source>#173(eval):167)
[rhinounit] at script.executeTest(<Unknown source>:115)
[rhinounit] at script.executeTestCases(<Unknown source>:161)
[rhinounit] at script.runTest(<Unknown source>:179)
[rhinounit]
[rhinounit] Tests run: 8, Failures: 0, Errors: 1

Line numbers in stacktrace - 164 and 248 - point to line numbers in the
tested js file.

Original issue reported on code.google.com by aleksey....@gmail.com on 26 Oct 2009 at 1:16

GoogleCodeExporter commented 9 years ago
Hi.

Not sure how this happened, will look into it and fix it soon.

Original comment by tiestvi...@gmail.com on 26 Oct 2009 at 4:58

GoogleCodeExporter commented 9 years ago
Tiest, do you have an estimate on this?

Original comment by aleksey....@gmail.com on 16 Dec 2009 at 4:59

GoogleCodeExporter commented 9 years ago
Same problem here.  Do you have an estimate on this?

Original comment by scottbur...@gmail.com on 12 May 2010 at 1:49

GoogleCodeExporter commented 9 years ago
I patched this in my version by moving functions 
getStackTraceFromRhinoException and
extractScriptStackTraceFromFullStackTrace to global scope.  

I copied them to the top of the file rhinoUnitUtil.

This seems to work for me.

Original comment by scottbur...@gmail.com on 15 May 2010 at 8:32