سؤال

Is there a way to run JBehave from gradle? I currently have a JUnitStories subclass that sets a step class and overrides storyPaths to point at different .story files.

This task can supposedly do what I need, but I'm not sure how I integrate it with what I have.

task spec << {
    ant.taskdef(
            name: 'jbehave',
            classname: 'org.jbehave.ant.RunStoriesAsEmbeddables',
            classpath: configurations.jbehave.asPath)

    ant.jbehave(
            includes: 'src/main/specs',
            generateViewAfterStories: true
    )
}

How do I get this running from a gradle task with my stories?

هل كانت مفيدة؟

المحلول

I'm not aware of a JBehave plugin for Gradle. If JBehave has JUnit integration, you can run JBehave tests via Gradle's test task. Otherwise, the task above looks fine too. Apparently it expects JBehave sources in src/main/specs (I don't know if they need to be compiled). It also expects a jbehave configuration containing the JBehave library. You can set it up like so:

configurations { jbehave }
dependencies {
    jbehave ...
} 
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top