Technologies used in Behavior Testing Framework

The bulk of the technology used by Behavior Testing Framework is identical to that of PolicyCenter . Behavior Testing Framework uses Gosu classes and interfaces created through the Guidewire Studio IDE.

Behavior Testing Framework also uses the following technologies.

Cucumber and Gherkin

Cucumber is an open-source software testing tool that is capable of running automated acceptance tests. Cucumber is designed to run tests created in a behavior-driven development environment. Studio includes a plugin to support Cucumber.

Gherkin is a language used by Cucumber to define tests. It uses natural language so that test writing can be a collaborative effort between business experts and technical experts.

For more information, refer to the Cucumber Documentation at https://docs.cucumber.io/guides/.

Google Guice

To share and isolate implementations appropriately, Behavior Testing Framework uses dependency injection. Dependency injection is a software design approach in which one object provides the dependencies of another object. The act of passing the dependency object into another object is referred to as injecting. The primary goal of dependency injection is to isolate objects so that no dependent object needs to be changed solely because an object that it depends on is being changed. This approach adheres to the Open/Closed principle of object-oriented programming.

Cucumber supports several dependency injection frameworks. Behavior Testing Framework uses Google Guice. Google Guice (pronounced like "juice") is an open-source Java framework that supports dependency injection. Dependencies can be injected into dependent objects using the @Inject annotation.

The following is an example of the AdminSteps class. It defines a createUserWithRoleAndSetAsCurrentUser method, which must identify and execute the correct implementation of createAndSetUserWithRole. The method is able to do this using an instance of ContextFactory, which has been injected into the class.

class AdminSteps {
  @Inject
  var _contextFactory : ContextFactory

  @Given("^I am a user with the \"([^\"]*)\" role$")
  function createUserWithRoleAndSetAsCurrentUser(roleString: String) {
    _contextFactory.getAdminContext().createAndSetUserWithRole(roleString)
  }

For more information, refer to the Guice Documentation at https://github.com/google/guice.