I have managed to get basic unit testing working, however when I add a unit test to project-java I get an error of class not found, looking into it it seems when compiling the testing classes, it dosn't copy the main classes from the project-core, does anyone have any idea how to fix this in maven?
Edit:
To make things more clear, I do know where to place the tests, I have placed in project-java/src/tests However What I mean is it doesnt invlude the clases from project-core/src
A better approach is to add your tests to core/src/test/java
and then add a test
dependency on playn-java
to your core/pom.xml
:
<dependency>
<groupId>com.googlecode.playn</groupId>
<artifactId>playn-java</artifactId>
<version>${playn.version}</version>
<scope>test</scope>
</dependency>
You need to store all yours tests not in src/main, but in src/test.
I used JUnit with this guide: Using Junit
I went a different route with this in the end, and actually made a playn-testframework.
a simple playn- project that acted like playn-java etc, but would not render to screen, and had extra callbacks for the tests to use, such as to simulate mouse/keyboard events.