您如何对PlayN项目进行单元测试? [英] How do you unit test a PlayN project?
问题描述
我已经设法使基本的单元测试正常工作,但是当我将单元测试添加到project-java时,我发现了未找到类的错误,在编译测试类时调查它似乎并没有复制项目核心中的主要类,有没有人知道如何在Maven中解决此问题?
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?
为了使事情更清楚,我确实知道将测试放在哪里,我已经放置在project-java/src/tests中.但是,我的意思是,它并不包含来自project-core/src的内容
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
推荐答案
更好的方法是将测试添加到core/src/test/java
,然后将对playn-java
的test
依赖项添加到core/pom.xml
:
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>
这篇关于您如何对PlayN项目进行单元测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!