ses
ses

Reputation: 13342

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

Upvotes: 8

Views: 5679

Answers (3)

TeaBough
TeaBough

Reputation: 165

What did the trick for me was to use this sbt plugin : https://github.com/mpeltonen/sbt-idea. Using :

sbt gen-idea

Instead of :

play idea

Upvotes: 1

Sig Myers
Sig Myers

Reputation: 371

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.

Upvotes: 5

Sven Müller
Sven Müller

Reputation: 11

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.

Upvotes: 1

Related Questions