|
From: Peter L. <pet...@go...> - 2008-02-21 22:11:02
|
Hi,
I am seeking a little help getting up and running with JUnit -
hopefully this is the right list.
I have installed the JUnit jar in my extensions folder, and it works
properly, however, when I run it I get the error:
"Could not find class: org.xxx.powersim.ModelTest
Time: 0
OK (0 tests)
Java Result: 1"
ModelTest has been compiled properly, and looks like this:
package org.xxx.powersim;
import org.junit.*;
import static org.junit.Assert.*;
import java.util.*;
public final class ModelTest {
public static void main(String args[]) {
org.junit.runner.JUnitCore.main("org.xxx.powersim.ModelTest");
}
@Test
public void testJunit() {
assertTrue(true);
}
}
Pretty simple stuff.
As you can see I'm trying to use the 'main' method of the test to
execute the test itself... but I've tried running it via the runner
from the command line also: "java org.junit.runner.JUnitCore
org.xxx.powersim.ModelTest". I get the same result.
It might be a package issue, so here's how I have things set up in the
file system:
/PowerSim
/build
/org
/xxx
/powersim
- ModelTest.class
/src
/org
/xxx
/powersim
-ModelTest.java
I've tried running it within Ant, by hand, from within TextMate's
built-in bundle - I get the same result. JUnit is installed and
running fine, but it can't seem to see the test class - the more I
think about it this is a package problem that I'm just not sure how to
fix. I've tried running it by hand in the root /PowerSim directory, in
the /build folder, and in the /powersim class where ModelTest is. I
still get the error that "Could not find class:
org.xxx.powersim.ModelTest". My files compile just fine with my simple
Ant script which is as follows:
<?xml version="1.0"?>
<project name="PowerSim" default="run" basedir=".">
<property name="src" value="./src"/>
<property name="build" value="./build"/>
<property name="compile.debug" value="true"/>
<path id="compile.classpath">
<pathelement location="${mysql.jdbc}"/>
<pathelement location="${junit.jar}"/>
</path>
<target name="build" depends="init">
<javac srcdir="${src}"
destdir="${build}"
debug="${compile.debug}"
source="1.5">
<classpath refid="compile.classpath"/>
</javac>
</target>
<target name="init">
<mkdir dir="${build}"/>
</target>
<target name="run" depends="build">
<java classname="org.xxx.powersim.Model"
fork="true"
dir="${build}"
classpath="${build}"
maxmemory="500m">
</java>
</target>
<target name="test" depends="build">
<java classname="org.xxx.powersim.ModelTest"
fork="yes"
dir="${build}"
classpath="${build}"
maxmemory="500m">
</java>
</target>
<target name="clean" description="Removes previous build">
<delete verbose="true">
<fileset dir="${build}"/>
</delete>
</target>
</project>
As you can see, I'm not sure what to try next - any help would be much
appreciated.
Thanks again,
- Peter
|