Невозможно выполнить мета-фильтры в JBehave - PullRequest
0 голосов
/ 28 июня 2018

Как мой JUnitRunner не может выбрать сценарии с метатегом, указанным в JBehave.

Вот моя история:

Meta:
**@TestType Smoke**
Scenario: Verify Successful login flow
Given Init my scenario for <ScenarioName>
Given I successfully launch the application
When user enters <validusername> and <validpassword> and click on Login button
Then user is navigated to Home page
Then verify entered username should be displayed
Then I logout from the application
Then Complete Tear Down

Examples:
|ScenarioName|validusername|validpassword|
|Successful Login to Chiron|abcde|12345|


Scenario: Verify Failed login flow
Given Init my scenario for <ScenarioName>
Given I successfully launch the application
When user enters <invalidusername> and <invalidpassword> and click on Login button
Then user should be in Login page itself
Then Complete Tear Down

Examples:
|ScenarioName|invalidusername|invalidpassword|
|Verify Failed login|abcdefg|ijklmn|

Следующий файл моего бегуна:

public class JUnitRunnerWithTags extends JUnitStoryMaps {

    public JUnitRunnerWithTags() {
        configuredEmbedder().useMetaFilters(metaFilters());
    }

    @Override
    public Configuration configuration() {
        return new MostUsefulConfiguration()
            .useStoryReporterBuilder(new StoryReporterBuilder()
                .withCodeLocation(CodeLocations.codeLocationFromClass(this.getClass())));
    }

    @Override
    protected List<String> metaFilters() {
        return Arrays.asList("**+TestType Smoke**");
    }

    @Override
    protected List<String> storyPaths() {
        return new StoryFinder().findPaths(CodeLocations.codeLocationFromClass(this.getClass()), "**/LoginToApplication.story", "");

    }

    @Override
    public InjectableStepsFactory stepsFactory() {
        return new InstanceStepsFactory(configuration(),
                new HomePageSteps(),
                new DashboardSteps()
        );
    }

    @Test
    public void run() throws Throwable {
        super.run();
    }

}

Когда я запускаю вышеуказанный класс как тест JUnit, реальные тесты с тегом Smoke не запускаются и ничего не выполняется.

Вот что я получаю, когда выполняю приведенный выше код

Using controls EmbedderControls[batch=false,skip=false,generateViewAfterStories=true,ignoreFailureInStories=false,ignoreFailureInView=false,verboseFailures=false,verboseFiltering=false,storyTimeouts=300,threads=1,failOnStoryTimeout=false]
Processing system properties {}
Mapping story stories/functionaltest/login/LoginToApplication.story with meta filters [+TestType Smoke]
Generating maps view to 'D:\Cigniti\Work\Projects\automation\target\jbehave' using story maps 'StoryMaps[metaFilters=[, +TestType Smoke]]' 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}

1 Ответ

0 голосов
/ 28 июня 2018

Вы должны расширить JUnitStories (не JUnitStoryMaps) для запуска историй:

public class JUnitRunnerWithTags extends JUnitStories {

    public JUnitRunnerWithTags() {
        configuredEmbedder().useMetaFilters(Arrays.asList("**+TestType Smoke**"));
    }

...

Подробнее о:

...