简体   繁体   English

空手道 api 测试 - 如何从命令行读取标签名称到功能文件

[英]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场景大纲:测试标签输入场景

  • print I want to read tagname here打印我想在这里阅读标记名

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.

相关问题 如何使用空手道 API 测试将变量从一个特征文件调用到另一个特征文件 - How can I call a variable from one feature file to another feature file using Karate API Testing 空手道 API 测试 - 将变量从一个特征文件传递到另一个 - Karate API Testing - Passing variable from one feature file to another 空手道API测试从命令行运行测试 - Karate API Testing Running Tests from Command Line 空手道 Api 测试 - 如何将数据从一个特征文件传递到另一个特征文件 - Karate Api Testing - How to pass data from one feature file to another 空手道 API 测试 - 如何在同一功能中使用从 API 1 到另一个 API 的变量(响应输出) - Karate API Testing - How to use a variable (output from response) from API 1 to another API in same feature 空手道 API 测试 - 在同一功能文件中的不同场景中重用变量 - Karate API Testing - Reusing variables in different scenarios in the same feature file 如何从一个特征文件表中读取数据并传递值以在空手道的 *.json 文件中设置 json 参数? - How to read data from one feature file table and pass the value to set json parameter in a *.json file in karate? 如何在空手道 API 自动化中针对来自特征文件的多个数据库实例验证 API 响应? - How to validate API response against multiple instance of data base from feature file in Karate API automation? 如何在空手道框架的特征文件中读取响应头值? - how to read response header values in feature file of karate framework? 如何在空手道的特征文件中循环 - How to loop with in the feature file in karate
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM