Setting the Base State for a Keyword-Driven Test in Silk4NET

When you execute a keyword-driven test with Silk4NET and the keyword-driven test calls a base state keyword, Silk4NET starts your AUT from the base state.

During the recording of a keyword-driven test, Silk4NET searches in the current project for a base state keyword, which is a keyword for which the IsBaseState property is set to True.

  • If a base state keyword exists in the current project, Silk4NET inserts this keyword as the first keyword of the keyword-driven test.
  • If there is no base state keyword in the project, Silk4NET creates a new base state keyword with the name Start application and inserts it as the first keyword of the keyword-driven test.
To manually mark a keyword as a base state keyword, add the IsBaseState property to the Keyword attribute, and set the value of the property to True:
' VB .NET code
<Keyword("Start application", IsBaseState:=True)>
Public Sub Start_application()
  ' Base state implementation
End Sub
// C# code
[Keyword("Start application", IsBaseState=true)]
public void Start_application()
{
  // Base state implementation
}