キーワード は、テスト オブジェクトに対する複数の操作の組み合わせを定義したものです。キーワードの実装は、さまざまなツールとプログラム言語 (Java や .NET など) を使用して行えます。 Silk4NET でのキーワードは、メソッド名の前に Keyword 属性を持つメソッドです。キーワードは、キーワード資産として保存されます。
'VB .NET code
<Keyword("keyword_name")>
// C# code
[Keyword("keyword_name")]
キーワード シーケンスは、他のキーワードを組み合わせたものです。キーワード シーケンスは、頻繁に使用するキーワードの組み合わせを 1 つのキーワードにまとめることにより、メンテナンスの労力を低減し、テストを理解しやすくすることができます。
'VB .NET code
Argument("parameter_name")
// C# code
[Argument("parameter_name")]
'VB .NET code
<Keyword("Login")>
Public Sub Login()
... // method implementation
End Sub
// C# code
[Keyword("Login")]
public void Login(){
... // method implementation
}
'VB .NET code
<Keyword("Login", Description:="Logs in with the given name and password.")>
Public Sub Login(<Argument("UserName")> username As String, <Argument("Password")> password As String)
... // method implementation
End Sub
// C# code
[Keyword("Login", Description="Logs in with the given name and password.")]
public void Login([Argument("UserName")] string userName, [Argument("Password")] string password) {
... // method implementation
}
このキーワードは、指定したユーザー名とパスワードを使ってテスト対象アプリケーションにログインします。