Re: StoryReporter being executed 3 times ...

2015-12-30 Thread Mauro Talevi
Hi,  thanks for the example.   It's a weird one and it requires some 
debugging.


On 29/12/2015 15:12, igal epshtein wrote:
I've upload some simple example, pls see that the Before/After stories 
is being executed several times , same has happens with the rest 
methods I'm implementing.


/Processing system properties {}/
/Using controls 
EmbedderControls[batch=false,skip=false,generateViewAfterStories=true,ignoreFailureInStories=false,ignoreFailureInView=false,verboseFailures=false,verboseFiltering=false,storyTimeouts=60,threads=1,failOnStoryTimeout=false]/

/
/
/(BeforeStories)/
/before -- BeforeStories/
/before -- BeforeStories/
/before -- BeforeStories/
/
/
/after -- /
/after -- /
/after -- /
/
/
/(AfterStories)/
/before -- AfterStories/
/before -- AfterStories/
/before -- AfterStories/
/
/
/after -- /
/after -- /
/after -- /
/Generating reports view to 
'/Users/ie54553/Desktop/JbehaveExample/target/jbehave' using formats 
'[console, txt, console, mystoryreporter, console, txt, console, 
mystoryreporter, console, txt, console, mystoryreporter]' and view 
properties '{navigator=ftl/jbehave-navigator.ftl, 
views=ftl/jbehave-views.ftl, reports=ftl/jbehave-reports.ftl, 
nonDecorated=ftl/jbehave-report-non-decorated.ftl, 
decorated=ftl/jbehave-report-decorated.ftl, maps=ftl/jbehave-maps.ftl}'/
/Disconnected from the target VM, address: '127.0.0.1:49948', 
transport: 'socket'/
/Reports view generated with 0 stories (of which 0 pending) containing 
0 scenarios (of which 0 pending)/

/
/
/Process finished with exit code 0/


On Tuesday, December 29, 2015 at 2:30:41 PM UTC+2, mauro.talevi wrote:

Difficult to help you without a working example that reproduces
the problem.

Can you please provide this working example project please?

On 29/12/2015 09:54, igal epshtein wrote:

Hi,
I'm implementing my own Reporter by extending StoryReporter.

The thing is , each override method being executed 3 times (one
after another) before the the execution moves to next method in
the execution flow

For example : *beforeStory (3 executions) ---> beforeScenario (3
executions) ---> afterScenario (3 executions)*
*
*
*
*
The running file looks like :

/public abstract class GenericScenario extends JUnitStories {
/
/  //set system time property in order to be appended to the log
file/
/  static {/
/  SimpleDateFormat dateFormat = new SimpleDateFormat("dd MMM
 - HH:mm:ss");/
/  System.setProperty("systemDate" , dateFormat.format(new
Date()));/
/  }/
/
/
/  public GenericScenario(){/
/  Embedder embedder = configuredEmbedder();/

/embedder.embedderControls().useStoryTimeouts(PropertiesSingelton.getInstance().getProperty("timeout"));/
/  embedder.useTimeoutParsers(new MyParser());/
/  embedder.configuration().useParameterConverters(/
/  configuration().parameterConverters().addConverters(/
/  new ParameterConverters.EnumConverter()));/
/
/
/  //adding skip support/
/  configuredEmbedder().useMetaFilters(Arrays.asList("-skip"));/
/  }/
/  public class MyParser implements StoryTimeouts.TimeoutParser{/
/  public boolean isValid(String timeout) {/
/  return timeout.matches("(\\d+)sec");/
/  }/
/
/
/  public long asSeconds(String timeout) {/
/  return
Long.parseLong(StringUtils.substringBefore(timeout, "sec"));/
/  }/
/  }/
/
/
/  @Override/
/  public Configuration configuration(){/
/  return new MostUsefulConfiguration().useStoryLoader(/
/  new LoadFromClasspath(this.getClass()))/
/ 
.useStoryReporterBuilder(storyReporter.withDefaultFormats()/

/  .withFormats(Format.TXT , Format.CONSOLE )/
/  .withReporters(new MyStoryReporter()))/
/  .useStoryControls(new
StoryControls().doSkipScenariosAfterFailure(true));/
/  }/
/
/
/
/
/  StoryReporterBuilder storyReporter = new StoryReporterBuilder() {/
/  /**/
/   * The builder is configured to build with the/
/   * StoryReporterBuilder.Format.STATS as default format. To
change/
/   * the default formats the user can override the method:/
/   *//
/  @Override/
/  public StoryReporterBuilder withDefaultFormats() {/
/  return withFormats(Format.CONSOLE);/
/  }/
/  };/
/
/
/  @Override/
/  public InjectableStepsFactory stepsFactory(){/
/  return new InstanceStepsFactory(configuration(), new
classes  );/
/  }/
/
/
/  @Override/
/  protected abstract List storyPaths();/
/}/


Any idea how to overcome the issue ?

Thanks
-- 
You received this message 

StoryReporter being executed 3 times ...

2015-12-29 Thread igal epshtein
Hi, 
I'm implementing my own Reporter by extending StoryReporter.

The thing is , each override method being executed 3 times (one after 
another) before the the execution moves to next method in the execution flow

For example : *beforeStory (3 executions) ---> beforeScenario (3 
executions) ---> afterScenario (3 executions)*


The running file looks like :


*public abstract class GenericScenario extends JUnitStories {*
*//set system time property in order to be appended to the log file*
*static {*
*SimpleDateFormat dateFormat = new SimpleDateFormat("dd MMM  - 
HH:mm:ss");*
*System.setProperty("systemDate" , dateFormat.format(new Date()));*
*}*

*public GenericScenario(){*
*Embedder embedder = configuredEmbedder();*
*
embedder.embedderControls().useStoryTimeouts(PropertiesSingelton.getInstance().getProperty("timeout"));*
*embedder.useTimeoutParsers(new MyParser());*
*embedder.configuration().useParameterConverters(*
*configuration().parameterConverters().addConverters(*
*new ParameterConverters.EnumConverter()));*

*//adding skip support*
*configuredEmbedder().useMetaFilters(Arrays.asList("-skip"));*
*}*
*public class MyParser implements StoryTimeouts.TimeoutParser{*
*public boolean isValid(String timeout) {*
*return timeout.matches("(\\d+)sec");*
*}*

*public long asSeconds(String timeout) {*
*return Long.parseLong(StringUtils.substringBefore(timeout, 
"sec"));*
*}*
*}*

*@Override*
*public Configuration configuration(){*
*return new MostUsefulConfiguration().useStoryLoader(*
*new LoadFromClasspath(this.getClass()))*
*
.useStoryReporterBuilder(storyReporter.withDefaultFormats()*
*.withFormats(Format.TXT , Format.CONSOLE )*
*.withReporters(new MyStoryReporter()))*
*.useStoryControls(new 
StoryControls().doSkipScenariosAfterFailure(true));*
*}*


*StoryReporterBuilder storyReporter = new StoryReporterBuilder() {*
*/***
* * The builder is configured to build with the*
* * StoryReporterBuilder.Format.STATS as default format. To change*
* * the default formats the user can override the method:*
* */*
*@Override*
*public StoryReporterBuilder withDefaultFormats() {*
*return withFormats(Format.CONSOLE);*
*}*
*};*

*@Override*
*public InjectableStepsFactory stepsFactory(){*
*return new InstanceStepsFactory(configuration(), new classes  
);*
*}*

*@Override*
*protected abstract List storyPaths();*
*}*


Any idea how to overcome the issue ?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"JBehave User" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jbehave-user+unsubscr...@googlegroups.com.
To post to this group, send an email to jbehave-user@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/jbehave-user/1c86948b-c814-43cd-8bfb-809d3eeda697%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: StoryReporter being executed 3 times ...

2015-12-29 Thread Mauro Talevi
Difficult to help you without a working example that reproduces the 
problem.


Can you please provide this working example project please?

On 29/12/2015 09:54, igal epshtein wrote:

Hi,
I'm implementing my own Reporter by extending StoryReporter.

The thing is , each override method being executed 3 times (one after 
another) before the the execution moves to next method in the 
execution flow


For example : *beforeStory (3 executions) ---> beforeScenario (3 
executions) ---> afterScenario (3 executions)*

*
*
*
*
The running file looks like :

/public abstract class GenericScenario extends JUnitStories {
/
///set system time property in order to be appended to the log file/
/static {/
/SimpleDateFormat dateFormat = new SimpleDateFormat("dd MMM  - 
HH:mm:ss");/

/System.setProperty("systemDate" , dateFormat.format(new Date()));/
/}/
/
/
/public GenericScenario(){/
/Embedder embedder = configuredEmbedder();/
/embedder.embedderControls().useStoryTimeouts(PropertiesSingelton.getInstance().getProperty("timeout"));/
/embedder.useTimeoutParsers(new MyParser());/
/embedder.configuration().useParameterConverters(/
/  configuration().parameterConverters().addConverters(/
/  new ParameterConverters.EnumConverter()));/
/
/
///adding skip support/
/configuredEmbedder().useMetaFilters(Arrays.asList("-skip"));/
/}/
/public class MyParser implements StoryTimeouts.TimeoutParser{/
/public boolean isValid(String timeout) {/
/  return timeout.matches("(\\d+)sec");/
/}/
/
/
/public long asSeconds(String timeout) {/
/  return Long.parseLong(StringUtils.substringBefore(timeout, "sec"));/
/}/
/}/
/
/
/@Override/
/public Configuration configuration(){/
/return new MostUsefulConfiguration().useStoryLoader(/
/  new LoadFromClasspath(this.getClass()))/
/.useStoryReporterBuilder(storyReporter.withDefaultFormats()/
/  .withFormats(Format.TXT , Format.CONSOLE )/
/  .withReporters(new MyStoryReporter()))/
/  .useStoryControls(new 
StoryControls().doSkipScenariosAfterFailure(true));/

/}/
/
/
/
/
/StoryReporterBuilder storyReporter = new StoryReporterBuilder() {/
//**/
/ * The builder is configured to build with the/
/ * StoryReporterBuilder.Format.STATS as default format. To 
change/

/ * the default formats the user can override the method:/
/ *//
/@Override/
/public StoryReporterBuilder withDefaultFormats() {/
/  return withFormats(Format.CONSOLE);/
/}/
/};/
/
/
/@Override/
/public InjectableStepsFactory stepsFactory(){/
/return new InstanceStepsFactory(configuration(), new classes  );/
/}/
/
/
/@Override/
/protected abstract List storyPaths();/
/}/


Any idea how to overcome the issue ?

Thanks
--
You received this message because you are subscribed to the Google 
Groups "JBehave User" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to jbehave-user+unsubscr...@googlegroups.com 
.
To post to this group, send email to jbehave-user@googlegroups.com 
.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/jbehave-user/1c86948b-c814-43cd-8bfb-809d3eeda697%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "JBehave 
User" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jbehave-user+unsubscr...@googlegroups.com.
To post to this group, send an email to jbehave-user@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/jbehave-user/56827CED.40001%40aquilonia.org.
For more options, visit https://groups.google.com/d/optout.