I failed to add the scope="test" attribute.  Now, I'm getting this exception:

The scenario 'hw.GreetingSteps' must be of type
'org.jbehave.scenario.RunnableScenario'

On Mon, Dec 21, 2009 at 7:38 PM, Christopher Gardner
<[email protected]> wrote:
> I tried the suggestion, but unfortunately I'm getting the same results. :(
>
> On Mon, Dec 21, 2009 at 6:15 PM, Mauro Talevi
> <[email protected]> wrote:
>> Hi Christopher,
>>
>> I suspect your problem stems from the fact you're trying to run scenario in
>> "test" scope.
>>
>> Instead of:
>>
>>    <scenarioRunner scenarioIncludes="${test.java.dir}/**/*.java"
>>      classLoaderInjected="false" />
>>
>> it should probably be
>>
>>    <scenarioRunner scenarioIncludes="**/*.java" scope="test"
>> testSourceDirectory="${test.java.dir}" classLoaderInjected="false" />
>>
>> Let me know if this works.  I'll update the documentation to clarify this
>> point (especially the testSourceDirectory param).
>>
>> Cheers
>>
>> Christopher Gardner wrote:
>>>
>>> I can run the following through the Eclipse JUnit support with no
>>> problems whatsoever:
>>>
>>> public class Greeting extends JUnitScenario {
>>>    private static ScenarioNameResolver converter =
>>>        new UnderscoredCamelCaseResolver(".scenario");
>>>
>>>    public Greeting() {
>>>        super(new PropertyBasedConfiguration() {
>>>           �...@override
>>>            public ScenarioDefiner forDefiningScenarios() {
>>>                return new ClasspathScenarioDefiner(converter, new
>>> PatternScenarioParser(this));
>>>            }
>>>
>>>           �...@override
>>>            public PendingErrorStrategy forPendingSteps() {
>>>                    return PendingErrorStrategy.FAILING;
>>>            }
>>>        }, new GreetingSteps());
>>>    }
>>>
>>> However, when I try to run it with the ant scenarioRunner, I receive
>>> "No scenarios to run."
>>>
>>> Here is my ant file, where "jbehave.files" referenced in the
>>> test.classpath points to all the JBehave jars.
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <project name="fsa-srv-specs" default="run-scenarios" basedir=".">
>>>
>>>  <property name="build.common.dir" location="${basedir}/build-common" />
>>>  <!--
>>> =====================================================================
>>>       Properties: Structure
>>>
>>> ===================================================================== -->
>>>  <property name="test.dir" location="${basedir}/test" />
>>>
>>>  <!-- the Java Steps and Scenario file location -->
>>>  <property name="test.java.dir" location="${test.dir}/java" />
>>>
>>>  <!-- the *.scenario file location with the same package structure as
>>> the corresponding Steps files -->
>>>  <property name="scenarios.dir" location="${basedir}/scenarios" />
>>>  <property name="lib.dir" location="${basedir}/lib" />
>>>  <property name="build.dir" location="${basedir}/build" />
>>>  <property name="build.test.dir" location="${build.dir}/test" />
>>>  <property name="build.test.classes.dir"
>>> location="${build.test.dir}/classes" />
>>>
>>>  <import file="${build.common.dir}/dependencies.xml" />
>>>  <!--
>>> =====================================================================
>>>       Classpaths
>>>
>>> ===================================================================== -->
>>>  <path id="test.classpath">
>>>    <fileset refid="jbehave.files" /> <!-- imported through
>>> dependencies.xml -->
>>>    <fileset dir="${lib.dir}" includes="**/*.jar" />
>>>    <pathelement location="${scenarios.dir}" />
>>>    <pathelement location="${build.test.classes.dir}" />
>>>  </path>
>>>
>>>  <!--
>>> =====================================================================
>>>       Targets: Build
>>>
>>> ===================================================================== -->
>>>  <target name="init-test">
>>>     <mkdir dir="${build.test.classes.dir}" />
>>>   </target>
>>>
>>>   <target name="compile-test" description="Compile the tests."
>>> depends="init-test">
>>>     <javac.local destdir="${build.test.classes.dir}"
>>> srcdir="${test.java.dir}">
>>>       <classpath refid="test.classpath" />
>>>     </javac.local>
>>>   </target>
>>>
>>>  <target name="run-scenarios" description="Run the behavioral tests."
>>> depends="compile-test">
>>>    <taskdef name="scenarioRunner"
>>> classname="org.jbehave.ant.ScenarioRunnerTask"
>>>      classpathref="test.classpath" />
>>>
>>>    <scenarioRunner scenarioIncludes="${test.java.dir}/**/*.java"
>>>      classLoaderInjected="false" />
>>>  </target>
>>>
>>>  <target name="clean" description="Clean the build.">
>>>    <delete dir="${build.dir}" />
>>>  </target>
>>>
>>>  <!--
>>> =====================================================================
>>>       Macros, Presets, and Typedefs
>>>
>>> ===================================================================== -->
>>>  <presetdef name="javac.local">
>>>    <javac debug="true" />
>>>  </presetdef>
>>> </project>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>    http://xircles.codehaus.org/manage_email
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>   http://xircles.codehaus.org/manage_email
>>
>>
>>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to