キーワード駆動テストのキーワードとしてマークされるメソッドの引数の名前を明示的に指定するために使用されます。
[AttributeUsageAttribute(AttributeTargets.Parameter)] public class ArgumentAttribute : Attribute
<AttributeUsageAttribute(AttributeTargets.Parameter> Public Class ArgumentAttribute Inherits Attribute
| 名前 | 説明 |
|---|---|
| Name プロパティ (ArgumentAttribute) | 引数の名前を取得します。 |
引数 username および password を持つ Login キーワードを作成するには、次のサンプル コードを使用します。
[Keyword]
public void Login([Argument("Name of the user")] string username, [Argument("Password of the user")] string password) {
// keyword implementation
}
<Keyword()>
Public Sub Login(<Argument("Name of the user")> username As String, <Argument("Password of the user")> password As String)
' keyword implementation
End Sub
引数の説明を使用せずに、引数 username および password を持つ Login キーワードを作成するには、次のサンプル コードを使用します。
[Keyword]
public void Login(string username, string password) {
// keyword implementation
}
[Keyword]
public void Login([Argument] string username, [Argument] string password) {
// keyword implementation
}
<Keyword()> Public Sub Login(username As String, password As String) ' keyword implementation End Sub
<Keyword()> Public Sub Login(<Argument> username As String, <Argument> password As String) ' keyword implementation End Sub