testng - 为什么在 TestNg 参数注解语法中使用 {}
问题描述
我想知道为什么@parameter({"a,"b"})
in的语法testNG
有这个额外的 {} 括号。
我对这个主题的研究可能是因为我们必须在这里指定多个数据。
是什么让我认为{}
在参数中使用的原因是不同的,@Test
因为我们可以传递多个数据@Test(priority=1, enabled=true)
,比如我们不在{}
这里使用in@Test
。
请帮助我理解这一点,无论我的想法是正确的方向还是背后有更多。
解决方案
括号用于数组/列表。
在TestNG 的org.testng.annotations.Parameters中,您可以看到只有一个方法声明返回 String[]:
/**
* The list of variables used to fill the parameters of this method.
* These variables must be defined in your testng.xml file.
* For example
* <p>
* <code>
* @Parameters({ "xmlPath" })<br>
* @Test<br>
* public void verifyXmlFile(String path) { ... }<br>
* </code>
* <p>and in <tt>testng.xml</tt>:<p>
* <code>
* <parameter name="xmlPath" value="account.xml" /><br>
* </code>
*/
public String[] value() default {};
与此相比,您可以在 TestNG 的org.testng.annotations.Test中看到,即优先级返回 int:
/**
* The scheduling priority. Lower priorities will be scheduled first.
*/
int priority() default 0;
推荐阅读
- java - 数组列定位和不停的do...while循环
- angular - Promise returned from onSearch(),onSearchButtonClick() is ignored
- python - Using Python Click within a class
- android - 如何使用 MVVM 在两个活动之间发送意图数据
- php - 允许基于特定格式的单独私有 IP 的 mysql 连接
- sql - 带有来自 vb.net 的参数的 postgreSQL 查询
- sql - SQL Server Foreign Key Constraint Error, But Data Exists
- c# - Switch order of item in Observable Collection - UWP
- c++ - void() 是有效的 C++ 表达式吗?
- ios - How remove or hide page counter of PDF from WKWebview?