Re: [jbehave-user] Problem with parameter injection when an examples table is used
I debugged it and as it seems, this method does not work as I would expect it: org.jbehave.core.steps.StepCreator.ParameterisedStep.parametriseStep() The org.jbehave.core.annotations.Named annotation supports only one value. But in my use cases I need two values: creditAccount and debitAccount. What if you support using an regular expression for the @Named annotation instead of allowing just one value? That could be one way to solve it. The method ParameterisedStep.parametriseStep() would need to be adapted accordingly to support that logic. 2014-02-07 Hans Schwäbli bugs.need.love@gmail.com: Hello Mauro, I took the time to create an example project for Eclipse so that you can reproduce it. I attached the zip file to this email. Hopfully it is passed to the mailing list. If not, I will have to upload it somewhere and tell you the download link. You will see that it is not working as I expect it. My intention is to use the data from the examples table to pass it into the step. I have to use two different variable names for the account number, since I use both credit account number and debit account number in the examples table. If I would only use one account number in the examples table it would pass the value into the method. But with the way how I tried to use it, debitAccount and creditAccount are passed into the step method instead of the actual values from the examples table. I hope you can help me to achieve my goal. 2014-02-06 Mauro Talevi mauro.tal...@aquilonia.org: Hi what is the stated intention here? You want two steps to match the same method with different parameter names? Can you please provide a sample project - inclusive of textual stories and steps class that reproduces your issue? Thanks On 06/02/2014 16:52, Hans Schwäbli wrote: I have two steps like this with a examples table where the values are defined: Given the account data of debitAccount is known Given the account data of creditAccount is known First I tried this in the step class method for the two steps above: @Given(the account data of $debitAccount is known) It works only for the first of the two steps. But the second step gets value creditAccount passed into the method instead of the actual value from the examples table. So I changed the annotation to be like this: @Given(the account data of $acount is known) But this does not work for both steps above since debitAccount and creditAccount is passed into the method instead of the actual values. Then I tried it with an alias: @Given(the account data of debitAccount is known) @Alias(the account data of creditAccount is known) The result was that the story failed without showing me why (no exception or any meaningful message). I tried also some other things with no success. I use JBehave 3.9 by the way. Can you please tell me the solution? - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [jbehave-user] Problem with parameter injection when an examples table is used
As it seems it can be solved with configuring the MostUsefuleConfiguration like this: .useParameterControls(new ParameterControls().useDelimiterNamedParameters(true)) It is even documented here: http://jbehave.org/reference/stable/parametrised-scenarios.html(Parametrisation by name delimiters). I think this should be the default, using delimeter named parameters. 2014-02-07 Hans Schwäbli bugs.need.love@gmail.com: I debugged it and as it seems, this method does not work as I would expect it: org.jbehave.core.steps.StepCreator.ParameterisedStep.parametriseStep() The org.jbehave.core.annotations.Named annotation supports only one value. But in my use cases I need two values: creditAccount and debitAccount. What if you support using an regular expression for the @Named annotation instead of allowing just one value? That could be one way to solve it. The method ParameterisedStep.parametriseStep() would need to be adapted accordingly to support that logic. 2014-02-07 Hans Schwäbli bugs.need.love@gmail.com: Hello Mauro, I took the time to create an example project for Eclipse so that you can reproduce it. I attached the zip file to this email. Hopfully it is passed to the mailing list. If not, I will have to upload it somewhere and tell you the download link. You will see that it is not working as I expect it. My intention is to use the data from the examples table to pass it into the step. I have to use two different variable names for the account number, since I use both credit account number and debit account number in the examples table. If I would only use one account number in the examples table it would pass the value into the method. But with the way how I tried to use it, debitAccount and creditAccount are passed into the step method instead of the actual values from the examples table. I hope you can help me to achieve my goal. 2014-02-06 Mauro Talevi mauro.tal...@aquilonia.org: Hi what is the stated intention here? You want two steps to match the same method with different parameter names? Can you please provide a sample project - inclusive of textual stories and steps class that reproduces your issue? Thanks On 06/02/2014 16:52, Hans Schwäbli wrote: I have two steps like this with a examples table where the values are defined: Given the account data of debitAccount is known Given the account data of creditAccount is known First I tried this in the step class method for the two steps above: @Given(the account data of $debitAccount is known) It works only for the first of the two steps. But the second step gets value creditAccount passed into the method instead of the actual value from the examples table. So I changed the annotation to be like this: @Given(the account data of $acount is known) But this does not work for both steps above since debitAccount and creditAccount is passed into the method instead of the actual values. Then I tried it with an alias: @Given(the account data of debitAccount is known) @Alias(the account data of creditAccount is known) The result was that the story failed without showing me why (no exception or any meaningful message). I tried also some other things with no success. I use JBehave 3.9 by the way. Can you please tell me the solution? - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Re: [jbehave-user] Problem with parameter injection when an examples table is used
Hi, this is indeed one of the solutions. I agree that it would be more useful as a default. Please raise a JIRA issue for this and we'll add it to next release. Cheers On 7 Feb 2014, at 15:23, Hans Schwäbli bugs.need.love@gmail.com wrote: As it seems it can be solved with configuring the MostUsefuleConfiguration like this: .useParameterControls(new ParameterControls().useDelimiterNamedParameters(true)) It is even documented here: http://jbehave.org/reference/stable/parametrised-scenarios.html (Parametrisation by name delimiters). I think this should be the default, using delimeter named parameters. 2014-02-07 Hans Schwäbli bugs.need.love@gmail.com: I debugged it and as it seems, this method does not work as I would expect it: org.jbehave.core.steps.StepCreator.ParameterisedStep.parametriseStep() The org.jbehave.core.annotations.Named annotation supports only one value. But in my use cases I need two values: creditAccount and debitAccount. What if you support using an regular expression for the @Named annotation instead of allowing just one value? That could be one way to solve it. The method ParameterisedStep.parametriseStep() would need to be adapted accordingly to support that logic. 2014-02-07 Hans Schwäbli bugs.need.love@gmail.com: Hello Mauro, I took the time to create an example project for Eclipse so that you can reproduce it. I attached the zip file to this email. Hopfully it is passed to the mailing list. If not, I will have to upload it somewhere and tell you the download link. You will see that it is not working as I expect it. My intention is to use the data from the examples table to pass it into the step. I have to use two different variable names for the account number, since I use both credit account number and debit account number in the examples table. If I would only use one account number in the examples table it would pass the value into the method. But with the way how I tried to use it, debitAccount and creditAccount are passed into the step method instead of the actual values from the examples table. I hope you can help me to achieve my goal. 2014-02-06 Mauro Talevi mauro.tal...@aquilonia.org: Hi what is the stated intention here? You want two steps to match the same method with different parameter names? Can you please provide a sample project - inclusive of textual stories and steps class that reproduces your issue? Thanks On 06/02/2014 16:52, Hans Schwäbli wrote: I have two steps like this with a examples table where the values are defined: Given the account data of debitAccount is known Given the account data of creditAccount is known First I tried this in the step class method for the two steps above: @Given(the account data of $debitAccount is known) It works only for the first of the two steps. But the second step gets value creditAccount passed into the method instead of the actual value from the examples table. So I changed the annotation to be like this: @Given(the account data of $acount is known) But this does not work for both steps above since debitAccount and creditAccount is passed into the method instead of the actual values. Then I tried it with an alias: @Given(the account data of debitAccount is known) @Alias(the account data of creditAccount is known) The result was that the story failed without showing me why (no exception or any meaningful message). I tried also some other things with no success. I use JBehave 3.9 by the way. Can you please tell me the solution? - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
[jbehave-user] Problem with parameter injection when an examples table is used
I have two steps like this with a examples table where the values are defined: Given the account data of debitAccount is known Given the account data of creditAccount is known First I tried this in the step class method for the two steps above: @Given(the account data of $debitAccount is known) It works only for the first of the two steps. But the second step gets value creditAccount passed into the method instead of the actual value from the examples table. So I changed the annotation to be like this: @Given(the account data of $acount is known) But this does not work for both steps above since debitAccount and creditAccount is passed into the method instead of the actual values. Then I tried it with an alias: @Given(the account data of debitAccount is known) @Alias(the account data of creditAccount is known) The result was that the story failed without showing me why (no exception or any meaningful message). I tried also some other things with no success. I use JBehave 3.9 by the way. Can you please tell me the solution?
Re: [jbehave-user] Problem with parameter injection when an examples table is used
Hi what is the stated intention here? You want two steps to match the same method with different parameter names? Can you please provide a sample project - inclusive of textual stories and steps class that reproduces your issue? Thanks On 06/02/2014 16:52, Hans Schwäbli wrote: I have two steps like this with a examples table where the values are defined: Given the account data of debitAccount is known Given the account data of creditAccount is known First I tried this in the step class method for the two steps above: @Given(the account data of $debitAccount is known) It works only for the first of the two steps. But the second step gets value creditAccount passed into the method instead of the actual value from the examples table. So I changed the annotation to be like this: @Given(the account data of $acount is known) But this does not work for both steps above since debitAccount and creditAccount is passed into the method instead of the actual values. Then I tried it with an alias: @Given(the account data of debitAccount is known) @Alias(the account data of creditAccount is known) The result was that the story failed without showing me why (no exception or any meaningful message). I tried also some other things with no success. I use JBehave 3.9 by the way. Can you please tell me the solution? - To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email