JBehave

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:
  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?
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.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: