Maven 故障安全系统属性变量

家庭破坏者

systemPropertyVariablesmaven-failsafe-plugin. 在集成阶段运行集成测试时,systemPropertyVariables会正确选取。

当我通过我的 IDE (IntelliJ) 运行单个测试时,systemPropertyVariables也会被选中,但我不想要那样。

有没有办法在不使用 maven 配置文件的情况下防止这种情况发生?

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>3.0.0-M3</version>
                <configuration>
                    <includes>
                        <include>**/*End2EndTest.java</include>
                    </includes>
                    <systemPropertyVariables>
                        <tomcat.host>host</tomcat.host>
                        <tomcat.port>8080</tomcat.port>
                        <tomcat.context>/</tomcat.context>
                        <tests.browser.name>chrome</tests.browser.name>
                        <tests.selenium.grid.address>http://localhost:4444/wd/hub/</tests.selenium.grid.address>
                        <spring.profiles.active>build</spring.profiles.active>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
        </plugins>
     </build>

提前致谢。问候

用户944849

configuration元素处于插件级别,因此它将适用于所有构建。要限制它,请创建一个执行并将配置移入其中。

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>3.0.0-M3</version>
    <configuration>
        <!-- this configuration applies to all builds
             using this plugin, whether by specific
             goal, or phase.  -->
        <includes>
            <include>**/*End2EndTest.java</include>
        </includes>
    </configuration>
    <executions>
        <execution>
            <!-- this configuration only is used if
                 the integration-test phase, or later
                 phase, is executed -->
            <id>integration-test</id>
            <phase>integration-test</phase>
            <goals>
                <goal>integration-test</goal>
            </goals>
            <configuration>
                <systemPropertyVariables>
                    <tomcat.host>host</tomcat.host>
                    <tomcat.port>8080</tomcat.port>
                    <tomcat.context>/</tomcat.context>
                    <tests.browser.name>chrome</tests.browser.name>
                    <tests.selenium.grid.address>http://localhost:4444/wd/hub/</tests.selenium.grid.address>
                    <spring.profiles.active>build</spring.profiles.active>
                </systemPropertyVariables>
            </configuration>
        </execution>
    </executions>    
</plugin>

有了这个:

  • mvn failsafe:integration-test 不会选择系统属性。
  • mvn integration-testmvn verifymvn deploy使用它们。
  • 任何命令都将使用includes.

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Maven故障安全未运行测试

来自分类Dev

Maven故障安全未运行测试

来自分类Dev

Maven故障安全插件总是跳过集成测试

来自分类Dev

Maven故障安全插件意外挂起

来自分类Dev

Maven 集成测试阶段未绑定到故障安全

来自分类Dev

可以用环境变量替换Maven -D系统属性吗?

来自分类Dev

Spring Boot:将系统属性传递给Maven

来自分类Dev

如何查找所有Maven系统属性

来自分类Dev

Maven:如何使用故障安全插件在jar中运行/包含类?

来自分类Dev

Maven故障安全插件:如何使用集成前和集成后测试阶段

来自分类Dev

Maven不会使用故障安全插件运行集成测试

来自分类Dev

Maven故障安全-Dtest报告已写入surefire = reports文件夹

来自分类Dev

Maven故障安全:在其他目录中启动码头

来自分类常见问题

Maven 3.3.1 ECLIPSE:-dmaven.multiModuleProjectDirectory系统属性未设置

来自分类Dev

如何使用系统属性设置Maven POM文件以输入Java中的参数?

来自分类Dev

如何使用系统属性设置Maven POM文件以输入Java中的参数?

来自分类Dev

使用系统属性和静态字段迁移到Maven时,JUnit类加载器出现问题

来自分类Dev

PackagingExcludes和Maven属性变量

来自分类Dev

PackagingExcludes和Maven属性变量

来自分类Dev

故障安全移动命令

来自分类Dev

Maven Jetty插件如何传递系统变量

来自分类Dev

Maven Pom xml变量

来自分类Dev

maven更新pom属性

来自分类Dev

引用列表的Maven属性

来自分类Dev

Maven的:无主清单属性

来自分类Dev

无法读取Maven属性

来自分类Dev

Maven构建模块故障

来自分类Dev

故障安全序列化

来自分类Dev

pyautogui故障安全的目的是什么?