Hi,

I created my own storyloader to load my stories directly from jira.

The class looks like this:

package org.spilgames;

import java.io.IOException;

import org.apache.log4j.Logger;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
import org.jbehave.core.io.ResourceLoader;
import org.jbehave.core.io.StoryLoader;

public class MyStoryLoader implements ResourceLoader, StoryLoader {
  private static final Logger LOG = Logger.getLogger(MyStoryLoader.class);
  private String username;
  private String password;

  public MyStoryLoader(String username, String password) {
    this.password = password;
    this.username = username;
  }
// return story text
  @Override
  public String loadStoryAsText(String storyPath) {
    try {
      return new StoriesFromJira(username, 
password).getStoryFromJira(storyPath);
    } catch (JsonParseException e) {
      LOG.error(e.getMessage());
    } catch (JsonMappingException e) {
      LOG.error(e.getMessage());
    } catch (IOException e) {
      LOG.error(e.getMessage());
    }
    return null;
  }

//returns a list of story ids.
  @Override
  public String loadResourceAsText(String resourcePath) {
    try {
      return new StoriesFromJira(username, 
password).getStoryFromJira(resourcePath);
    } catch (JsonParseException e) {
      LOG.error(e.getMessage());
    } catch (JsonMappingException e) {
      LOG.error(e.getMessage());
    } catch (IOException e) {
      LOG.error(e.getMessage());
    }
    return null;
  }

}


this is how I use it:
config.useStoryLoader(new MyStoryLoader(jiraUsername,
          jiraPassword));


It all works fine, but all stories get executed every time. So that's why I 
defined some meta-filtering in the pom.xml file.

<metaFilters>
        <metaFilter>+group regression</metaFilter>
</metaFilters>


and in the jira scenarios:

Meta:
@group regression


But it still executes all the stories, instead of -ONLY- the ones with 
meta-filter regression.
It works, If I do the same, but then loading the stories from my project 
directly. (with default storyloader)


Any thoughts on what can be wrong here ?
Thanks,
Roy

Reply via email to