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

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

During the recording of a keyword-driven test, Silk4J 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, Silk4J inserts this keyword as the first keyword of the keyword-driven test.
  • If there is no base state keyword in the project, Silk4J 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 annotation, and set the value of the property to true:
@Keyword(value = "Start application", isBaseState = true)
public void start_application() {
  // Base state implementation
}