I'm banging my head against a wall - I have a basically empty test file (its more to test my build file than anything else
A few months back my build file got corrupted - and for some reason starting a new project didnt fix it, so I had to make one from scratch, initially it just needed to support build, but now it requires test - and it is not working :(
package com.rcdc.questiondatabase;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
public class RCDCServiceTest {
public RCDCServiceTest() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
// TODO add test methods here.
// The methods must be annotated with annotation @Test. For example:
//
@Test
public void testHelloTest() {
if(true){
assertTrue(true);
}
}
}
My build file:
<?xml version="1.0" encoding="UTF-8"?>
<project name="INCAP" default="default" basedir=".">
<description>Builds, tests, and runs the project INCAP.</description>
<property name="build.dir" value="war/WEB-INF/classes"/>
<property name="dist.dir" value="dist"/>
<property name="test.dir" value="test"/>
<property name="test.build.dir" value="testbuild"/>
<path id="project.classpath">
<pathelement path="war/WEB-INF/classes" />
<fileset dir="war/WEB-INF/lib">
<include name="**/*.jar" />
</fileset>
<pathelement path="${java.home}/../lib/tools.jar:${libs.jsp-compiler.classpath}:${libs.jsp-compilation.classpath}"/>
</path>
<path id="project.test.classpath">
<pathelement path="war/WEB-INF/classes" />
<fileset dir="war/WEB-INF/lib">
<include name="**/*.jar" />
</fileset>
<pathelement path="${java.home}/../lib/tools.jar:${libs.jsp-compiler.classpath}:${libs.jsp-compilation.classpath}"/>
</path>
<target name="copyjars" description="Copies the App Engine JARs to the WAR.">
</target>
<target name="clean">
<delete dir="war/WEB-INF/classes"/>
</target>
<target name="compile" depends="copyjars" description="Compiles Java source and copies other source files to the WAR.">
<mkdir dir="${build.dir}" />
<copy todir="${build.dir}">
<fileset dir="src">
<exclude name="**/*.java" />
</fileset>
</copy>
<property name="myclasspath" refid="project.classpath"/>
<echo message="Classpath ${myclasspath}" />
<javac
srcdir="src"
destdir="${build.dir}"
classpathref="project.classpath"
debug="on" />
</target>
<target name="compiletest" depends="compile" description="compile the tests " >
<mkdir dir="${test.build.dir}" />
<javac
srcdir="test"
destdir="${test.build.dir}"
classpathref="project.test.classpath"
debug="on" />
</target>
<target name="dist" depends="compile">
<mkdir dir="war/WEB-INF/classes" />
<copy todir="war/WEB-INF/classes">
<fileset dir="src">
<exclude name="**/*.java" />
</fileset>
</copy>
<property name="myclasspath" refid="project.classpath"/>
</target>
<target name="test" depends="compiletest" description="run the tests " >
<junit printsummary="yes" fork="yes" haltonfailure="yes">
<formatter type="plain"/>
<batchtest fork="true">
<fileset dir="${test.dir}">
<include name="**/*Test*.java"/>
</fileset>
</batchtest>
<classpath refid="project.test.classpath" />
</junit>
</target>
<target name="test-single" depends="compiletest" description="Run a single test">
<fail unless="browser.context" message="Property not set: 'test-class'"/>
<echo message=" -- Running single test --"/>
<echo message=" -- ${browser.context} --" />
<junit printsummary="yes" fork="yes" showoutput="yes" haltonfailure="yes">
<formatter type="plain"/>
<batchtest fork="true">
<fileset dir="test">
<include name="${javac.includes}"/>
</fileset>
</batchtest>
<classpath refid="project.classpath" />
</junit>
</target>
</project>