FS Testing under JNode
Hi, I've sort of lagged my participation in JNode, but I'm still hoping to contribute. I'm stuck in a rut trying to debug code that I've written. I'm having lots of trouble trying to get a JUnit UnitTest to work under JNode. Tests that don't use JUnit work. I'm curious if someone else can run this unittest on their JNode machine. Can some one try it out on their machine and give me the results? I want to see if there is something wrong with my machine?
Thanks
Charlie
package org.jnode.test;
import junit.framework.TestCase;
import junit.framework.Test;
import junit.framework.TestSuite;
public class RecursionTest extends TestCase {
protected void setUp() throws Exception {
super.setUp();
}
protected void tearDown() throws Exception {
super.tearDown();
}
private int recurseAdd( int number ) {
if( number <= 0 ) return 0;
return number + recurseAdd( number - 1 );
}
public void testRecursion() {
assertEquals( "Assert recurseAdd(5) == 15", 15, recurseAdd(5) );
assertEquals( "Assert recurseAdd(10) == 55", 55, recurseAdd(10) );
assertEquals( "Assert recurseAdd(100) == 5050", 5050, recurseAdd(100) );
assertEquals( "Assert recurseAdd(0) == 0", 0, recurseAdd(0) );
assertEquals( "Assert recurseAdd(-1) == 0", 0, recurseAdd(-1) );
}
public static Test suite() {
return new TestSuite(RecursionTest.class);
}
public static void main(String[] args) {
junit.textui.TestRunner.run(suite());
}
}
--------------------------org.jnode.test.xml------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
- Login to post comments
I can't run JUnit test under JNode
I type test org.jnode.test.fs.GeometryTest
and I have a message like NoClassDefFoundError junit.textui.TestRunner
Has anyone succefully tested a JUnit test under JNode ?
Load the plugin at runtime
You can now load the junit plugin at runtime. (with a small fix)
Copy org.junit_3.8.jar to org.junit_0.1.6.jar (you cannot specify the plugin version yet)
like:
> plugin addloader
> plugin load org.junit
It don't work for me
I tried plugin addloader http://127.0.0.1 and plugin addloader http://localhost
and typed the second line (plugin load org.junit), I have a PriviledgeActionException org.junit version 0.1.6 not found
wrong url
Try loading it from the server. 127.0.0.1 os the localhost, which does not contain this plugin (and does no run a webserver).
Ewout
running junit ....what's wrong ?
If I understand well 'plugin load' and 'plugin addloader' are only for downloading a plugin from a remote computer (that runs a server).
I thought that because junit.jar is in JNode eclipse workspace It is also in the generated ISO. But it seems it is not declared as a plugin or not configured as needed.
I have declared org.junit as a plugin, but it's in the 'state inactive'.
So, I typed
plugin start org.junit
and I have a PriviledgedActionException: no matching syntax found
When I try to run the GeometryTest with
test org.jnode.test.fs.GeometryTest
I have a NoClassDefFoundError junit.textui.TestRunner
What must I do ? Is it because junit is not in the classpath and/or the security that is not properly defined ?
I have successfully installed my new command and run it (with only a System.out.println). But, if I try to use junit by using their TestRunner I have a NoClassDefFoundError junit.textui.TestRunner
Has worked....
JUnit has worked in the past, but I'll give it a try this weekend.