如何使用 Maven 运行协和测试?

发布于 2025-01-07 11:28:06 字数 114 浏览 1 评论 0原文

我想知道如何设置 Maven 来运行具有 FooFixture.java 命名约定的协和测试。测试位于 src/test/specs 中的类路径上。我想在单独的配置文件中执行此操作。

感谢您的帮助。

I am wondering how to set up maven to run concordion tests having a FooFixture.java naming convention. The tests are on the classpath in src/test/specs. I would like to do it in a separate profile.

Thanks for the help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

她说她爱他 2025-01-14 11:28:06

我最终通过创建不同的配置文件来运行验收测试来设置测试。

这里给出一个例子:

        <profile>
        <id>acceptance-test</id>
        <activation>
            <property>
                <name>type</name>
                <value>acceptance</value>
            </property>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>1.7</version>
                    <executions>
                        <execution>
                            <id>add-specs-source</id>
                            <phase>compile</phase>
                            <goals>
                                <goal>add-test-source</goal>
                            </goals>
                            <configuration>
                                <sources>
                                    <source>${basedir}/src/test/specs</source>
                                </sources>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>2.3.1</version>
                    <configuration>
                        <encoding>UTF-8</encoding>
                        <source>1.5</source>
                        <target>1.5</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.11</version>
                    <configuration>
                        <forkMode>pertest</forkMode>
                        <argLine>-Xms1024m -Xmx1024m</argLine>
                        <testFailureIgnore>false</testFailureIgnore>
                        <skip>false</skip>
                        <testSourceDirectory>src/test/specs</testSourceDirectory>
                        <includes>
                            <include>**/*Fixture.java</include>
                        </includes>
                        <systemPropertyVariables>
                            <propertyName>concordion.output.dir</propertyName>
                            <buildDirectory>target/concordion</buildDirectory>
                        </systemPropertyVariables>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>

I finally set the tests up is by creating a different profile to run the acceptance tests.

An example given here:

        <profile>
        <id>acceptance-test</id>
        <activation>
            <property>
                <name>type</name>
                <value>acceptance</value>
            </property>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>1.7</version>
                    <executions>
                        <execution>
                            <id>add-specs-source</id>
                            <phase>compile</phase>
                            <goals>
                                <goal>add-test-source</goal>
                            </goals>
                            <configuration>
                                <sources>
                                    <source>${basedir}/src/test/specs</source>
                                </sources>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>2.3.1</version>
                    <configuration>
                        <encoding>UTF-8</encoding>
                        <source>1.5</source>
                        <target>1.5</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.11</version>
                    <configuration>
                        <forkMode>pertest</forkMode>
                        <argLine>-Xms1024m -Xmx1024m</argLine>
                        <testFailureIgnore>false</testFailureIgnore>
                        <skip>false</skip>
                        <testSourceDirectory>src/test/specs</testSourceDirectory>
                        <includes>
                            <include>**/*Fixture.java</include>
                        </includes>
                        <systemPropertyVariables>
                            <propertyName>concordion.output.dir</propertyName>
                            <buildDirectory>target/concordion</buildDirectory>
                        </systemPropertyVariables>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>
梦情居士 2025-01-14 11:28:06

您可以使用 Maven 故障安全插件在集成测试阶段运行单元 Concordion 测试。它类似于 Surefire 插件。

You can use the maven failsafe plugin to run unit Concordion tests in the integration-test phase. Its similar to the surefire plugin.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文