Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable Play! modules tests that get in the way when running an app in test mode?

I've just started playing with Play! framework, and stumbled on such problem: modules that were added as dependencies fail to compile when running the application in the test mode. The pattern of the error repeated 2/2 times up to now. A referenced class belonging to the failed test suite cannot be resolved to a type.

My dependencies.yml file looks like this:

require:
 - play 1.2
 - secure
 - crud
 - play -> cobertura 2.1
 - play -> paginate head
 - play -> messages 1.0
 - play -> i18ntools 1.0.1
#     - play -> scaffold head

As you can see I've already disabled the scaffold module, but the next in the line is paginate. The error appearing right after the first request is the following:

Compilation error
The file {module:paginate-head}/test/play/modules/paginate/MappedPaginatorTest.java could not be compiled. Error raised is : MockModel cannot be resolved to a type

In {module:paginate-head}/test/play/modules/paginate/MappedPaginatorTest.java (around line 16)

12:
13: public class MappedPaginatorTest {
14:     @Test
15:     public void testPaginateByKey() {
16:         Map<String, MockModel> models = new HashMap<String, MockModel>();
17:         List<String> keys = new ArrayList<String>();
18:

The MockModel class is placed in the same directory as MappedPaginatorTest. (The same situation was with the scaffold module.) I use Eclipse to run the app in both modes, but the same error appears when running with play test from the commandline.

I don't insist on fixing the modules to enable their tests. But if it is the only way I can live with that.

like image 717
Rajish Avatar asked Apr 24 '11 22:04

Rajish


2 Answers

I've found a quick hack that enabled me to disable the tests: just rename or delete the test subdirectory from the offending modules directory (play-1.2/modules/paginate-head in my case).

I'm leaving the question unresolved, though, to leave space for resolving it properly: by fixing the modules issue, as omitting the tests from the modules can also cause problems in general.

like image 99
Rajish Avatar answered Dec 06 '22 19:12

Rajish


Well, one answer would be to post this question on Stack Overflow where the author of paginate and scaffold might stumble upon it. Since that author happens to be me, the modules have been updated. It appears that not all the class files were properly exported when the module distributable was built.

like image 41
Lawrence McAlpin Avatar answered Dec 06 '22 19:12

Lawrence McAlpin