从Maven命令行TestNG更改.properties值

问题描述

我的项目是基于maven + TestNG + Selenium的项目,我们的要求是从maven命令行编辑 src / test / resources / collector.properties 中存在的属性文件的值。请注意,我们有多个属性文件,只需要在属性文件下进行编辑

例如: mvn test -Dtest = ScenarioLogin#Login -Dreport.host = http://10.120.100.70:2023 / api / reports / -Dreport.token = akjfs3425645XXXX

使用上述命令,我应该能够更新以下值

collector.properties:

report.host = http://10.123.123.70:8080/api/

report.token = XXXXXXXX

POM.XML

        <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>${org.apache.maven.plugins.maven-compiler-plugin.version}</version>
                        <configuration>
                            <encoding>UTF-8</encoding>
                            <source>${source.and.target.JVM.version}</source>
                            <target>${source.and.target.JVM.version}</target>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>${org.apache.maven.plugins.maven-surefire-plugin.version}</version>
                        <executions>
                            <execution>
                                <phase>integration-test</phase>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                              
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
        </build>

请帮助实现它,在pom.xml中需要进行哪些更改

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)