Skip to content

Commit

Permalink
add support for epics (fixes #446, via #467)
Browse files Browse the repository at this point in the history
  • Loading branch information
baev committed Jul 10, 2017
1 parent b3f9cf2 commit 4801ecb
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
Expand Up @@ -23,6 +23,7 @@
import java.util.stream.Collectors;

import static io.qameta.allure.entity.ExtraStatisticMethods.comparator;
import static io.qameta.allure.entity.LabelName.EPIC;
import static io.qameta.allure.entity.LabelName.FEATURE;
import static io.qameta.allure.entity.LabelName.STORY;
import static io.qameta.allure.tree.TreeUtils.calculateStatisticByChildren;
Expand Down Expand Up @@ -53,7 +54,7 @@ public void aggregate(final Configuration configuration,
// @formatter:off
final Tree<TestResult> behaviors = new DefaultTree<>(
"behaviors",
testResult -> groupByLabels(testResult, FEATURE, STORY),
testResult -> groupByLabels(testResult, EPIC, FEATURE, STORY),
TestResultTreeLeaf::create
);
// @formatter:on
Expand Down
Expand Up @@ -66,6 +66,31 @@ public void storiesPerFeatureResultsAggregation() throws IOException {
.containsExactly(Tuple.tuple(2L, 0L));
}

@Test
public void shouldGroupByEpic() throws Exception {
final Configuration configuration = mock(Configuration.class);

final Set<TestResult> testResults = new HashSet<>();
testResults.add(new TestResult()
.withStatus(Status.PASSED)
.withLabels(epic("e1"), feature("f1"), story("s1")));
testResults.add(new TestResult()
.withStatus(Status.FAILED)
.withLabels(epic("e2"), feature("f2"), story("s2")));

LaunchResults results = new DefaultLaunchResults(testResults, Collections.emptyMap(), Collections.emptyMap());

TreeWidgetData behaviorsData = (TreeWidgetData) new BehaviorsPlugin().getData(configuration,
Collections.singletonList(results));

assertThat(behaviorsData.getItems())
.extracting("name")
.containsExactlyInAnyOrder("e1", "e2");
}

private Label epic(final String value) {
return new Label().withName("epic").withValue(value);
}

private Label feature(final String value) {
return new Label().withName("feature").withValue(value);
Expand Down

0 comments on commit 4801ecb

Please sign in to comment.