如何解决从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中需要进行哪些更改
解决方法
您似乎要通过系统属性覆盖属性值。如果是这样,您的实现应在解决属性时提供支持/注意。例如,QAF-Testng-extension支持different ways of providing prop。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。