Java源码示例:io.qameta.allure.Feature
示例1
@Epic("epic1")
@Epic("epic2")
@Epic("epic3")
@Feature("feature1")
@Feature("feature2")
@Feature("feature3")
@Story("story1")
@Stories({
@Story("story2"),
@Story("story3")
})
@Owner("some-owner")
@TestFactory
Stream<DynamicTest> dynamicTestsFromStream() {
return Stream.of("A", "B", "C").map(
str -> dynamicTest("test" + str, () -> {
}));
}
示例2
private List<Label> getLabels(final AnnotatedElement annotatedElement) {
return Stream.of(
getAnnotations(annotatedElement, Epic.class).map(ResultsUtils::createLabel),
getAnnotations(annotatedElement, Feature.class).map(ResultsUtils::createLabel),
getAnnotations(annotatedElement, Story.class).map(ResultsUtils::createLabel)
).reduce(Stream::concat).orElseGet(Stream::empty).collect(Collectors.toList());
}
示例3
@Test
@Epic("epic1")
@Epic("epic2")
@Epic("epic3")
@Feature("feature1")
@Feature("feature2")
@Feature("feature3")
@Story("story1")
@Stories({
@Story("story2"),
@Story("story3")
})
@Owner("some-owner")
public void someTest() throws Exception {
}
示例4
@Test
@Epic("epic1")
@Epic("epic2")
@Epic("epic3")
@Feature("feature1")
@Feature("feature2")
@Feature("feature3")
@Story("story1")
@Stories({
@Story("story2"),
@Story("story3")
})
@Owner("some-owner")
void someTest() {
}
示例5
@Epic("epic1")
@Epic("epic2")
@Feature("feature1")
@Feature("feature2")
@Story("story1")
@Story("story2")
@Test
public void shouldHasBddAnnotations() throws Exception {
}
示例6
@Feature("A")
@Test
void second() {
}
示例7
public static Label createLabel(final Feature feature) {
return createFeatureLabel(feature.value());
}