是否可以在空手道中使用加密属性?
Is it possible to use encrypted properties in karate?
我有一个 application.properties 文件,其中加密 属性:
test.username='testUser'
test.password=ENC(3ncryp73dp@$$w0rd)
我想在特征文件中使用解密后的值,有点像:
Feature: Login
Scenario: Test login at myurl.com
Given url 'myurl.com/login'
And param username = testUsername
And param password = testPassword
When method GET
[etc]
通常 Spring-boot 处理解密这些属性,我可以使用
@Value(${test.username})
protected String testUsername;
在我的步骤定义中 class 从 application.properties
文件中获取 属性。
我如何用空手道做到这一点?
没有对此的直接支持。我的建议是使用 Java interop。如果将 Spring Boot 使用的代码添加到类路径/maven 依赖项中,您甚至可以利用它。所以你可以得到这样的结果:
And param username = MyUtil.decode(testUserName)
And param password = MyUtil.decode(testPassword)
我有一个 application.properties 文件,其中加密 属性:
test.username='testUser'
test.password=ENC(3ncryp73dp@$$w0rd)
我想在特征文件中使用解密后的值,有点像:
Feature: Login
Scenario: Test login at myurl.com
Given url 'myurl.com/login'
And param username = testUsername
And param password = testPassword
When method GET
[etc]
通常 Spring-boot 处理解密这些属性,我可以使用
@Value(${test.username})
protected String testUsername;
在我的步骤定义中 class 从 application.properties
文件中获取 属性。
我如何用空手道做到这一点?
没有对此的直接支持。我的建议是使用 Java interop。如果将 Spring Boot 使用的代码添加到类路径/maven 依赖项中,您甚至可以利用它。所以你可以得到这样的结果:
And param username = MyUtil.decode(testUserName)
And param password = MyUtil.decode(testPassword)