Grails 2.3.3: test-app on new app fails with "No tests found matching grails test target pattern filter from org.junit.runner.Request"

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Grails 2.3.3: test-app on new app fails with "No tests found matching grails test target pattern filter from org.junit.runner.Request"

matejk
Dear Grails experts,

I recently started a new Grails application with 2.3.3. I wanted to start with test automation from the beginning so a few tests were written.

Unfortunately I always get an error when running the tests:

| Running without daemon...
| Compiling 1 source files
| Compiling 1 source files.
| Running 1 unit test...
| Running 1 unit test... 1 of 1
| Failure:  initializationError(org.junit.runner.manipulation.Filter)
|  java.lang.Exception: No tests found matching grails test target pattern filter from org.junit.runner.Request$1@34155d5b
        at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:35)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:138)
| Completed 1 unit test, 1 failed in 0m 0s
| Tests FAILED  - view reports in /home/matejk/NetBeansProjects/best/target/test-reports
| Error Forked Grails VM exited with error

I created a fresh application with one domain class (grails create-domain-class). Empty unit test file was created as well.

I ran grails test-app, which should execute single auto-generated test case but I got the aforementioned error as well.

Environment: Ubuntu Linux 13.10 64-bit, Oracle JDK 7u45, Grails 2.3.3.

Do I have to configure anything before running the tests?

Please help.

Regards,

Matej
Reply | Threaded
Open this post in threaded view
|

Re: Grails 2.3.3: test-app on new app fails with "No tests found matching grails test target pattern filter from org.junit.runner.Request"

Graeme Rocher-2
Your test actually needs to test something otherwise you will get this error


On Tue, Dec 3, 2013 at 9:24 AM, matejk <[hidden email]> wrote:
Dear Grails experts,

I recently started a new Grails application with 2.3.3. I wanted to start
with test automation from the beginning so a few tests were written.

Unfortunately I always get an error when running the tests:

| Running without daemon...
| Compiling 1 source files
| Compiling 1 source files.
| Running 1 unit test...
| Running 1 unit test... 1 of 1
| Failure:  initializationError(org.junit.runner.manipulation.Filter)
|  java.lang.Exception: No tests found matching grails test target pattern
filter from org.junit.runner.Request$1@34155d5b
        at
org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:35)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:138)
| Completed 1 unit test, 1 failed in 0m 0s
| Tests FAILED  - view reports in
/home/matejk/NetBeansProjects/best/target/test-reports
| Error Forked Grails VM exited with error

I created a fresh application with one domain class (grails
create-domain-class). Empty unit test file was created as well.

I ran grails test-app, which should execute single auto-generated test case
but I got the aforementioned error as well.

Environment: Ubuntu Linux 13.10 64-bit, Oracle JDK 7u45, Grails 2.3.3.

Do I have to configure anything before running the tests?

Please help.

Regards,

Matej




--
View this message in context: http://grails.1312388.n4.nabble.com/Grails-2-3-3-test-app-on-new-app-fails-with-No-tests-found-matching-grails-test-target-pattern-filte-tp4652128.html
Sent from the Grails - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email





--
Graeme Rocher
Grails Project Lead
SpringSource
Reply | Threaded
Open this post in threaded view
|

Re: Grails 2.3.3: test-app on new app fails with "No tests found matching grails test target pattern filter from org.junit.runner.Request"

matejk
Thanks, Graeme,

It turned out that the tests used JUnit syntax. I didn't realize that Grails 2.3 defaults to Spock.

The error message was not very helpful though.

Regards,

Matej
Reply | Threaded
Open this post in threaded view
|

Re: Grails 2.3.3: test-app on new app fails with "No tests found matching grails test target pattern filter from org.junit.runner.Request"

Chry07
This post was updated on .
matejk wrote
Thanks, Graeme,

It turned out that the tests used JUnit syntax. I didn't realize that Grails 2.3 defaults to Spock.

The error message was not very helpful though.

Regards,

Matej
How did you resolve this?
Reply | Threaded
Open this post in threaded view
|

Re: Grails 2.3.3: test-app on new app fails with "No tests found matching grails test target pattern filter from org.junit.runner.Request"

rushidesai
In reply to this post by matejk
How did you solve the problem?
I am having the same issue.
Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Grails 2.3.3: test-app on new app fails with "No tests found matching grails test target pattern filter from org.junit.runner.Request"

QualcommLisa
I get this same error while trying to follow the steps in "The Definitive Guide to Grails 2" - Creating Your First Application.  
NOTE:  Using Grails 2.4.3.
Reply | Threaded
Open this post in threaded view
|

Re: Grails 2.3.3: test-app on new app fails with "No tests found matching grails test target pattern filter from org.junit.runner.Request"

QualcommLisa
I found the suggestion on another thread to add the "given: when: then:" sections to the StoreControllerSpec.groovy file and that worked. http://grails.org/doc/2.3.7/guide/testing.html 

However, I still get:  Error running script test-app unit:: org.codehaus.groovy.grails.cli.ScriptExitException
Reply | Threaded
Open this post in threaded view
|

Re: Grails 2.3.3: test-app on new app fails with "No tests found matching grails test target pattern filter from org.junit.runner.Request"

grailskev
I was also following the Grails in action book and had this issue.

It's because when creating the Domain class a skeleton unit test was also created:

/test/unit/com/grailsinaction/UserTests.groovy

The book works through an integration test, not a unit test. You need to delete UserTests.groovy to prevent this error.

Reply | Threaded
Open this post in threaded view
|

Re: Grails 2.3.3: test-app on new app fails with "No tests found matching grails test target pattern filter from org.junit.runner.Request"

pbergthold
In reply to this post by Chry07
If you were following the book you should have noticed the differences

@TestFor(Race)
class RaceSpec extends Specification {

    def setup() {
    }

    def cleanup() {
    }


        void testInMiles() {
                given: "test given"
                def race = new Race(distance: 5.0)
                assertEquals 3.107, race.inMiles()
               
                when: "test when"
                //...
                then: "test then"
                //...
               
        }
       
}

all you have to add to the code is "given:" for it to run properly

ps

I know this is an old thread now but i didn't see any clear answers and found this in an archived thread with more errors than this alone and no explanation to the solution