Menu

#504 JUnit Classes not Tested

4: Serious
open
nobody
5
2006-06-12
2006-06-12
No

I am running into a recurring problem when creating new
JUnit tests from the DrJava file menu. Why I try to
test the class with the test button, I am informed that
no JUnit tests are open / compiled (even though they
are test cases and are compiled). Normally this means
that the package statement does not follow the files
system structure (which really should have a different
error message) but in all these cases the structure is
correct, and I am also able to manually invoke the test
methods from the interactions pane. I can also confirm
that these "untestable" test cases test fine when
invoked by ant.

Sometimes the problem can be resolved by doing a "Save
As" and renaming the class (leaving all other aspects
of the class unchanged). Sometimes not.

Discussion

  • R. Matt Barnett

    R. Matt Barnett - 2006-06-12

    Logged In: YES
    user_id=833303

    This may be related:

    From the interactions pane:

    Welcome to DrJava.
    > import config.java.custom.scheduledtasks.*;

    > junit.textui.TestRunner.run(new CALSupplierPullTester());

    .F

    Time: 0.453

    There was 1 failure:

    1)
    null(config.java.custom.scheduledtasks.CALSupplierPullTester)junit.framework.AssertionFailedError

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
    Source)

    at
    koala.dynamicjava.interpreter.EvaluationVisitor.visit(EvaluationVisitor.java:1105)

    at
    edu.rice.cs.drjava.model.repl.EvaluationVisitorExtension.visit(EvaluationVisitorExtension.java:266)

    at
    koala.dynamicjava.tree.StaticMethodCall.acceptVisitor(StaticMethodCall.java:109)

    at
    edu.rice.cs.drjava.model.repl.DynamicJavaAdapter$InterpreterExtension.interpret(DynamicJavaAdapter.java:428)

    at
    edu.rice.cs.drjava.model.repl.DynamicJavaAdapter.interpret(DynamicJavaAdapter.java:92)

    at
    edu.rice.cs.drjava.model.repl.newjvm.InterpreterJVM$4.run(InterpreterJVM.java:253)

    FAILURES!!!

    Tests run: 1, Failures: 1, Errors: 0

    for the test:

    **
    * A JUnit test case class.
    * Every method starting with the word "test" will be called
    when running
    * the test with JUnit.
    */
    public class CALSupplierPullTester extends TestCase {

    /**
    * A test method.
    * (Replace "X" with a name describing the test. You may
    write as
    * many "testSomething" methods in this class as you wish,
    and each
    * one will be called when running JUnit over this class.)
    */
    public void testGetColumnIndexes() //throws Exception
    {
    }

    }

     
  • Robert Cartwright

    Logged In: YES
    user_id=430590

    There is an checkbox in the miscellaneous properties panel
    (in DrJava Preferences) that requires test class names in
    projects to end in the letters "Test". Make sure that this
    box is not checked.

    It would really help if you could give a scenario to follow
    to reproduce the bug, e.g., project jar file and a
    description of what new test to create.

     
  • Robert Cartwright

    Logged In: YES
    user_id=430590

    I cannot reproduce this bug using the latest build. I would
    be more confident that we have fixed this bug if I had a
    step-by-step scenario that I could follow to generate the
    bug using the 10-June beta release.

    -- Corky

     
  • Nobody/Anonymous

    Logged In: NO

    In my situation it was enumeration classes that caused the problem. I solved it by putting them as inner classes in a normal class..

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.