cucumber.api.PickleStepTestStep Java Examples
The following examples show how to use
cucumber.api.PickleStepTestStep.
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: AllureCucumber4Jvm.java From allure-java with Apache License 2.0 | 6 votes |
private void handleTestStepStarted(final TestStepStarted event) { if (event.testStep instanceof PickleStepTestStep) { final PickleStepTestStep pickleStep = (PickleStepTestStep) event.testStep; final String stepKeyword = Optional.ofNullable( testSources.getKeywordFromSource(currentFeatureFile.get(), pickleStep.getStepLine()) ).orElse("UNDEFINED"); final StepResult stepResult = new StepResult() .setName(String.format("%s %s", stepKeyword, pickleStep.getPickleStep().getText())) .setStart(System.currentTimeMillis()); lifecycle.startStep(getTestCaseUuid(currentTestCase.get()), getStepUuid(pickleStep), stepResult); pickleStep.getStepArgument().stream() .filter(PickleTable.class::isInstance) .findFirst() .ifPresent(table -> createDataTableAttachment((PickleTable) table)); } else if (event.testStep instanceof HookTestStep) { initHook((HookTestStep) event.testStep); } }
Example #3
Source File: AllureCucumber3Jvm.java From allure-java with Apache License 2.0 | 6 votes |
private void handleTestStepStarted(final TestStepStarted event) { if (event.testStep instanceof PickleStepTestStep) { final PickleStepTestStep pickleStep = (PickleStepTestStep) event.testStep; final String stepKeyword = Optional.ofNullable( cucumberSourceUtils.getKeywordFromSource(currentFeatureFile, pickleStep.getStepLine()) ).orElse("UNDEFINED"); final StepResult stepResult = new StepResult() .setName(String.format("%s %s", stepKeyword, pickleStep.getPickleStep().getText())) .setStart(System.currentTimeMillis()); lifecycle.startStep(getTestCaseUuid(currentTestCase), getStepUuid(pickleStep), stepResult); pickleStep.getStepArgument().stream() .filter(PickleTable.class::isInstance) .findFirst() .ifPresent(table -> createDataTableAttachment((PickleTable) table)); } else if (event.testStep instanceof HookTestStep) { initHook((HookTestStep) event.testStep); } }
Example #4
Source File: AllureCucumber4Jvm.java From allure-java with Apache License 2.0 | 5 votes |
private void handlePickleStep(final TestStepFinished event) { final Status stepStatus = translateTestCaseStatus(event.result); final StatusDetails statusDetails; if (event.result.getStatus() == Result.Type.UNDEFINED) { updateTestCaseStatus(Status.PASSED); statusDetails = getStatusDetails(new PendingException("TODO: implement me")) .orElse(new StatusDetails()); lifecycle.updateTestCase(getTestCaseUuid(currentTestCase.get()), scenarioResult -> scenarioResult .setStatusDetails(statusDetails)); } else { statusDetails = getStatusDetails(event.result.getError()) .orElse(new StatusDetails()); updateTestCaseStatus(stepStatus); } if (!Status.PASSED.equals(stepStatus) && stepStatus != null) { forbidTestCaseStatusChange.set(true); } final TagParser tagParser = new TagParser(currentFeature.get(), currentTestCase.get()); statusDetails .setFlaky(tagParser.isFlaky()) .setMuted(tagParser.isMuted()) .setKnown(tagParser.isKnown()); lifecycle.updateStep(getStepUuid((PickleStepTestStep) event.testStep), stepResult -> stepResult.setStatus(stepStatus).setStatusDetails(statusDetails)); lifecycle.stopStep(getStepUuid((PickleStepTestStep) event.testStep)); }
Example #5
Source File: CucumberReporter.java From bdt with Apache License 2.0 | 5 votes |
private void handleTestStepFinished(TestStepFinished event) { if (event.testStep instanceof PickleStepTestStep) { testMethod.steps.add((PickleStepTestStep) event.testStep); testMethod.results.add(event.result); } else { testMethod.hooks.add(event.result); } }
Example #6
Source File: AllureCucumber4Jvm.java From allure-java with Apache License 2.0 | 4 votes |
private String getStepUuid(final PickleStepTestStep step) { return currentFeature.get().getName() + getTestCaseUuid(currentTestCase.get()) + step.getPickleStep().getText() + step.getStepLine(); }
Example #7
Source File: AllureCucumber3Jvm.java From allure-java with Apache License 2.0 | 4 votes |
private String getStepUuid(final PickleStepTestStep step) { return currentFeature.getName() + getTestCaseUuid(currentTestCase) + step.getPickleStep().getText() + step.getStepLine(); }
Example #8
Source File: AllureCucumber3Jvm.java From allure-java with Apache License 2.0 | 4 votes |
private void handlePickleStep(final TestStepFinished event) { final Status stepStatus = translateTestCaseStatus(event.result); final StatusDetails statusDetails; if (event.result.getStatus() == Result.Type.UNDEFINED) { updateTestCaseStatus(Status.PASSED); statusDetails = getStatusDetails(new PendingException("TODO: implement me")) .orElse(new StatusDetails()); lifecycle.updateTestCase(getTestCaseUuid(currentTestCase), scenarioResult -> scenarioResult .setStatusDetails(statusDetails)); } else { statusDetails = getStatusDetails(event.result.getError()) .orElse(new StatusDetails()); updateTestCaseStatus(stepStatus); } if (!Status.PASSED.equals(stepStatus) && stepStatus != null) { forbidTestCaseStatusChange = true; } final TagParser tagParser = new TagParser(currentFeature, currentTestCase); statusDetails .setFlaky(tagParser.isFlaky()) .setMuted(tagParser.isMuted()) .setKnown(tagParser.isKnown()); lifecycle.updateStep(getStepUuid((PickleStepTestStep) event.testStep), stepResult -> stepResult.setStatus(stepStatus).setStatusDetails(statusDetails)); lifecycle.stopStep(getStepUuid((PickleStepTestStep) event.testStep)); }