• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ExamplesTable类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jbehave.core.model.ExamplesTable的典型用法代码示例。如果您正苦于以下问题:Java ExamplesTable类的具体用法?Java ExamplesTable怎么用?Java ExamplesTable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ExamplesTable类属于org.jbehave.core.model包,在下文中一共展示了ExamplesTable类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: runScenariosParametrisedByExamples

import org.jbehave.core.model.ExamplesTable; //导入依赖的package包/类
private void runScenariosParametrisedByExamples(RunContext context, Scenario scenario, Meta storyAndScenarioMeta)
         throws Throwable {
     ExamplesTable table = scenario.getExamplesTable();
     reporter.get().beforeExamples(scenario.getSteps(), table);
 	Keywords keywords = context.configuration().keywords();
     for (Map<String, String> scenarioParameters : table.getRows()) {
Meta parameterMeta = parameterMeta(keywords, scenarioParameters);
if ( !parameterMeta.isEmpty() && !context.filter.allow(parameterMeta) ){
	continue;
}
         reporter.get().example(scenarioParameters);
         if (context.configuration().storyControls().resetStateBeforeScenario()) {
             context.resetState();
         }
         runBeforeOrAfterScenarioSteps(context, scenario, storyAndScenarioMeta, Stage.BEFORE, ScenarioType.EXAMPLE);
         addMetaParameters(scenarioParameters, storyAndScenarioMeta);
         runGivenStories(scenario.getGivenStories(), scenarioParameters, context);
         runScenarioSteps(context, scenario, scenarioParameters);
         runBeforeOrAfterScenarioSteps(context, scenario, storyAndScenarioMeta, Stage.AFTER, ScenarioType.EXAMPLE);
     }
     reporter.get().afterExamples();
 }
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:23,代码来源:StoryRunner.java


示例2: parseScenario

import org.jbehave.core.model.ExamplesTable; //导入依赖的package包/类
private Scenario parseScenario(String scenarioAsText) {
    String title = findScenarioTitle(scenarioAsText);
    String scenarioWithoutKeyword = removeStart(scenarioAsText, keywords.scenario()).trim();
    String scenarioWithoutTitle = removeStart(scenarioWithoutKeyword, title);
    if ( !scenarioWithoutTitle.startsWith("\n") ){ // always ensure scenario starts with newline
        scenarioWithoutTitle = "\n" + scenarioWithoutTitle;
    }
    Meta meta = findScenarioMeta(scenarioWithoutTitle);
    ExamplesTable examplesTable = findExamplesTable(scenarioWithoutTitle);
    GivenStories givenStories = findScenarioGivenStories(scenarioWithoutTitle);
    if (givenStories.requireParameters()) {
        givenStories.useExamplesTable(examplesTable);
    }
    List<String> steps = findSteps(scenarioWithoutTitle);
    return new Scenario(title, meta, givenStories, examplesTable, steps);
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:17,代码来源:RegexStoryParser.java


示例3: print

import org.jbehave.core.model.ExamplesTable; //导入依赖的package包/类
/**
 * Prints text to output stream, replacing parameter start and end
 * placeholders
 * 
 * @param text the String to print
 */
protected void print(String text) {
    if (containsTable(text)) {
        String tableStart = format(PARAMETER_TABLE_START, PARAMETER_TABLE_START);
        String tableEnd = format(PARAMETER_TABLE_END, PARAMETER_TABLE_END);
        String tableAsString = substringBetween(text, tableStart, tableEnd);
        output.print(text
                .replace(tableAsString, formatTable(new ExamplesTable(tableAsString)))
                .replace(tableStart, format("parameterValueStart", EMPTY))
                .replace(tableEnd, format("parameterValueEnd", EMPTY))
                .replace(format(PARAMETER_VALUE_NEWLINE, PARAMETER_VALUE_NEWLINE),
                        format("parameterValueNewline", "\n")));
    } else {
        output.print(text
                .replace(format(PARAMETER_VALUE_START, PARAMETER_VALUE_START), format("parameterValueStart", EMPTY))
                .replace(format(PARAMETER_VALUE_END, PARAMETER_VALUE_END), format("parameterValueEnd", EMPTY))
                .replace(format(PARAMETER_VALUE_NEWLINE, PARAMETER_VALUE_NEWLINE),
                        format("parameterValueNewline", "\n")));
    }
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:26,代码来源:PrintStreamOutput.java


示例4: shouldConvertMultilineTableParameter

import org.jbehave.core.model.ExamplesTable; //导入依赖的package包/类
@Test
public void shouldConvertMultilineTableParameter() throws ParseException, IntrospectionException {
    ParameterConverter converter = new ExamplesTableConverter();
    assertThat(converter.accept(ExamplesTable.class), is(true));
    assertThat(converter.accept(WrongType.class), is(false));
    assertThat(converter.accept(mock(Type.class)), is(false));
    Type type = SomeSteps.methodFor("aMethodWithExamplesTable").getGenericParameterTypes()[0];
    String value = "|col1|col2|\n|row11|row12|\n|row21|row22|\n";
    ExamplesTable table = (ExamplesTable) converter.convertValue(value, type);
    assertThat(table.getRowCount(), equalTo(2));
    Map<String, String> row1 = table.getRow(0);
    assertThat(row1.get("col1"), equalTo("row11"));
    assertThat(row1.get("col2"), equalTo("row12"));
    Map<String, String> row2 = table.getRow(1);
    assertThat(row2.get("col1"), equalTo("row21"));
    assertThat(row2.get("col2"), equalTo("row22"));
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:18,代码来源:ParameterConvertersBehaviour.java


示例5: shouldConvertParameterFromMethodReturningValue

import org.jbehave.core.model.ExamplesTable; //导入依赖的package包/类
@Test
public void shouldConvertParameterFromMethodReturningValue() throws ParseException, IntrospectionException {
    Method method = SomeSteps.methodFor("aMethodReturningExamplesTable");
    ParameterConverter converter = new MethodReturningConverter(method, new SomeSteps());
    assertThat(converter.accept(method.getReturnType()), is(true));
    assertThat(converter.accept(WrongType.class), is(false));
    assertThat(converter.accept(mock(Type.class)), is(false));
    String value = "|col1|col2|\n|row11|row12|\n|row21|row22|\n";
    ExamplesTable table = (ExamplesTable) converter.convertValue(value, ExamplesTable.class);
    assertThat(table.getRowCount(), equalTo(2));
    Map<String, String> row1 = table.getRow(0);
    assertThat(row1.get("col1"), equalTo("row11"));
    assertThat(row1.get("col2"), equalTo("row12"));
    Map<String, String> row2 = table.getRow(1);
    assertThat(row2.get("col1"), equalTo("row21"));
    assertThat(row2.get("col2"), equalTo("row22"));
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:18,代码来源:ParameterConvertersBehaviour.java


示例6: shouldNotRunScenariosNotAllowedByFilter

import org.jbehave.core.model.ExamplesTable; //导入依赖的package包/类
@Test
public void shouldNotRunScenariosNotAllowedByFilter() throws Throwable {
    // Given
    StoryReporter reporter = mock(ConcurrentStoryReporter.class);
    StepCollector collector = mock(StepCollector.class);
    FailureStrategy strategy = mock(FailureStrategy.class);
    CandidateSteps mySteps = new Steps();
    when(collector.collectScenarioSteps(eq(asList(mySteps)), (Scenario) anyObject(), eq(parameters))).thenReturn(
            Arrays.<Step>asList());
    Meta meta = new Meta(asList("some property"));
    Story story = new Story("", Description.EMPTY, Meta.EMPTY, Narrative.EMPTY, asList(new Scenario("", meta, GivenStories.EMPTY, ExamplesTable.EMPTY, asList(""))));
    boolean givenStory = false;
    givenStoryWithNoBeforeOrAfterSteps(story, givenStory, collector, mySteps);
    String filterAsString = "-some property";
    MetaFilter filter = new MetaFilter(filterAsString);

    // When
    StoryRunner runner = new StoryRunner();
    runner.run(configurationWith(reporter, collector, strategy), asList(mySteps), story, filter);

    // Then
    verify(reporter).beforeStory(story, givenStory);
    verify(reporter).beforeScenario("");
    verify(reporter).scenarioNotAllowed(story.getScenarios().get(0), filterAsString);
    verify(reporter).afterScenario();
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:27,代码来源:StoryRunnerBehaviour.java


示例7: narrateAnInterestingStoryNotAllowedByFilter

import org.jbehave.core.model.ExamplesTable; //导入依赖的package包/类
static void narrateAnInterestingStoryNotAllowedByFilter(StoryReporter reporter, boolean storyNotAllowed) {
    Properties meta = new Properties();
    meta.setProperty("theme", "testing");
    meta.setProperty("author", "Mauro");
    Story story = new Story("/path/to/story",
            new Description("An interesting story"), new Meta(meta), new Narrative("renovate my house", "customer", "get a loan"),
            Arrays.asList(new Scenario("A scenario", new Meta(meta), GivenStories.EMPTY, ExamplesTable.EMPTY, new ArrayList<String>())));
    reporter.beforeStory(story, false);
    if (storyNotAllowed) {
        reporter.storyNotAllowed(story, "-theme testing");
    } else  {
        reporter.beforeScenario(story.getScenarios().get(0).getTitle());
        reporter.scenarioNotAllowed(story.getScenarios().get(0), "-theme testing");
        reporter.afterScenario();
    }
    reporter.afterStory(false);
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:18,代码来源:StoryNarrator.java


示例8: whenTableValueIfNotVariable

import org.jbehave.core.model.ExamplesTable; //导入依赖的package包/类
@Test
public void whenTableValueIfNotVariable() {
    String table = "|Table_Head2|Table_Head3|\r\n|Value2.2|Value3.3|";
    ExamplesTable expectedTable = new ExamplesTable(table);
    ExamplesTable actualTable = variablesSteps.getTableValueIfVariable
            (table);
    Assert.assertEquals(expectedTable.getRows(), actualTable.getRows());
}
 
开发者ID:tapack,项目名称:satisfy,代码行数:9,代码来源:WhenGenerateDataAndUseVariablesTest.java


示例9: whenTableValueIfVariable

import org.jbehave.core.model.ExamplesTable; //导入依赖的package包/类
@Test
public void whenTableValueIfVariable() {
    SessionVariablesUtils.save("test", "Value3.3");
    String table = "|Table_Head2|Table_Head3|\r\n|Value2.2|Value3.3|";
    ExamplesTable examplesTable = new ExamplesTable(table);
    ExamplesTable actualTable = variablesSteps.getTableValueIfVariable
            ("|Table_Head2|Table_Head3|\r\n|Value2.2|${test}|");
    Assert.assertEquals(examplesTable.getRows(), actualTable.getRows());
}
 
开发者ID:tapack,项目名称:satisfy,代码行数:10,代码来源:WhenGenerateDataAndUseVariablesTest.java


示例10: readableFormOf

import org.jbehave.core.model.ExamplesTable; //导入依赖的package包/类
public static String readableFormOf(Object arg) {
    if (arg == null) {
        return "<null>";
    } else if (arg.getClass().isArray()) {
        return ArrayUtils.toString(arg);
    } else if (arg instanceof ExamplesTable) {
        return "\n" + ((ExamplesTable) arg).asString();
    } else {
        return arg.toString();
    }
}
 
开发者ID:tapack,项目名称:satisfy,代码行数:12,代码来源:SatisfyStepArgumentWriter.java


示例11: create

import org.jbehave.core.model.ExamplesTable; //导入依赖的package包/类
public File create(String filename, ExamplesTable table) throws IOException {
    File dir = Files.createTempDir();
    File file = new File(dir, filename + CSV_SUFFIX);
    FileWriter writer = new FileWriter(file);
    writer.append(getCsvHeaders(table.getHeaders()))
            .append(getCsvBody(table.getHeaders(), table.getRows()));
    writer.flush();
    writer.close();
    return file;
}
 
开发者ID:tapack,项目名称:satisfy,代码行数:11,代码来源:TableToCsv.java


示例12: inTableClickOnIdentityInRowsWithParameters

import org.jbehave.core.model.ExamplesTable; //导入依赖的package包/类
@Override
public void inTableClickOnIdentityInRowsWithParameters(By elementIdentity, ExamplesTable params) {
    List<WebElement> matchedRows = getMatchedRows(params);
    if (matchedRows.isEmpty()) {
        throw new AssertionError("You should define at list one existing " +
                "record value");
    }
    for (WebElement matchedRow : matchedRows) {
        WebElement elementToClick = matchedRow.findElement
                (elementIdentity);
        webPage.clickOn(elementToClick);
    }
}
 
开发者ID:tapack,项目名称:satisfy,代码行数:14,代码来源:BaseTableSteps.java


示例13: whenInTableClickElementForRowWithParameters

import org.jbehave.core.model.ExamplesTable; //导入依赖的package包/类
@When("in '$identity' table click on '$element' for row with parameters: $params")
public void whenInTableClickElementForRowWithParameters(By identity,
                                                        By element,
                                                        ExamplesTable
                                                                params) {
    WebStepsFactory.getTableSteps(identity)
            .inTableClickOnIdentityInRowsWithParameters(element, params);
}
 
开发者ID:tapack,项目名称:satisfy,代码行数:9,代码来源:TableBddSteps.java


示例14: verifyThatInTableIsPresentRowRowWithParameters

import org.jbehave.core.model.ExamplesTable; //导入依赖的package包/类
@Then("verify that in table '$identity' present row where: $params")
public void verifyThatInTableIsPresentRowRowWithParameters(By identity,
                                                           ExamplesTable
                                                                   params) {
    WebStepsFactory.getTableSteps(identity)
            .tableContainsRowWithParameters(params);
}
 
开发者ID:tapack,项目名称:satisfy,代码行数:8,代码来源:TableBddSteps.java


示例15: verifyThatInTableIsAbsentRowWithParameters

import org.jbehave.core.model.ExamplesTable; //导入依赖的package包/类
@Then("verify that in table '$identity' is absent row where: $params")
public void verifyThatInTableIsAbsentRowWithParameters(By identity,
                                                       ExamplesTable
                                                               params) {
    WebStepsFactory.getTableSteps(identity)
            .tableDoesNotContainRowWithParameters(params);
}
 
开发者ID:tapack,项目名称:satisfy,代码行数:8,代码来源:TableBddSteps.java


示例16: beforeExamples

import org.jbehave.core.model.ExamplesTable; //导入依赖的package包/类
@Override
public void beforeExamples(List<String> steps, ExamplesTable table) {
    currentExamplesTable = new ExamplesTableResult(table);
    for(String step : steps) {
        currentScenario.addStepResult(new StepResult(step, Result.IGNORABLE));
    }
}
 
开发者ID:tumbarumba,项目名称:jbehave-specification-report,代码行数:8,代码来源:SpecificationStoryReporter.java


示例17: thenTheLineCommentsHaveTheFollowingPositions

import org.jbehave.core.model.ExamplesTable; //导入依赖的package包/类
@Then("the line comments have the following positions: $table")
public void thenTheLineCommentsHaveTheFollowingPositions(ExamplesTable examplesTable) {
    int index = 0;
    for(Parameters exampleRow : examplesTable.getRowsAsParameters()){
        Comment expectedLineComment = toComment(exampleRow, new LineComment());
        Comment lineCommentUnderTest = commentsCollection.getLineComments().get(index);

        assertThat(lineCommentUnderTest.getBeginLine(), is(expectedLineComment.getBeginLine()));
        assertThat(lineCommentUnderTest.getBeginColumn(), is(expectedLineComment.getBeginColumn()));
        assertThat(lineCommentUnderTest.getEndLine(), is(expectedLineComment.getEndLine()));
        assertThat(lineCommentUnderTest.getEndColumn(), is(expectedLineComment.getEndColumn()));
        index ++;
    }
}
 
开发者ID:plum-umd,项目名称:java-sketch,代码行数:15,代码来源:CommentParsingSteps.java


示例18: thenTheBlockCommentsHaveTheFollowingPositions

import org.jbehave.core.model.ExamplesTable; //导入依赖的package包/类
@Then("the block comments have the following positions: $table")
public void thenTheBlockCommentsHaveTheFollowingPositions(ExamplesTable examplesTable) {
    int index = 0;
    for(Parameters exampleRow : examplesTable.getRowsAsParameters()){
        Comment expectedLineComment = toComment(exampleRow, new BlockComment());
        Comment lineCommentUnderTest = commentsCollection.getBlockComments().get(index);

        assertThat(lineCommentUnderTest.getBeginLine(), is(expectedLineComment.getBeginLine()));
        assertThat(lineCommentUnderTest.getBeginColumn(), is(expectedLineComment.getBeginColumn()));
        assertThat(lineCommentUnderTest.getEndLine(), is(expectedLineComment.getEndLine()));
        assertThat(lineCommentUnderTest.getEndColumn(), is(expectedLineComment.getEndColumn()));
        index ++;
    }
}
 
开发者ID:plum-umd,项目名称:java-sketch,代码行数:15,代码来源:CommentParsingSteps.java


示例19: thenTheJavadocCommentsHaveTheFollowingPositions

import org.jbehave.core.model.ExamplesTable; //导入依赖的package包/类
@Then("the Javadoc comments have the following positions: $table")
public void thenTheJavadocCommentsHaveTheFollowingPositions(ExamplesTable examplesTable) {
    int index = 0;
    for(Parameters exampleRow : examplesTable.getRowsAsParameters()){
        Comment expectedLineComment = toComment(exampleRow, new BlockComment());
        Comment lineCommentUnderTest = commentsCollection.getJavadocComments().get(index);

        assertThat(lineCommentUnderTest.getBeginLine(), is(expectedLineComment.getBeginLine()));
        assertThat(lineCommentUnderTest.getBeginColumn(), is(expectedLineComment.getBeginColumn()));
        assertThat(lineCommentUnderTest.getEndLine(), is(expectedLineComment.getEndLine()));
        assertThat(lineCommentUnderTest.getEndColumn(), is(expectedLineComment.getEndColumn()));
        index ++;
    }
}
 
开发者ID:plum-umd,项目名称:java-sketch,代码行数:15,代码来源:CommentParsingSteps.java


示例20: givenTheFollowingAccounts

import org.jbehave.core.model.ExamplesTable; //导入依赖的package包/类
@Given("the following accounts: $accounts")
@Pending
public void givenTheFollowingAccounts(ExamplesTable accounts) {
    for(Map<String, String> account : accounts.getRows()) {
        String owner = account.get("owner");
        int points = Integer.parseInt(account.get("points"));
    }
}
 
开发者ID:bdd-in-action,项目名称:chapter-5,代码行数:9,代码来源:TransferringPointsSteps.java



注:本文中的org.jbehave.core.model.ExamplesTable类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ClientDowncall类代码示例发布时间:2022-05-22
下一篇:
Java GetSQLProgressDialog类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap