Im trying to code in DrJava, I keep gettin an error message when i go
to run a junit test that i wrote. it says that there are no open Junit
test cases and to check and make sure that my files have been compiled
and are subclasses of junit.testcase.
I've inserted import.junit.TestCase and the extends TestCase into 1,
both, the other file in every way imaginable and it still gives me the
same error. I've asked my programming professor about it and he says
its a bug, which doesnt help me at all. Is it really a bug with
DrJava? Or is there actually a way to fix this? Please help. |
Request for Question Clarification by
maniac-ga
on
10 May 2006 20:16 PDT
Hello Wolfrr,
Hmm. Did you create the test cases using the "New Junit Test Case" menu option?
This (along with an explanation of the test methods) is described in
the tutorial at
http://cnx.org/content/m11707/1.4/
I followed the step by step instructions in this tutorial and the
testing works OK on my system. If this does not fix your problem on
your system, please explain the errors you are getting so I can do
further research. If it works, let me know as well so I can prepare a
proper answer.
--Maniac
|
Clarification of Question by
wolfrr-ga
on
11 May 2006 13:54 PDT
I too have tried rewriting my code with the drJava test case function,
but it does not help. I would normally believe that I am missing
something, however the code I have tests properly on the unix machines
at my school, just not on my computer.
the message that i get reads as follows:
"TEST WORKS ONLY ON JUNIT TEST CASES
There are no open Junit test cases, pleas make sure that:
-The documents containing tests have been compiled.
-They are subclasses of junit.framework.TestCase.
For more information on writing Junit Test Cases, view the
Junit chapter in the user documentation."
i'm using windowsXP as my OS, perhaps there is some file that drJava
can't find that I must add to its classpaths?
|
Request for Question Clarification by
maniac-ga
on
12 May 2006 08:46 PDT
Hello Wolfrr,
Hmm. I believe you are correct that something is not quite set up
correctly in DrJava (or in the SDK). I also noticed in the FAQ at
http://drjava.sourceforge.net/faq.shtml
you have to be careful about DrJava and SDK versions - an obsolete
version or mismatch (between JRE and SDK) may cause problems.
I don't have access to an XP machine, but I started over on a Windows
2000 system and was able to do the tutorial (referenced before)
successfully by following the steps listed below:
[0] I made sure I did not have any Java runtime was running (no Java
icon in the task bar).
[1] Downloaded and installed the J2SE SDK 5.0 with Update 6.
http://java.sun.com/j2se/1.5.0/download.jsp
(I did not select the NetBeans version - since we're using DrJava as the IDE).
When presented the list of items to install, I made sure everything
was selected. At a later step, it asked if I wanted to reinstall the
JRE (I had that already installed) - I said no. [In your case, it
might be better to say "yes"]
[at this point on my system, the SDK is in java/SDK..., the matching
JRE is in java/JRE...]
[2] Downloaded and installed the DrJava Windows application.
http://drjava.org/
I selected the stable version (not the beta version).
During install, DrJava did not find the SDK and I had to manually
select the tools.jar file in the SDK library directory.
At this point, DrJava came up and indicated it was working with Javac
1.5.0 (lower right).
[3] I created the "MyClass.java" file as indicated in the tutorial in
an empty folder. Saved & compiled w/o error.
[4] I created the "test_MyClass.java" file as indicated in the
tutorial (same folder). Saved & compiled w/o error.
[5] Selecting "Test" in the upper right, ran the test cases with the
expected result (failed first test, second passed, ...).
Please try this sequence and see if it works with your system.
At this point, if you still have problems with your existing files, I
suggest creating a new pair of files:
- the program you are developing (copy / paste code from your existing file)
- the test program (copy / paste contents from your existing file)
then save / compile / test and see if that corrects the problem.
--Maniac
|