How to disable Play! unit tests that interfere with the application launch in test mode?

I just started playing with Play! Framework and came across such a problem: modules that were added as dependencies cannot be compiled when the application starts in test mode. The error pattern is repeated 2/2 times to date. A related class that belongs to an unsuccessful 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 have already disabled the scaffold module, but the next one on the paginate line. The error that appears immediately after the first request is as follows:

 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 MockModel placed in the same directory as the MappedPaginatorTest . (The same situation was with the scaffold module.) I use Eclipse to run the application in both modes, but when I start with play test from the command line, the same error appears.

I do not insist on installing modules for testing them. But if this is the only way, I can live with it.

+6
source share
3 answers

Well, one answer would be to post this question on Stack Overflow, where the author of paginate and scaffold might stumble upon it. Since this author turned out to be me, the modules have been updated. It seems that not all class files were correctly exported when building the module.

+1
source

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

I leave the question unresolved, however, leaving room for its correct solution: eliminating the problem with modules, since excluding tests from modules can also cause problems in general.

+2
source

This should be a problem with porting from 1.1 to 2.1 . Not all playback modules have migrated for playback 2.1. Removing the test directory may solve the problem, but be very careful, because the behavior of the module may be different in test mode in 2.1.

We had the same problem with the guice 1.1.1 module, and even if we deleted the sample directory, some of our test cases failed.

We decided to return to version 1.1 and wait a few weeks / months to update the module.

0
source

Source: https://habr.com/ru/post/886592/


All Articles