A keyword is a defined combination of one or more actions on a test object. The implementation of a keyword can be done with various tools and programming languages, for example Java or .NET. In Silk4NET, a keyword is a method with the attribute Keyword before the method name. Keywords are saved as keyword assets.
'VB .NET code
<Keyword("keyword_name")>
// C# code
[Keyword("keyword_name")]
A keyword sequence is a keyword that is a combination of other keywords. Keyword sequences bundle often encountered combinations of keywords into a single keyword, enabling you to reduce maintenance effort and to keep your tests well-arranged.
'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
}
where the keyword logs into the application under test with a given user name and password.