cucumber.api.event.TestCaseStarted Java Examples
The following examples show how to use
cucumber.api.event.TestCaseStarted.
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 | 5 votes |
@Override public void setEventPublisher(EventPublisher publisher) { publisher.registerHandlerFor(TestSourceRead.class, testSourceReadHandler); publisher.registerHandlerFor(TestCaseStarted.class, caseStartedHandler); publisher.registerHandlerFor(TestStepStarted.class, stepStartedHandler); publisher.registerHandlerFor(TestStepFinished.class, stepFinishedHandler); publisher.registerHandlerFor(EmbedEvent.class, embedEventhandler); publisher.registerHandlerFor(WriteEvent.class, writeEventhandler); publisher.registerHandlerFor(TestRunFinished.class, runFinishedHandler); }
Example #2
Source File: ExtentCucumberAdapter.java From extentreports-cucumber4-adapter with Apache License 2.0 | 5 votes |
private synchronized void handleTestCaseStarted(TestCaseStarted event) { handleStartOfFeature(event.testCase); handleScenarioOutline(event.testCase); createTestCase(event.testCase); if (testSources.hasBackground(currentFeatureFile.get(), event.testCase.getLine())) { // background } }
Example #3
Source File: AllureCucumber2Jvm.java From allure-java with Apache License 2.0 | 5 votes |
@Override public void setEventPublisher(final EventPublisher publisher) { publisher.registerHandlerFor(TestSourceRead.class, featureStartedHandler); publisher.registerHandlerFor(TestCaseStarted.class, caseStartedHandler); publisher.registerHandlerFor(TestCaseFinished.class, caseFinishedHandler); publisher.registerHandlerFor(TestStepStarted.class, stepStartedHandler); publisher.registerHandlerFor(TestStepFinished.class, stepFinishedHandler); publisher.registerHandlerFor(WriteEvent.class, writeEventHandler); publisher.registerHandlerFor(EmbedEvent.class, embedEventHandler); }
Example #4
Source File: AllureCucumber4Jvm.java From allure-java with Apache License 2.0 | 5 votes |
@Override public void setEventPublisher(final EventPublisher publisher) { publisher.registerHandlerFor(TestSourceRead.class, featureStartedHandler); publisher.registerHandlerFor(TestCaseStarted.class, caseStartedHandler); publisher.registerHandlerFor(TestCaseFinished.class, caseFinishedHandler); publisher.registerHandlerFor(TestStepStarted.class, stepStartedHandler); publisher.registerHandlerFor(TestStepFinished.class, stepFinishedHandler); publisher.registerHandlerFor(WriteEvent.class, writeEventHandler); publisher.registerHandlerFor(EmbedEvent.class, embedEventHandler); }
Example #5
Source File: AllureCucumber3Jvm.java From allure-java with Apache License 2.0 | 5 votes |
@Override public void setEventPublisher(final EventPublisher publisher) { publisher.registerHandlerFor(TestSourceRead.class, featureStartedHandler); publisher.registerHandlerFor(TestCaseStarted.class, caseStartedHandler); publisher.registerHandlerFor(TestCaseFinished.class, caseFinishedHandler); publisher.registerHandlerFor(TestStepStarted.class, stepStartedHandler); publisher.registerHandlerFor(TestStepFinished.class, stepFinishedHandler); publisher.registerHandlerFor(WriteEvent.class, writeEventHandler); publisher.registerHandlerFor(EmbedEvent.class, embedEventHandler); }
Example #6
Source File: CucumberReportAdapter.java From openCypher with Apache License 2.0 | 5 votes |
private Consumer<Scenario> scenarioStartedEvent() { return scenario -> { Long startedAt = time(); String featureUri = checkNull(featureNameToUri.get(scenario.featureName())); Pickle pickle = scenario.source(); List<TestStep> steps = pickle.getSteps() .stream() .map(step -> new TCKTestStep(step, featureUri, outlineLocation(step.getLocations()))) .collect(Collectors.toList()); int line = outlineLocation(pickle.getLocations()); currentTestCase = new TCKTestCase(pickle, steps, featureUri, line); bus.handle(new TestCaseStarted(startedAt, currentTestCase)); }; }
Example #7
Source File: ExtentCucumberAdapter.java From extentreports-cucumber4-adapter with Apache License 2.0 | 4 votes |
@Override public void receive(TestCaseStarted event) { handleTestCaseStarted(event); }
Example #8
Source File: AllureCucumber2Jvm.java From allure-java with Apache License 2.0 | 4 votes |
private void handleTestCaseStarted(final TestCaseStarted event) { currentTestCase = event.testCase; currentFeatureFile = currentTestCase.getUri(); currentFeature = cucumberSourceUtils.getFeature(currentFeatureFile); currentContainer = UUID.randomUUID().toString(); forbidTestCaseStatusChange = false; final Deque<PickleTag> tags = new LinkedList<>(currentTestCase.getTags()); final LabelBuilder labelBuilder = new LabelBuilder(currentFeature, currentTestCase, tags); final String name = currentTestCase.getName(); final String featureName = currentFeature.getName(); final TestResult result = new TestResult() .setUuid(getTestCaseUuid(currentTestCase)) .setHistoryId(getHistoryId(currentTestCase)) .setFullName(featureName + ": " + name) .setName(name) .setLabels(labelBuilder.getScenarioLabels()) .setLinks(labelBuilder.getScenarioLinks()); final ScenarioDefinition scenarioDefinition = cucumberSourceUtils.getScenarioDefinition(currentFeatureFile, currentTestCase.getLine()); if (scenarioDefinition instanceof ScenarioOutline) { result.setParameters( getExamplesAsParameters((ScenarioOutline) scenarioDefinition) ); } if (currentFeature.getDescription() != null && !currentFeature.getDescription().isEmpty()) { result.setDescription(currentFeature.getDescription()); } final TestResultContainer resultContainer = new TestResultContainer() .setName(String.format("%s: %s", scenarioDefinition.getKeyword(), scenarioDefinition.getName())) .setUuid(getTestContainerUuid()) .setChildren(Collections.singletonList(getTestCaseUuid(currentTestCase))); lifecycle.scheduleTestCase(result); lifecycle.startTestContainer(getTestContainerUuid(), resultContainer); lifecycle.startTestCase(getTestCaseUuid(currentTestCase)); }
Example #9
Source File: AllureCucumber4Jvm.java From allure-java with Apache License 2.0 | 4 votes |
private void handleTestCaseStarted(final TestCaseStarted event) { currentFeatureFile.set(event.testCase.getUri()); currentFeature.set(testSources.getFeature(currentFeatureFile.get())); currentTestCase.set(event.testCase); currentContainer.set(UUID.randomUUID().toString()); forbidTestCaseStatusChange.set(false); final Deque<PickleTag> tags = new LinkedList<>(currentTestCase.get().getTags()); final Feature feature = currentFeature.get(); final LabelBuilder labelBuilder = new LabelBuilder(feature, currentTestCase.get(), tags); final String name = currentTestCase.get().getName(); final String featureName = feature.getName(); final TestResult result = new TestResult() .setUuid(getTestCaseUuid(currentTestCase.get())) .setHistoryId(getHistoryId(currentTestCase.get())) .setFullName(featureName + ": " + name) .setName(name) .setLabels(labelBuilder.getScenarioLabels()) .setLinks(labelBuilder.getScenarioLinks()); final ScenarioDefinition scenarioDefinition = testSources.getScenarioDefinition(currentFeatureFile.get(), currentTestCase.get().getLine()); if (scenarioDefinition instanceof ScenarioOutline) { result.setParameters( getExamplesAsParameters((ScenarioOutline) scenarioDefinition, currentTestCase.get()) ); } final String description = Stream.of(feature.getDescription(), scenarioDefinition.getDescription()) .filter(Objects::nonNull) .filter(s -> !s.isEmpty()) .collect(Collectors.joining("\n")); if (!description.isEmpty()) { result.setDescription(description); } final TestResultContainer resultContainer = new TestResultContainer() .setName(String.format("%s: %s", scenarioDefinition.getKeyword(), scenarioDefinition.getName())) .setUuid(getTestContainerUuid()) .setChildren(Collections.singletonList(getTestCaseUuid(currentTestCase.get()))); lifecycle.scheduleTestCase(result); lifecycle.startTestContainer(getTestContainerUuid(), resultContainer); lifecycle.startTestCase(getTestCaseUuid(currentTestCase.get())); }
Example #10
Source File: AllureCucumber3Jvm.java From allure-java with Apache License 2.0 | 4 votes |
private void handleTestCaseStarted(final TestCaseStarted event) { currentTestCase = event.testCase; currentFeatureFile = currentTestCase.getUri(); currentFeature = cucumberSourceUtils.getFeature(currentFeatureFile); currentContainer = UUID.randomUUID().toString(); forbidTestCaseStatusChange = false; final Deque<PickleTag> tags = new LinkedList<>(currentTestCase.getTags()); final LabelBuilder labelBuilder = new LabelBuilder(currentFeature, currentTestCase, tags); final String name = currentTestCase.getName(); final String featureName = currentFeature.getName(); final TestResult result = new TestResult() .setUuid(getTestCaseUuid(currentTestCase)) .setHistoryId(getHistoryId(currentTestCase)) .setFullName(featureName + ": " + name) .setName(name) .setLabels(labelBuilder.getScenarioLabels()) .setLinks(labelBuilder.getScenarioLinks()); final ScenarioDefinition scenarioDefinition = cucumberSourceUtils.getScenarioDefinition(currentFeatureFile, currentTestCase.getLine()); if (scenarioDefinition instanceof ScenarioOutline) { result.setParameters( getExamplesAsParameters((ScenarioOutline) scenarioDefinition) ); } if (currentFeature.getDescription() != null && !currentFeature.getDescription().isEmpty()) { result.setDescription(currentFeature.getDescription()); } final TestResultContainer resultContainer = new TestResultContainer() .setName(String.format("%s: %s", scenarioDefinition.getKeyword(), scenarioDefinition.getName())) .setUuid(getTestContainerUuid()) .setChildren(Collections.singletonList(getTestCaseUuid(currentTestCase))); lifecycle.scheduleTestCase(result); lifecycle.startTestContainer(getTestContainerUuid(), resultContainer); lifecycle.startTestCase(getTestCaseUuid(currentTestCase)); }