JBehave
  1. JBehave
  2. JBEHAVE-1074

Writing stories in plain English, with words convertible to boolean

    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

      Provide an enum to allow story writers to write natural prose, while developers can enjoy getting booleans "for free".

      Quoting from the javadoc..

      Example of use. Given the following candidate step:

       @Given("a stock of symbol $symbol $withThreshold a threshold")
       public void aStock(String symbol, BooleanWord withThreshold) {
           stock = new Stock(symbol).withThreshold(withThreshold.toBoolean());
       }
      

      .. it is then possible to write the following scenarios:

       Scenario: a stock with threshold
       
       Given a stock of symbol AAA with a threshold
       When ..
       Then ..
       
       Scenario: a stock with no threshold
       
       Given a stock of symbol AAA without a threshold
       When ..
       Then ..
      

      Please note that this depends on JBEHAVE-1075.

      It would be nice if we could find an elegant way to internationalise the enum constants.
      One where there is only one enum constant for each boolean word, and the translations are kept in an external file. Any ideas?

        Activity

        Alberto Scotto made changes -
        Field Original Value New Value
        Description Provide an enum to allow story writers to write natural prose, while developers can enjoy getting booleans "for free".

        Quoting from the javadoc..

        Example of use. Given the following candidate step:

        {code}
         @Given("a stock of symbol $symbol $withThreshold a threshold")
         public void aStock(String symbol, BooleanWord withThreshold) {
             stock = new Stock(symbol).withThreshold(withThreshold.toBoolean());
         }
        {code}

        .. it is then possible to write the following scenarios:

        {code}
         Scenario: a stock with threshold
         
         Given a stock of symbol AAA with a threshold
         When ..
         Then ..
         
         Scenario: a stock with no threshold
         
         Given a stock of symbol AAA without a threshold
         When ..
         Then ..
        {code}

        Please note that this depends on #77.

        It would be nice if we could find an elegant way to internationalise the enum constants.
        One where there is only one enum constant for each boolean word, and the translations are kept in an external file. Any ideas?
        Provide an enum to allow story writers to write natural prose, while developers can enjoy getting booleans "for free".

        Quoting from the javadoc..

        Example of use. Given the following candidate step:

        {code}
         @Given("a stock of symbol $symbol $withThreshold a threshold")
         public void aStock(String symbol, BooleanWord withThreshold) {
             stock = new Stock(symbol).withThreshold(withThreshold.toBoolean());
         }
        {code}

        .. it is then possible to write the following scenarios:

        {code}
         Scenario: a stock with threshold
         
         Given a stock of symbol AAA with a threshold
         When ..
         Then ..
         
         Scenario: a stock with no threshold
         
         Given a stock of symbol AAA without a threshold
         When ..
         Then ..
        {code}

        Please note that this depends on JBEHAVE-1075.

        It would be nice if we could find an elegant way to internationalise the enum constants.
        One where there is only one enum constant for each boolean word, and the translations are kept in an external file. Any ideas?
        Show
        Alberto Scotto added a comment - https://github.com/jbehave/jbehave-core/pull/79

          People

          • Assignee:
            Unassigned
            Reporter:
            Alberto Scotto
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: