JBehave
  1. JBehave
  2. JBEHAVE-879

Update docs on configuring localised stories

    Details

    • Type: Task Task
    • Status: Resolved Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 3.7.5
    • Fix Version/s: 3.8
    • Component/s: Documentation
    • Labels:
      None
    • Environment:
      windows8
    • Number of attachments :
      0

      Description

      I’m having a problem where I get steps marked as pending when they use the “And” keyword. Just as in http://jira.codehaus.org/browse/JBEHAVE-281.
      What puzzles me is that I use 3.7.5 of JBehave core
      I'm using a localized project.
      More complete reproduction setup
      Story:
      Sammanhang: Samlade regressionstester för administrationen av ansökningar av lärarlegitimation

      Scenario: Reproduce and keyword problem
      Givet att vi finns
      Och att inget återstår
      Och att det har startat

      Java code:
      @Given("att vi finns")
      public void exist() {

      }

      @Given("att inget återstår")
      public void nothing() {

      }

      @Given("att det har startat")
      public void started() {

      }

      Console output:
      Running story lararleg/reproduce.story

      (lararleg/reproduce.story)
      Scenario: Reproduce and keyword problem
      Givet att vi finns
      Och att inget återstår
      Och att det har startat (VÄNTANDE)
      @And("att det har startat")
      @Pending
      public void andAttDetHarStartat()

      { // VÄNTANDE }

        Activity

        Mauro Talevi made changes -
        Field Original Value New Value
        Fix Version/s 3.7.6 [ 19035 ]
        Description I’m having a problem where I get steps marked as pending when they use the “And” keyword. Just as in http://jira.codehaus.org/browse/JBEHAVE-281.
        What puzzles me is that I use 3.7.5 of JBehave core
        I'm using a localized project.
        More complete reproduction setup
        Story:
        Sammanhang: Samlade regressionstester för administrationen av ansökningar av lärarlegitimation

        Scenario: Reproduce and keyword problem
        Givet att vi finns
        Och att inget återstår
        Och att det har startat

        Java code:
        @Given("att vi finns")
        public void exist() {

        }

        @Given("att inget återstår")
        public void nothing() {

        }

        @Given("att det har startat")
        public void started() {

        }

        Console output:
        Running story lararleg/reproduce.story

        (lararleg/reproduce.story)
        Scenario: Reproduce and keyword problem
        Givet att vi finns
        Och att inget återstår
        Och att det har startat (VÄNTANDE)
        @And("att det har startat")
        @Pending
        public void andAttDetHarStartat() {
        // VÄNTANDE
        }
        I’m having a problem where I get steps marked as pending when they use the “And” keyword. Just as in http://jira.codehaus.org/browse/JBEHAVE-281.
        What puzzles me is that I use 3.7.5 of JBehave core
        I'm using a localized project.
        More complete reproduction setup
        Story:
        Sammanhang: Samlade regressionstester för administrationen av ansökningar av lärarlegitimation

        Scenario: Reproduce and keyword problem
        Givet att vi finns
        Och att inget återstår
        Och att det har startat

        Java code:
        @Given("att vi finns")
        public void exist() {

        }

        @Given("att inget återstår")
        public void nothing() {

        }

        @Given("att det har startat")
        public void started() {

        }

        Console output:
        Running story lararleg/reproduce.story

        (lararleg/reproduce.story)
        Scenario: Reproduce and keyword problem
        Givet att vi finns
        Och att inget återstår
        Och att det har startat (VÄNTANDE)
        @And("att det har startat")
        @Pending
        public void andAttDetHarStartat() {
        // VÄNTANDE
        }
        Mauro Talevi made changes -
        Assignee Mauro Talevi [ maurotalevi ]
        Hide
        Mauro Talevi added a comment -

        I've added a story to try to reproduce the issue in https://github.com/jbehave/jbehave-core/tree/master/examples/trader-i18n

        So far, I've not been able to reproduce it but I've used different SV sentences since the ones you provided have been corrupted by the encoding.

        This makes me think that it's an encoding issue. Can you please try to reproduce issue in the

        https://github.com/jbehave/jbehave-core/blob/master/examples/trader-i18n/src/main/java/org/jbehave/examples/trader/i18n/stories/sv_and_step.story
        https://github.com/jbehave/jbehave-core/blob/master/examples/trader-i18n/src/main/java/org/jbehave/examples/trader/i18n/steps/SvSteps.java

        and provide a commit via Github. Here's how:

        http://jbehave.org/reference/stable/how-to-contribute.html

        Committing via Git will ensure a better chance of avoiding encoding issues.

        Show
        Mauro Talevi added a comment - I've added a story to try to reproduce the issue in https://github.com/jbehave/jbehave-core/tree/master/examples/trader-i18n So far, I've not been able to reproduce it but I've used different SV sentences since the ones you provided have been corrupted by the encoding. This makes me think that it's an encoding issue. Can you please try to reproduce issue in the https://github.com/jbehave/jbehave-core/blob/master/examples/trader-i18n/src/main/java/org/jbehave/examples/trader/i18n/stories/sv_and_step.story https://github.com/jbehave/jbehave-core/blob/master/examples/trader-i18n/src/main/java/org/jbehave/examples/trader/i18n/steps/SvSteps.java and provide a commit via Github. Here's how: http://jbehave.org/reference/stable/how-to-contribute.html Committing via Git will ensure a better chance of avoiding encoding issues.
        Hide
        Joachim Nilsson added a comment -

        I was able to reproduce the error. (file encoding both Cp1252 and ISO-8859-1)
        It happens when a story has more than one 'And', regardless of step type.
        I hope I can do some debugging tomorrow to find out why.

        Show
        Joachim Nilsson added a comment - I was able to reproduce the error. (file encoding both Cp1252 and ISO-8859-1) It happens when a story has more than one 'And', regardless of step type. I hope I can do some debugging tomorrow to find out why.
        Hide
        Joachim Nilsson added a comment -

        OK, I could not wait
        I believe I have found it but I am not completely sure of how to solve it, my guess is that we need a bit of refactoring.
        Take a look at:
        public MarkUnmatchedStepsAsPending(StepFinder stepFinder)

        { this(stepFinder, new LocalizedKeywords()); }

        It creates a non localized keywords instance. When used in:
        if ( !(keywords.isAndStep(stepAsString) || keywords.isIgnorableStep(stepAsString)) )

        { previousNonAndStep = stepAsString; }

        The variable previousNonAndStep will get wrong value. Only noticeable when having localized stories with more than one And per type.

        Show
        Joachim Nilsson added a comment - OK, I could not wait I believe I have found it but I am not completely sure of how to solve it, my guess is that we need a bit of refactoring. Take a look at: public MarkUnmatchedStepsAsPending(StepFinder stepFinder) { this(stepFinder, new LocalizedKeywords()); } It creates a non localized keywords instance. When used in: if ( !(keywords.isAndStep(stepAsString) || keywords.isIgnorableStep(stepAsString)) ) { previousNonAndStep = stepAsString; } The variable previousNonAndStep will get wrong value. Only noticeable when having localized stories with more than one And per type.
        Hide
        Mauro Talevi added a comment -

        I don't see the problem that you're referring to. The keywords are injected via the other constructor which is what is used in the trader-i18n example.

        Have a look at the configuration in:

        https://github.com/jbehave/jbehave-core/blob/master/examples/trader-i18n/src/main/java/org/jbehave/examples/trader/i18n/LocalizedTraderStories.java

        The story https://github.com/jbehave/jbehave-core/blob/master/examples/trader-i18n/src/main/java/org/jbehave/examples/trader/i18n/stories/sv_and_step.story shows the use of localised steps with more than one And per type.

        Please check your configuration against the one above. Note that you need to inject the keywords both in the StepCollector and StoryParser.

        Show
        Mauro Talevi added a comment - I don't see the problem that you're referring to. The keywords are injected via the other constructor which is what is used in the trader-i18n example. Have a look at the configuration in: https://github.com/jbehave/jbehave-core/blob/master/examples/trader-i18n/src/main/java/org/jbehave/examples/trader/i18n/LocalizedTraderStories.java The story https://github.com/jbehave/jbehave-core/blob/master/examples/trader-i18n/src/main/java/org/jbehave/examples/trader/i18n/stories/sv_and_step.story shows the use of localised steps with more than one And per type. Please check your configuration against the one above. Note that you need to inject the keywords both in the StepCollector and StoryParser.
        Hide
        Christian Karlsson added a comment -

        Ok
        I added
        .useStepCollector(new MarkUnmatchedStepsAsPending(keywords))
        to my configuration. And that did it!
        So I guess that it was a mistake on my end.

        But to my defense, that step of internationalizing JBehave isn't part of http://jbehave.org/reference/stable/stories-in-your-language.html

        Thanks Mauro for enlightening me

        Show
        Christian Karlsson added a comment - Ok I added .useStepCollector(new MarkUnmatchedStepsAsPending(keywords)) to my configuration. And that did it! So I guess that it was a mistake on my end. But to my defense, that step of internationalizing JBehave isn't part of http://jbehave.org/reference/stable/stories-in-your-language.html Thanks Mauro for enlightening me
        Hide
        Mauro Talevi added a comment -

        You're right too, the documentation had gotten out of sync with the examples.

        Thanks for pointing it out. We'll update it.

        Show
        Mauro Talevi added a comment - You're right too, the documentation had gotten out of sync with the examples. Thanks for pointing it out. We'll update it.
        Mauro Talevi made changes -
        Description I’m having a problem where I get steps marked as pending when they use the “And” keyword. Just as in http://jira.codehaus.org/browse/JBEHAVE-281.
        What puzzles me is that I use 3.7.5 of JBehave core
        I'm using a localized project.
        More complete reproduction setup
        Story:
        Sammanhang: Samlade regressionstester för administrationen av ansökningar av lärarlegitimation

        Scenario: Reproduce and keyword problem
        Givet att vi finns
        Och att inget återstår
        Och att det har startat

        Java code:
        @Given("att vi finns")
        public void exist() {

        }

        @Given("att inget återstår")
        public void nothing() {

        }

        @Given("att det har startat")
        public void started() {

        }

        Console output:
        Running story lararleg/reproduce.story

        (lararleg/reproduce.story)
        Scenario: Reproduce and keyword problem
        Givet att vi finns
        Och att inget återstår
        Och att det har startat (VÄNTANDE)
        @And("att det har startat")
        @Pending
        public void andAttDetHarStartat() {
        // VÄNTANDE
        }
        I’m having a problem where I get steps marked as pending when they use the “And” keyword. Just as in http://jira.codehaus.org/browse/JBEHAVE-281.
        What puzzles me is that I use 3.7.5 of JBehave core
        I'm using a localized project.
        More complete reproduction setup
        Story:
        Sammanhang: Samlade regressionstester för administrationen av ansökningar av lärarlegitimation

        Scenario: Reproduce and keyword problem
        Givet att vi finns
        Och att inget återstår
        Och att det har startat

        Java code:
        @Given("att vi finns")
        public void exist() {

        }

        @Given("att inget återstår")
        public void nothing() {

        }

        @Given("att det har startat")
        public void started() {

        }

        Console output:
        Running story lararleg/reproduce.story

        (lararleg/reproduce.story)
        Scenario: Reproduce and keyword problem
        Givet att vi finns
        Och att inget återstår
        Och att det har startat (VÄNTANDE)
        @And("att det har startat")
        @Pending
        public void andAttDetHarStartat() {
        // VÄNTANDE
        }
        Component/s Documentation [ 11085 ]
        Component/s Core [ 11086 ]
        Summary Multiple steps with keyword "And" not recognized Update docs on configuring localised stories
        Issue Type Bug [ 1 ] Task [ 3 ]
        Hide
        Mauro Talevi added a comment -

        Updated docs example.

        Show
        Mauro Talevi added a comment - Updated docs example.
        Mauro Talevi made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Mauro Talevi made changes -
        Fix Version/s 3.8 [ 19104 ]
        Fix Version/s 3.7.6 [ 19035 ]

          People

          • Assignee:
            Mauro Talevi
            Reporter:
            Christian Karlsson
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: