use of io.cucumber.plugin.event.Event in project cucumber-jvm by cucumber.
the class TeamCityPlugin method printTestCaseStarted.
private void printTestCaseStarted(TestCaseStarted event) {
TestCase testCase = event.getTestCase();
URI uri = testCase.getUri();
String timestamp = extractTimeStamp(event);
Location location = testCase.getLocation();
Predicate<Node> withLocation = candidate -> location.equals(candidate.getLocation());
List<Node> path = parsedTestSources.get(uri).stream().map(node -> node.findPathTo(withLocation)).filter(Optional::isPresent).map(Optional::get).findFirst().orElse(emptyList());
poppedNodes(path).forEach(node -> finishNode(timestamp, node));
pushedNodes(path).forEach(node -> startNode(uri, timestamp, node));
this.currentStack = path;
this.currentTestCase = testCase;
print(TEMPLATE_PROGRESS_TEST_STARTED, timestamp);
}
use of io.cucumber.plugin.event.Event in project cucumber-jvm by cucumber.
the class CanonicalEventOrderTest method verifyTestCaseStartedSortedCorrectly.
@Test
void verifyTestCaseStartedSortedCorrectly() {
final List<Event> greaterThan = Arrays.asList(runStarted, testRead, suggested);
for (final Event e : greaterThan) {
assertAll(() -> assertThat(comparator.compare(feature1Case1Started, e), greaterThan(EQUAL_TO)), () -> assertThat(comparator.compare(feature1Case2Started, e), greaterThan(EQUAL_TO)), () -> assertThat(comparator.compare(feature1Case3Started, e), greaterThan(EQUAL_TO)), () -> assertThat(comparator.compare(feature2Case1Started, e), greaterThan(EQUAL_TO)));
}
final List<Event> lessThan = Collections.singletonList(runFinished);
for (final Event e : lessThan) {
assertAll(() -> assertThat(comparator.compare(feature1Case1Started, e), lessThan(EQUAL_TO)), () -> assertThat(comparator.compare(feature1Case2Started, e), lessThan(EQUAL_TO)), () -> assertThat(comparator.compare(feature1Case3Started, e), lessThan(EQUAL_TO)), () -> assertThat(comparator.compare(feature2Case1Started, e), lessThan(EQUAL_TO)), () -> assertThat(comparator.compare(e, feature1Case1Started), greaterThan(EQUAL_TO)), () -> assertThat(comparator.compare(e, feature1Case2Started), greaterThan(EQUAL_TO)), () -> assertThat(comparator.compare(e, feature1Case3Started), greaterThan(EQUAL_TO)), () -> assertThat(comparator.compare(e, feature2Case1Started), greaterThan(EQUAL_TO)));
}
assertAll(() -> assertThat(comparator.compare(feature1Case1Started, feature1Case1Started), equalTo(EQUAL_TO)), () -> assertThat(comparator.compare(feature1Case1Started, feature1Case1Started2), lessThan(EQUAL_TO)), () -> assertThat(comparator.compare(feature1Case1Started, feature1Case2Started), lessThan(EQUAL_TO)), () -> assertThat(comparator.compare(feature1Case1Started, feature1Case2Started), lessThan(EQUAL_TO)), () -> assertThat(comparator.compare(feature1Case2Started, feature1Case3Started), lessThan(EQUAL_TO)), () -> assertThat(comparator.compare(feature1Case3Started, feature2Case1Started), lessThan(EQUAL_TO)));
}
Aggregations