How do you unit test a PlayN project?

若如初见. 提交于 2019-12-05 04:21:27

问题


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


回答1:


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>



回答2:


You need to store all yours tests not in src/main, but in src/test.

I used JUnit with this guide: Using Junit




回答3:


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.



来源:https://stackoverflow.com/questions/8954479/how-do-you-unit-test-a-playn-project

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!