Giter Site home page Giter Site logo

rhinounit's People

Watchers

 avatar

rhinounit's Issues

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

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 [email protected] on 26 Oct 2009 at 1:16

PriivilegedActionException only if a test fails

What steps will reproduce the problem?
1. Run any test that fails.

What is the expected output? What do you see instead?
I expect only a brief description of the test failure.
What I see is that plus a stack trace.

What version of the product are you using? On what operating system?
1.2.1 on Mac OS X Leopard

Please provide any additional information below.
Here's the stack trace.

[rhinounit] Oct 25, 2009 8:26:46 PM org.apache.bsf.BSFManager exec
[rhinounit] SEVERE: Exception :
[rhinounit] java.security.PrivilegedActionException: 
org.apache.bsf.BSFException: JavaScript Error: Internal Error: RhinoUnit 
failed.
[rhinounit]     at java.security.AccessController.doPrivileged(Native Method)
[rhinounit]     at org.apache.bsf.BSFManager.exec(BSFManager.java:491)
[rhinounit]     at 
org.apache.tools.ant.util.optional.ScriptRunner.executeScript(ScriptRunner.j
ava:103)
[rhinounit]     at 
org.apache.tools.ant.taskdefs.optional.script.ScriptDef.executeScript(Script
Def.java:347)
[rhinounit]     at 
org.apache.tools.ant.taskdefs.optional.script.ScriptDefBase.execute(ScriptD
efBase.java:50)
[rhinounit]     at 
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[rhinounit]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method)
[rhinounit]     at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja
va:39)
[rhinounit]     at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
orImpl.java:25)
[rhinounit]     at java.lang.reflect.Method.invoke(Method.java:585)
[rhinounit]     at 
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
[rhinounit]     at org.apache.tools.ant.Task.perform(Task.java:348)
[rhinounit]     at org.apache.tools.ant.Target.execute(Target.java:357)
[rhinounit]     at org.apache.tools.ant.Target.performTasks(Target.java:385)
[rhinounit]     at 
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
[rhinounit]     at 
org.apache.tools.ant.Project.executeTarget(Project.java:1298)
[rhinounit]     at 
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecut
or.java:41)
[rhinounit]     at 
org.apache.tools.ant.Project.executeTargets(Project.java:1181)
[rhinounit]     at org.apache.tools.ant.Main.runBuild(Main.java:698)
[rhinounit]     at org.apache.tools.ant.Main.startAnt(Main.java:199)
[rhinounit]     at 
org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
[rhinounit]     at 
org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
[rhinounit] Caused by: org.apache.bsf.BSFException: JavaScript Error: 
Internal Error: RhinoUnit failed.
[rhinounit]     at 
org.apache.bsf.engines.javascript.JavaScriptEngine.handleError(JavaScriptEn
gine.java:195)
[rhinounit]     at 
org.apache.bsf.engines.javascript.JavaScriptEngine.eval(JavaScriptEngine.jav
a:147)
[rhinounit]     at 
org.apache.bsf.util.BSFEngineImpl.exec(BSFEngineImpl.java:141)
[rhinounit]     at org.apache.bsf.BSFManager$6.run(BSFManager.java:493)
[rhinounit]     ... 22 more

Original issue reported on code.google.com by [email protected] on 26 Oct 2009 at 1:35

rhinoUnitAnt.js depends on specific filesystem layout and working directory

The rhinoUnitAnt.js script expects that the working directory have a
subdirectory called src and that rhinoUnitUtil.js will be in that
directory. That makes rhinoUnitAnt.js a bit too inflexible for my project
(and I imagine others).

What steps will reproduce the problem?
1. Set up a project where rhinoUnitAnt.js and rhinoUnitUtil.js are in a
lib/rhinoUnit subdirectory.
2. Configure your scriptdef to point to the rhinoUnitAnt.js in that
directory: <scriptdef name="rhinounit" src=lib/rhinounit/rhinoUnitAnt.js"
language="javascript"> ...
3. Run rhinounit tests.

What is the expected output? What do you see instead?

Tests should be able to run normally.  Instead:

[rhinounit] SEVERE: Exception :
[rhinounit] java.security.PrivilegedActionException:
org.apache.bsf.BSFException: JavaScript Error: java.io.FileNotFound
Exception: src\rhinoUnitUtil.js (The system cannot find the file specified)

I hacked up the script locally to take an attribute specifying the source
directory for rhinounit and loading it from there if set. Here's the code
snippet which you are free to use (no warranties of any kind):

var srcDirectory = attributes.get("rhinounitsrc") ?
attributes.get("rhinounitsrc") : "src";
self.log("Looking for rhinoUnitUtil.js in " + srcDirectory, 0);
var rhinoUnitUtilSrc = new File(srcDirectory,"rhinoUnitUtil.js");
if( ! rhinoUnitUtilSrc.exists() )
    self.log("Could not find rhinoUnitUtil source: " + rhinoUnitUtilSrc, 0);
eval(loadFile(rhinoUnitUtilSrc));

Note, there may be a better way to do this, but this seemed to work fine
for my purposes.

Original issue reported on code.google.com by [email protected] on 26 Aug 2008 at 9:36

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.