Absolutely Yes!!!
My main goal is to run jbehave in multiple table with multiple columns
scenario.
Let see where I will reach..

On Thu, Oct 25, 2012 at 2:36 PM, Mauro Talevi <[email protected]>wrote:

>  Well done!  What was the problem, in the end?   If you have a user
> experience to report and share with others we can add it the documentation.
>
> Cheers
>
>
> On 25/10/2012 20:57, Gopu Shrestha wrote:
>
> Finally worked out..
> Here is the console report
>
>  Inside Method
> Processing system properties {}
> Using controls
> EmbedderControls[batch=false,skip=false,generateViewAfterStories=true,ignoreFailureInStories=false,ignoreFailureInView=false,verboseFailures=false,verboseFiltering=false,storyTimeoutInSecs=300,threads=1]
>
>  (BeforeStories)
>
>  Running story calculator.story
>
>  (calculator.story)
> Scenario: Narrative:
> As a Programmer
> I want to do mathematical computations
> In order to support my decisions
> Given the table of factors:
>
>  |first|second|
> |4|5|
> |3|2|
> |8|8|
>
>  When Columns to add
> Then the result:
>
>  |product|sum|
> |20|9|
> |6|5|
> |64|16|
>
>
>
>
>  (AfterStories)
>
>  Generating reports view to 'C:\BDD WorkingCopy\target\jbehave' using
> formats '[stats, console, txt]' and view properties '{defaultFormats=stats,
> decorateNonHtml=true, viewDirectory=view,
> decorated=ftl/jbehave-report-decorated.ftl,
> reports=ftl/jbehave-reports-with-totals.ftl, maps=ftl/jbehave-maps.ftl,
> navigator=ftl/jbehave-navigator.ftl, views=ftl/jbehave-views.ftl,
> nonDecorated=ftl/jbehave-report-non-decorated.ftl}'
> Reports view generated with 1 stories (of which 0 pending) containing 1
> scenarios (of which 0 pending)
>
>
>  package com.steps;
>
>
>  import java.util.ArrayList;
> import java.util.HashMap;
> import java.util.List;
> import java.util.Map;
>
>  import org.hamcrest.Matchers;
> import org.jbehave.core.annotations.Given;
> import org.jbehave.core.annotations.Then;
> import org.jbehave.core.annotations.When;
> import org.jbehave.core.model.ExamplesTable;
> import org.jbehave.core.model.OutcomesTable;
> import org.jbehave.core.steps.Parameters;
> import org.junit.Assert;
>
>
>  public class CalculatorSteps {
>
>  private ExamplesTable inputData;
>  private ArrayList<Map<String, Integer>> results;
>  private ExamplesTable ranksTable;
>  private Object traders;
>
>  @Given("the table of factors: $ranksTable")
>  public void factors(ExamplesTable factors) {
> // System.out.println("executing given");
>  inputData = factors;
>  }
>
>  @When("Columns to add")
>  public void addingTwoNumbers()
>  {
> // System.out.println("executing when");
>  results = new ArrayList<Map<String, Integer>>();
>  for (Parameters parameter : inputData.getRowsAsParameters()) {
>  // Get the columns by header
>  int first = parameter.valueAs("first", Integer.class);
>  int second = parameter.valueAs("second", Integer.class);
> // System.out.println(first);
> // System.out.println(second);
>  HashMap<String, Integer> resultMap = new HashMap<String, Integer>();
>  // put them in a map by out table header
>  resultMap.put("product", first * second);
>  resultMap.put("sum", first + second);
>  results.add(resultMap);
>  }
>  }
>
>  @Then("the result: $resultTable")
>  public void assertAdditionResult(ExamplesTable resultTable) {
>  //System.out.println("executing then");
>     List<Map<String,String>> list = resultTable.getRows();
>           String product="";
>           String sum="";
>           int i =0;
>           for(Map<String,String> map:list){
>               product = map.get("product");
>
> Assert.assertEquals(Integer.parseInt(results.get(i).get("product").toString()),
> Integer.parseInt(product));
>
>                sum = map.get("sum");
>
> Assert.assertEquals(Integer.parseInt(results.get(i).get("sum").toString()),
> Integer.parseInt(sum));
>               i++;
>
>  /*
>  OutcomesTable expected = new OutcomesTable();
>  for (int i = 0; i < results.size(); i++) {
>  Parameters row =resultTable.getRowAsParameters(i);
>  Map<String, Integer> actual = results.get(i);
>  Assert.assertEquals(actual, row);
> */
> // for (String key : actual.keySet()) {
> // expected.addOutcome(key, actual.get(key),
> (Matchers.equalTo(row.valueAs(key, Integer.class))));
> // }
>  }
> // expected.verify();
>  }
>
>   }
>
>
> On Wed, Oct 24, 2012 at 6:26 PM, Gopu Shrestha <[email protected]>wrote:
>
>> I checked out the example project from Git and run build.xml.
>>
>>
>>  On Wed, Oct 24, 2012 at 4:14 PM, Alexander Lehmann 
>> <[email protected]>wrote:
>>
>>> How are you using jbehave inside Eclipse when you get the error?
>>>
>>> I initially assumed that you use Maven inside Eclipse, but that is
>>> probably not the case. I'm trying to reproduce the issue, but am not quite
>>> getting it.
>>>
>>>
>>>
>>> On 23.10.2012 18:57, Gopu Shrestha wrote:
>>>
>>>> Hi folks,
>>>>
>>>> I am getting this error, what could be the problem???
>>>>
>>>> (java.lang.SecurityException: class "org.hamcrest.Matchers"'s signer
>>>> information does not match signer information of other classes in the
>>>> same package)
>>>>
>>>> Inside Method
>>>> Processing system properties {}
>>>> Using controls
>>>>
>>>> EmbedderControls[batch=false,skip=false,generateViewAfterStories=true,ignoreFailureInStories=false,ignoreFailureInView=false,verboseFailures=false,verboseFiltering=false,storyTimeoutInSecs=300,threads=1]
>>>>
>>>> (BeforeStories)
>>>>
>>>> Running story calculator.story
>>>>
>>>> (calculator.story)
>>>> Scenario:
>>>> Given the table of factors:
>>>>
>>>> |first|second|
>>>> |4|5|
>>>> |3|2|
>>>> |8|8|
>>>>
>>>> When Columns to add
>>>> Then the result:
>>>>
>>>> |product|sum|
>>>> |20|9|
>>>> |6|5|
>>>> |64|16|
>>>>   (FAILED)
>>>> (java.lang.SecurityException: class "org.hamcrest.Matchers"'s signer
>>>> information does not match signer information of other classes in the
>>>> same package)
>>>>
>>>>
>>>>
>>>> (AfterStories)
>>>>
>>>> Generating reports view to 'C:\BDD WorkingCopy\target\jbehave' using
>>>> formats '[stats, console, txt]' and view properties
>>>> '{defaultFormats=stats, decorateNonHtml=true, viewDirectory=view,
>>>> decorated=ftl/jbehave-report-decorated.ftl,
>>>> reports=ftl/jbehave-reports-with-totals.ftl, maps=ftl/jbehave-maps.ftl,
>>>> navigator=ftl/jbehave-navigator.ftl, views=ftl/jbehave-views.ftl,
>>>> nonDecorated=ftl/jbehave-report-non-decorated.ftl}'
>>>> Reports view generated with 1 stories (of which 0 pending) containing 1
>>>> scenarios (of which 0 pending)
>>>>
>>>>
>>>
>>>
>>>   ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>    http://xircles.codehaus.org/manage_email
>>>
>>>
>>>
>>
>
>

Reply via email to