仅在Maven exec上运行集成测试
我只想使用GrailsMaven插件运行集成测试。我设置了一个配置文件来运行exec命令,如下所示:仅在Maven exec上运行集成测试,maven,grails,grails-maven,Maven,Grails,Grails Maven,我只想使用GrailsMaven插件运行集成测试。我设置了一个配置文件来运行exec命令,如下所示: <profile> <id>run-tests</id> <build> <plugins> <plugin> <groupId>org.grails</groupId>
<profile>
<id>run-tests</id>
<build>
<plugins>
<plugin>
<groupId>org.grails</groupId>
<artifactId>grails-maven-plugin</artifactId>
<version>${grails.version}</version>
<executions>
<execution>
<id>grails-integration-tests</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<command>test-app</command>
<env>integration</env>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
这引发了:
BasicLazyInitializer: Javassist Enhancement failed: <my classes in integration tests>
groovy.lang.MissingPropertyException: No such property: hasProperty for class: groovy.lang.MetaClassImpl
BasicLazyInitializer:Javassist增强失败:
groovy.lang.MissingPropertyException:没有这样的属性:类:groovy.lang.MetaClassImpl的hasProperty
因此,基本上我需要弄清楚如何将参数
integration:
传递到maven exec中,但我认为maven不喜欢冒号 您是否尝试过-integration
?它抛出相同的错误,但随后继续并按预期运行集成测试。作为旁注,当我在没有args标记的情况下运行时,它会运行单元测试和集成测试,不会出现任何错误。我想我最终会跳过默认的maven测试阶段,该阶段使用-DskipTests=true
运行单元测试,并让exec同时运行单元测试和集成测试。谢谢你的帮助@dmahapatro!如果需要,您也只能使用此命令运行集成测试:mvn grails:exec-Dcommand=test app-Dargs=“-integration”
BasicLazyInitializer: Javassist Enhancement failed: <my classes in integration tests>
groovy.lang.MissingPropertyException: No such property: hasProperty for class: groovy.lang.MetaClassImpl