JBehave
  1. JBehave
  2. JBEHAVE-265

Allow annotation-based configuration

    Details

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

      Description

      Annotations-based configuration can be preferable to some users.

      Investigate and implement annotation-based alternatives to programmatic configuration, which should always be possible.

        Activity

        Hide
        Cristiano Gavião added a comment -

        Hi,
        I think the first thing that needed to be decided is: where will be started the annotation interpretation process?
        I could think in two alternatives:

        1. To use the junit native way and create a class extending from BlockJUnit4ClassRunner. This way each jbehave class should have a @RunWith to indicate that we wanted to use the annotated mode.
          @StepsSettings(classes={StepsTestClass.class}, monitor="")
          @JBehaveSettings(type = BehaviorType.USER_STORY, logLevel = LogLevel.DEBUG)
          @RunWith(TestRunner4JBehave.class)
          Class Cenario1 extends Scenario {
                  @Inject
          	public Cenario2(StoryConfiguration pConfiguration,
          			Set<CandidateSteps> pCandidateSteps) throws Exception {
          		super(pConfiguration, pCandidateSteps);
          	}
          }
          
        2. To use some jbehave initialization method to call the annotation interpretation inside it.

        Particularly I prefer the first one, so I can use annotations with DI to configure all my jbehave session.

        More ideas?

        Show
        Cristiano Gavião added a comment - Hi, I think the first thing that needed to be decided is: where will be started the annotation interpretation process? I could think in two alternatives: To use the junit native way and create a class extending from BlockJUnit4ClassRunner. This way each jbehave class should have a @RunWith to indicate that we wanted to use the annotated mode. @StepsSettings(classes={StepsTestClass.class}, monitor="") @JBehaveSettings(type = BehaviorType.USER_STORY, logLevel = LogLevel.DEBUG) @RunWith(TestRunner4JBehave.class) Class Cenario1 extends Scenario { @Inject public Cenario2(StoryConfiguration pConfiguration, Set<CandidateSteps> pCandidateSteps) throws Exception { super (pConfiguration, pCandidateSteps); } } To use some jbehave initialization method to call the annotation interpretation inside it. Particularly I prefer the first one, so I can use annotations with DI to configure all my jbehave session. More ideas?
        Hide
        Mauro Talevi added a comment -

        The issue I see in approach 1 is the tie-in with JUnitRunner, which works fine in IDE but we'd need to change the command-line runner. This may not be a bad thing, we may decide to leverage the JUnit runner for command-line too.

        I think it's important to have configuration mechanism that are valid in IDE as well as command-line.

        Show
        Mauro Talevi added a comment - The issue I see in approach 1 is the tie-in with JUnitRunner, which works fine in IDE but we'd need to change the command-line runner. This may not be a bad thing, we may decide to leverage the JUnit runner for command-line too. I think it's important to have configuration mechanism that are valid in IDE as well as command-line.
        Mauro Talevi made changes -
        Field Original Value New Value
        Fix Version/s 3.1 [ 16511 ]
        Fix Version/s 3.0 [ 16302 ]
        Mauro Talevi made changes -
        Fix Version/s 3.0 [ 16302 ]
        Fix Version/s 3.1 [ 16511 ]
        Mauro Talevi made changes -
        Assignee Mauro Talevi [ maurotalevi ]
        Mauro Talevi made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Mauro Talevi made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Mauro Talevi
            Reporter:
            Mauro Talevi
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: