Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Play Framework 2 running JUnit tests in Intellij IDEA

I use Play Framework 2.0.4 and Java + IntelliJ IDEA.

Try to launch tests from IDEA, and having error like this:

Class not found: "models.SoftwareTest"

Here is the test itself.

package models;

    public class SoftwareTest {

        @Test
        public void findById() {
            running(fakeApplication(), new Runnable() {
                @Override
                public void run() {
                    Software software1 = Software.find.byId(1L);
                    assertThat(software1.name).isEqualTo("Soft1");
                    assertThat(software1.description).isEqualTo("Description1");
                }
            });
        }
    }

Anyone?

P.S. I've already cleaned all project/ivy files, having switched from play 2.0.4 to 2.1 RC1 and back.. it does not help. But it was working one day in the past. And I found a lot of records about this in Google, but could not find the answer yet.

Also I've checked out this article (related to Ebean and testing):

http://blog.matthieuguillermin.fr/2012/03/unit-testing-tricks-for-play-2-0-and-ebean/

But the problem I have now it's different one. But just share this link here, it could help to reproduce the problem.

And this: http://monocaffe.blogspot.com.es/2012/12/play-21-rc1-migration-mini-guide.html

like image 811
ses Avatar asked Dec 31 '12 23:12

ses


People also ask

Which unit testing framework does IntelliJ support?

PHPUnitUltimate. IntelliJ IDEA supports unit testing of PHP applications through integration with the PHPUnit testing framework.


2 Answers

Sven's link (http://youtrack.jetbrains.com/issue/SCL-5152) led me to the answer to compile / run unit tests in Intellij 12 with Play framework 2.1.1 [sorry, don't have Play 1.x installed anymore].

From the menu bar [OSX -- likely similar for other platforms] navigate to: IntelliJ -> Preferences -> Compiler

Uncheck the "use external build" and voila, my unit tests were able to run.

like image 199
Sig Myers Avatar answered Sep 23 '22 06:09

Sig Myers


I'm using play 1.2.5 with Intellii IDEA 12.0.1 and also get this error (followed step by step the play doc to create the project files).

I found this issue in the tracking system.

like image 43
Sven Müller Avatar answered Sep 19 '22 06:09

Sven Müller