JBehave
  1. JBehave
  2. JBEHAVE-526

Steps could benefit from a pre-requisite check

    Details

    • Type: New Feature New Feature
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Core
    • Labels:
      None
    • Number of attachments :
      0

      Description

      An Example:

      PreRequisiteHandler prh = new PreRequisiteHandler() {
      public void preRequisiteCheck(Object instance, Method method) {
      String url = webDriverProvider.get().getCurrentUrl();
      String urlPart = getUrlPartFromAnnotationOnMethod(method));
      assertThat(url, contains(urlPart));
      }};

      configuration.usePreRequisiteHandler(prh);

      WebDriver assumed page checking, before invoking a step, is one use of a pre-requisite. Ultimately this is a jb-core enhancement, and a jb-web-selenium specialization.

        Activity

        Hide
        Brian Repko added a comment -

        Should we add @BeforeStep / @AfterStep? or @BeforeStep("regex for which steps?")

        Show
        Brian Repko added a comment - Should we add @BeforeStep / @AfterStep? or @BeforeStep("regex for which steps?")
        Hide
        Paul Hammant added a comment -

        That might be a better way of handling it Brian. The method/instance is passed in to the applicable handler. We should also leverage annotation chaining.

        // ** In use **

        @ForUrlPrefix("/shoppingCart")
        public void someWhen()

        { // etc }

        // ** Defined like so **

        // a custom use of @BeforeStep for my client
        @BeforeStep
        public @interface ForUrlPrefix

        { String value(); // the url prefix }
        Show
        Paul Hammant added a comment - That might be a better way of handling it Brian. The method/instance is passed in to the applicable handler. We should also leverage annotation chaining. // ** In use ** @ForUrlPrefix("/shoppingCart") public void someWhen() { // etc } // ** Defined like so ** // a custom use of @BeforeStep for my client @BeforeStep public @interface ForUrlPrefix { String value(); // the url prefix }

          People

          • Assignee:
            Unassigned
            Reporter:
            Paul Hammant
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: