gherkin.pickles.PickleRow Java Examples
The following examples show how to use
gherkin.pickles.PickleRow.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExtentCucumberAdapter.java From extentreports-cucumber4-adapter with Apache License 2.0 | 6 votes |
private synchronized void createTestStep(PickleStepTestStep testStep) { String stepName = testStep.getStepText(); TestSourcesModel.AstNode astNode = testSources.getAstNode(currentFeatureFile.get(), testStep.getStepLine()); if (astNode != null) { Step step = (Step) astNode.node; try { String name = stepName == null || stepName.isEmpty() ? step.getText().replace("<", "<").replace(">", ">") : stepName; ExtentTest t = scenarioThreadLocal.get() .createNode(new GherkinKeyword(step.getKeyword().trim()), step.getKeyword() + name, testStep.getCodeLocation()); stepTestThreadLocal.set(t); } catch (ClassNotFoundException e) { e.printStackTrace(); } } if (!testStep.getStepArgument().isEmpty()) { Argument argument = testStep.getStepArgument().get(0); if (argument instanceof PickleString) { createDocStringMap((PickleString)argument); } else if (argument instanceof PickleTable) { List<PickleRow> rows = ((PickleTable) argument).getRows(); stepTestThreadLocal.get().pass(MarkupHelper.createTable(getPickleTable(rows)).getMarkup()); } } }
Example #2
Source File: ExtentCucumberAdapter.java From extentreports-cucumber4-adapter with Apache License 2.0 | 6 votes |
private String[][] getPickleTable(List<PickleRow> rows) { String data[][] = null; int rowSize = rows.size(); for (int i = 0; i < rowSize; i++) { PickleRow row = rows.get(i); List<PickleCell> cells = row.getCells(); int cellSize = cells.size(); if (data == null) { data = new String[rowSize][cellSize]; } for (int j = 0; j < cellSize; j++) { data[i][j] = cells.get(j).getValue(); } } return data; }
Example #3
Source File: AllureCucumber2Jvm.java From allure-java with Apache License 2.0 | 6 votes |
private void createDataTableAttachment(final PickleTable pickleTable) { final List<PickleRow> rows = pickleTable.getRows(); final StringBuilder dataTableCsv = new StringBuilder(); if (!rows.isEmpty()) { rows.forEach(dataTableRow -> { dataTableCsv.append( dataTableRow.getCells().stream() .map(PickleCell::getValue) .collect(Collectors.joining("\t")) ); dataTableCsv.append('\n'); }); final String attachmentSource = lifecycle .prepareAttachment("Data table", "text/tab-separated-values", "csv"); lifecycle.writeAttachment(attachmentSource, new ByteArrayInputStream(dataTableCsv.toString().getBytes(StandardCharsets.UTF_8))); } }
Example #4
Source File: AllureCucumber4Jvm.java From allure-java with Apache License 2.0 | 6 votes |
private void createDataTableAttachment(final PickleTable pickleTable) { final List<PickleRow> rows = pickleTable.getRows(); final StringBuilder dataTableCsv = new StringBuilder(); if (!rows.isEmpty()) { rows.forEach(dataTableRow -> { dataTableCsv.append( dataTableRow.getCells().stream() .map(PickleCell::getValue) .collect(Collectors.joining("\t")) ); dataTableCsv.append('\n'); }); final String attachmentSource = lifecycle .prepareAttachment("Data table", "text/tab-separated-values", "csv"); lifecycle.writeAttachment(attachmentSource, new ByteArrayInputStream(dataTableCsv.toString().getBytes(StandardCharsets.UTF_8))); } }
Example #5
Source File: AllureCucumber3Jvm.java From allure-java with Apache License 2.0 | 6 votes |
private void createDataTableAttachment(final PickleTable pickleTable) { final List<PickleRow> rows = pickleTable.getRows(); final StringBuilder dataTableCsv = new StringBuilder(); if (!rows.isEmpty()) { rows.forEach(dataTableRow -> { dataTableCsv.append( dataTableRow.getCells().stream() .map(PickleCell::getValue) .collect(Collectors.joining("\t")) ); dataTableCsv.append('\n'); }); final String attachmentSource = lifecycle .prepareAttachment("Data table", "text/tab-separated-values", "csv"); lifecycle.writeAttachment(attachmentSource, new ByteArrayInputStream(dataTableCsv.toString().getBytes(StandardCharsets.UTF_8))); } }
Example #6
Source File: DataTableUtils.java From akita with Apache License 2.0 | 5 votes |
public static DataTable dataTableFromLists(List<List<String>> lists) { List<PickleRow> rows = new ArrayList<>(); lists.forEach(list -> { List<PickleCell> cells = new ArrayList<>(); list.forEach(string -> { cells.add(new PickleCell(null,string)); }); rows.add(new PickleRow(cells)); }); return new DataTable(new PickleTable(rows), null); }