Extending base configuration context APIs

When you extend a LOB-agnostic context API, you must create several new files and add code to existing files. The following diagram illustrates an example of this. In the diagram, base configuration resources appear in black. New files and code added to existing files appears in blue.

In this example, there are new scenarios testing a supervisor's ability to administer people on their team. To test these scenarios, AdminContext must be extended to add a step that creates a user who is a member of the supervisor's team.


The resources needed to extend AdminContext.

First, you must create one or more new scenarios in new feature files (#1). These files specify new steps, such as "Given I am the supervisor of "user".

Then, you must create a new step definition in a new step class (#2). Guidewire recommends naming it ExistingStepClass_Ext, such as AdminSteps_Ext. Like the base configuration step classes, the new class must inject an instance of ContextFactory.

You must add two new resources for the extension context API itself (#3):

  • AdminContext_Ext, which is an interface that extends the base configuration interface and defines the new methods needed.
  • AdminContextImpl_Ext, which is an impl that extends the base configuration impl and implements the extension interface. The new implementation code is stored here.

You must also add code to Context Factory (#4):

  • ContextFactory - Add a method the specifies a return value of the extension context API.
  • ContextFactoryImpl - Inject the extension context API into this impl, and override the new interface method.

Finally, in PCRemoteSmokeTestHelperModule (#5), you must bind the extension interface to the extension impl.