我正在使用以下版本的zerocode-rest-bdd maven lib。我在JUnit运行器中使用"@TargetEnv("app_host.properties")“定义了我的应用程序主机和端口。
<dependency>
<groupId>org.jsmart</groupId>
<artifactId>zerocode-rest-bdd</artifactId>
<version>1.2.15</version>
</dependency>我想要访问更多的主机/端口(边界应用程序IP)和通用令牌(SAML、OAuth等)到我的JSON测试用例中,而我无法使用${{app_host}}访问它们。
有没有其他方法可以扩展或配置这些额外的属性,以便我可以访问它们并验证我的边界契约?
app_host.properties包含:
web.application.endpoint.host=https://api.github.local
web.application.endpoint.port=443
web.application.endpoint.context=
#Can not access these below properties
app_host_1=https://app1.host.local.uk
saml_token=<SAML>sdf-wer</SAML>在测试用例中访问如下:
"url": "${app_host_1}/users/u123",发布于 2019-03-09 21:42:50
看起来您使用的是Zerocode lib的旧版本。您可以更新到<version>1.2.17</version>或latest,如下所示。
<dependency>
<groupId>org.jsmart</groupId>
<artifactId>zerocode-tdd</artifactId>
<version>1.3.x</version>
</dependency>然后,一旦你定义了你的属性,例如
micro_host_1=https://micro.host1.local.uk
xyz_key=abc_value在测试用例中,可以分别通过${micro_host_1}或${xyz_key} to、https://micro.host1.local.uk或abc_value来解析这些值。
希望这能有所帮助!
https://stackoverflow.com/questions/54716763
复制相似问题