简体   繁体   中英

Maven does not run Spock tests

I'm trying to test my maven app using Spock. But mvn test does not run my test.

[INFO] No tests to run.

I tried to name test file like *Test , Test* and *TestCase but it does not work. Intellij run tests correctly and count code covers.

在此处输入图片说明

Also when I run mvn sonar:sonar SonarQuebe does not see tests.

Pom.xml

    <dependency>
        <groupId>org.spockframework</groupId>
        <artifactId>spock-core</artifactId>
        <version>0.6-groovy-1.8</version>
        <scope>test</scope>
    </dependency>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.16</version>
        </plugin>

It's modular maven project. I'm trying to test one of few module.

Here you can find an exemplar POM with spock settings:

https://code.google.com/p/spock/wiki/HelloSpockPom

Your tests are Groovy files. You need to configure surefire , so that it works with the Groovy language.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM