Hi Paulo,
At first sight, I would say that you are not finding your step because
the EstoriaComParametro is not extending EstoriaParametrizada where your
step is defined.
In any case, you are mixing Story and Steps in your implementation,
something I would not recommend (although technically possible).
I would recommend looking at the trader examples that shows the use of
parametrisation of given stories, and following the proposed structure.
Cheers
On 10/11/2010 11:40, Paulo Sérgio Medeiros wrote:
> Hi all,
>
> I'm trying to use the version's 3.1 new feature: Parametrised
> GivenStories.
>
> I configured a very simple project to try that, but without success.
> Here is the files (hope that the language doesn't affect your
> understanding):
>
> *1) Stories*
>
> *1.a) Parametrised story (estoria_parametrizada.story)*
>
> Scenario: Teste parametrico
>
> Given uma estoria com <parametro>
>
>
> *1.b) Story that uses a parametrised one (estoria_com_parametro.story)*
>
> Scenario: Estoria com parametro
>
> GivenStories: estoria_parametrizada.story#{0}
>
> Given blahblahblah
>
> Examples:
> |parametro|
> |blah|
>
> *2) Java code*
> *
> *
> *2.a) **Parametrised story*
> *
> *
> public class EstoriaParametrizada extends AbstractStory {
> @Given("uma estoria com <parametro>")
> public void estoriaComParametro(@Named("parametro") String parametro) {
> System.out.println("CHAMOU O GIVEN DA PARAMETRICA COM O PARAMETRO: " +
> parametro);
> }
> @Override
> public List<CandidateSteps> candidateSteps() {
> return new InstanceStepsFactory(configuration(),
> this).createCandidateSteps();
> }
> }
>
> *2.b) Story that uses a parametrised one*
> *
> *
> public class EstoriaComParametro extends AbstractStory {
>
> @Given("blahblahblah")
> public void blah() {
> System.out.println("ESTORIA QUE DEPENDE DE UMA PARAMETRIZADA ...");
> }
> @Override
> public List<CandidateSteps> candidateSteps() {
> return new InstanceStepsFactory(configuration(),
> this).createCandidateSteps();
> }
> }
>
> *3) Dry run result*
>
> DRY RUN
>
> (estoria_com_parametro.story)
> Scenario: Estoria com parametro
> GivenStories:
> estoria_parametrizada.story#{0} {parametro=blah}
>
> DRY RUN
>
> (estoria_parametrizada.story)
> Scenario: Teste parametrico
> Given uma estoria com <parametro> (PENDING)
>
>
> Given blahblahblah
>
> ------------------------------------------------------------------------------------------------------------------------------------------
>
> Note in the dry run report, that the parameter in the parametrised
> story isn't being replaced. The same occurs when I run in the "real"
> mode (not in dry run).
>
> Does anybody can detect what am I doing wrong?
>
> Thanks,
> Paulo Sergio.