[英]karate api testing - How to read tag names from command line to feature file
karate api testing - How to read tag names from command line to feature file空手道 api 测试 - 如何从命令行读取标签名称到功能文件
My feature file我的功能文件
Feature: validating tag name reading from maven command line功能:验证从 maven 命令行读取的标签名称
Background:背景:
Given url baseURL给定 url baseURL
When param validation = I want to read tagname here当 param validation = I want to read tagname here
Then method get然后方法get
Then status 200然后状态200
@com_status @all @ I want to read tagname here @com_status @all @我想在这里阅读标记名
Scenario Outline: Testing tag input scenarios场景大纲:测试标签输入场景
Command - mvn clean test -Dtest=Runner -DargLine="-Dkarate.env=dev" -Dcucumber.options="--tags @com_status"命令 - mvn clean test -Dtest=Runner -DargLine="-Dkarate.env=dev" -Dcucumber.options="--tags @com_status"
Below is the command to execute the tag from the command line in Karate Api automation testing.下面是在空手道 Api 自动化测试中从命令行执行标签的命令。
mvn test -DargLine="-Dkarate.env=e2e" "-Dkarate.options=--tags @user_management_get_vender_types"
You cannot.你不能。 Tags are designed to be passed on the command line to filter scenarios to run - and cannot be retrieved within a test.标签被设计为在命令行上传递以过滤要运行的场景 - 并且无法在测试中检索。 You can retrieve the tag of a Scenario
though: https://github.com/intuit/karate#karate-tags您可以检索Scenario
的标签: https://github.com/intuit/karate#karate-tags
You can try using karate.properties
or something similar to retrieve what was passed on the command-line: https://github.com/intuit/karate#dynamic-port-numbers您可以尝试使用karate.properties
或类似的东西来检索命令行上传递的内容: https://github.com/intuit/karate#dynamic-port-numbers
Command:命令:
mvn clean test -DcustomName=foo
Feature:特征:
* def customName = karate.properties['customName']
Feel free to contribute this feature if you think it is important.如果您认为此功能很重要,请随时提供此功能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.