io.qameta.allure.Issue Java Examples

The following examples show how to use io.qameta.allure.Issue. 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: TestWithMethodLinks.java    From allure-java with Apache License 2.0 7 votes vote down vote up
@Test
@Link(name = "LINK-1")
@Links({
        @Link(name = "LINK-2", url = "https://example.org/link/2"),
        @Link(url = "https://example.org/some-custom-link")
})
@TmsLink("TMS-1")
@TmsLinks({
        @TmsLink("TMS-2"),
        @TmsLink("TMS-3")
})
@Issue("ISSUE-1")
@Issues({
        @Issue("ISSUE-2"),
        @Issue("ISSUE-3")
})
void someTest() {
}
 
Example #2
Source File: AllureTestNgTest.java    From allure-java with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@AllureFeatures.Fixtures
@Issue("67")
@Test(description = "Should set correct status for failed after fixtures")
public void shouldSetCorrectStatusForFailedAfterFixtures() {
    final Consumer<TestNG> configurer = parallel(XmlSuite.ParallelMode.METHODS, 5);

    final AllureResults results = runTestNgSuites(
            configurer,
            "suites/failed-after-suite-fixture.xml",
            "suites/failed-after-test-fixture.xml",
            "suites/failed-after-method-fixture.xml"
    );

    assertThat(results.getTestResultContainers())
            .flatExtracting(TestResultContainer::getAfters)
            .hasSize(3)
            .extracting(FixtureResult::getName, FixtureResult::getStatus)
            .containsExactlyInAnyOrder(
                    Tuple.tuple("afterSuite", Status.BROKEN),
                    Tuple.tuple("afterTest", Status.BROKEN),
                    Tuple.tuple("afterMethod", Status.BROKEN)
            );
}
 
Example #3
Source File: AllureTestNgTest.java    From allure-java with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@AllureFeatures.Parameters
@Issue("141")
@Test
public void shouldSupportFactoryOnConstructor() {
    final AllureResults results = runTestNgSuites("suites/gh-141.xml");
    assertThat(results.getTestResults())
            .flatExtracting(TestResult::getParameters)
            .extracting(Parameter::getName, Parameter::getValue)
            .containsExactlyInAnyOrder(
                    tuple("number", "1"),
                    tuple("number", "2"),
                    tuple("Name", "first"),
                    tuple("Name", "second")
            );
}
 
Example #4
Source File: AllureTestNgTest.java    From allure-java with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@AllureFeatures.Fixtures
@Issue("304")
@Test(dataProvider = "parallelConfiguration")
public void shouldProcessFailedSetUps(final XmlSuite.ParallelMode mode, final int threadCount) {
    final AllureResults results = runTestNgSuites(parallel(mode, threadCount), "suites/gh-304.xml");

    assertThat(results.getTestResults())
            .extracting(TestResult::getName, TestResult::getStatus)
            .contains(tuple("skippedTest", Status.SKIPPED));

    assertThat(results.getTestResultContainers())
            .flatExtracting(TestResultContainer::getAfters)
            .extracting(FixtureResult::getName, FixtureResult::getStatus)
            .contains(tuple("afterAlways", Status.PASSED));

    assertThat(results.getTestResultContainers())
            .flatExtracting(TestResultContainer::getAfters)
            .filteredOn("name", "afterAlways")
            .flatExtracting(FixtureResult::getSteps)
            .extracting(StepResult::getName)
            .containsExactly(
                    "first", "second"
            );
}
 
Example #5
Source File: AllureTestNgTest.java    From allure-java with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@AllureFeatures.Parameters
@Issue("128")
@Test
public void shouldProcessArrayParameters() {
    final AllureResults results = runTestNgSuites("suites/gh-128.xml");

    assertThat(results.getTestResults())
            .flatExtracting(TestResult::getParameters)
            .extracting(Parameter::getName, Parameter::getValue)
            .containsExactlyInAnyOrder(
                    tuple("first", "a"),
                    tuple("second", "false"),
                    tuple("third", "[1, 2, 3]")
            );
}
 
Example #6
Source File: LinksOnTests.java    From allure-java with Apache License 2.0 6 votes vote down vote up
@Test
@Links({
        @Link("nested1"),
        @Link("nested2"),
})
@Link("nested3")
@Issue("issue1")
@Issues({
        @Issue("issue2"),
        @Issue("issue3")
})
@TmsLink("tms1")
@TmsLinks({
        @TmsLink("tms2"),
        @TmsLink("tms3")
})
public void shouldHasLinksAsWell() throws Exception {

}
 
Example #7
Source File: AllureTestNgTest.java    From allure-java with Apache License 2.0 6 votes vote down vote up
@AllureFeatures.Fixtures
@Issue("135")
@Test
public void shouldProcessConfigurationFailure() {
    final AllureResults results = runTestNgSuites("suites/gh-135.xml");

    assertThat(results.getTestResults())
            .extracting(TestResult::getName, TestResult::getStatus)
            .containsExactlyInAnyOrder(
                    tuple("someTest", Status.SKIPPED),
                    tuple("failed configuration", Status.BROKEN)
            );

    assertThat(results.getTestResults())
            .filteredOn("name", "failed configuration")
            .extracting(ExecutableItem::getStatusDetails)
            .extracting(StatusDetails::getMessage)
            .containsExactly("fail");
}
 
Example #8
Source File: SuitesPluginTest.java    From allure2 with Apache License 2.0 6 votes vote down vote up
@Issue("587")
@Issue("572")
@Test
void shouldSortByStartTimeAsc() {
    final TestResult first = new TestResult()
            .setName("first")
            .setTime(new Time().setStart(10L));
    final TestResult second = new TestResult()
            .setName("second")
            .setTime(new Time().setStart(12L));
    final TestResult timeless = new TestResult()
            .setName("timeless");

    final Tree<TestResult> tree = SuitesPlugin.getData(
            createSingleLaunchResults(second, first, timeless)
    );

    assertThat(tree.getChildren())
            .extracting(TreeNode::getName)
            .containsExactly("timeless", "first", "second");
}
 
Example #9
Source File: AllureTestNgTest.java    From allure-java with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@AllureFeatures.Fixtures
@Issue("67")
@Test(description = "Should set correct status for failed before fixtures")
public void shouldSetCorrectStatusForFailedBeforeFixtures() {
    final AllureResults results = runTestNgSuites(
            "suites/failed-before-suite-fixture.xml",
            "suites/failed-before-test-fixture.xml",
            "suites/failed-before-method-fixture.xml"
    );

    assertThat(results.getTestResultContainers())
            .flatExtracting(TestResultContainer::getBefores)
            .hasSize(3)
            .extracting(FixtureResult::getName, FixtureResult::getStatus)
            .containsExactlyInAnyOrder(
                    Tuple.tuple("beforeSuite", Status.BROKEN),
                    Tuple.tuple("beforeTest", Status.BROKEN),
                    Tuple.tuple("beforeMethod", Status.BROKEN)
            );
}
 
Example #10
Source File: TrxPluginTest.java    From allure2 with Apache License 2.0 6 votes vote down vote up
@Issue("749")
@Test
void shouldParseClassNameAsSuite() throws Exception {
    process(
            "trxdata/gh-749.trx",
            "sample.trx"
    );

    final ArgumentCaptor<TestResult> captor = ArgumentCaptor.forClass(TestResult.class);
    verify(visitor, times(1)).visitTestResult(captor.capture());

    assertThat(captor.getAllValues())
            .extracting(result -> result.findOneLabel(LabelName.SUITE))
            .extracting(Optional::get)
            .containsOnly("TestClass");
}
 
Example #11
Source File: AllureTestNgTest.java    From allure-java with Apache License 2.0 6 votes vote down vote up
@AllureFeatures.MarkerAnnotations
@Issue("42")
@Test(description = "Should process flaky for failed tests")
public void shouldAddFlakyToFailedTests() {
    final AllureResults results = runTestNgSuites("suites/gh-42.xml");

    List<TestResult> testResults = results.getTestResults();
    assertThat(testResults)
            .hasSize(1)
            .filteredOn(flakyPredicate())
            .extracting(TestResult::getFullName)
            .hasSize(1)
            .containsExactly(
                    "io.qameta.allure.testng.samples.FailedFlakyTest.flakyWithFailure"
            );
}
 
Example #12
Source File: AllureJbehaveTest.java    From allure-java with Apache License 2.0 6 votes vote down vote up
@Issue("163")
@Test
void shouldNotFailIfGivenStoriesSpecified() {
    final AllureResults results = runStories("stories/given.story");

    assertThat(results.getTestResults())
            .extracting(TestResult::getName, TestResult::getStatus)
            .containsExactly(tuple("Add a to b", Status.PASSED));

    assertThat(results.getTestResults())
            .flatExtracting(TestResult::getSteps)
            .extracting(StepResult::getName)
            .containsExactly(
                    "Given a is 5",
                    "Given b is 10",
                    "When I add a to b",
                    "Then result is 15"
            );

}
 
Example #13
Source File: AllureJbehaveTest.java    From allure-java with Apache License 2.0 6 votes vote down vote up
@Issue("145")
@SuppressWarnings("unchecked")
@Test
void shouldAddParametersFromExamples() {
    final AllureResults results = runStories("stories/examples.story");

    final List<TestResult> testResults = results.getTestResults();

    assertThat(testResults)
            .hasSize(2);

    assertThat(testResults)
            .flatExtracting(TestResult::getParameters)
            .extracting(Parameter::getName, Parameter::getValue)
            .containsExactlyInAnyOrder(
                    tuple("a", "1"), tuple("b", "3"), tuple("result", "4"),
                    tuple("a", "2"), tuple("b", "4"), tuple("result", "6")
            );

}
 
Example #14
Source File: JunitXmlPluginTest.java    From allure2 with Apache License 2.0 6 votes vote down vote up
@Issue("532")
@Test
void shouldParseSuitesTag() throws Exception {
    process(
            "junitdata/testsuites.xml", "TEST-test.SampleTest.xml"
    );

    final ArgumentCaptor<TestResult> captor = ArgumentCaptor.forClass(TestResult.class);
    verify(visitor, times(3)).visitTestResult(captor.capture());

    assertThat(captor.getAllValues())
            .extracting(TestResult::getName)
            .containsExactlyInAnyOrder(
                    "should default path to an empty string",
                    "should default consolidate to true",
                    "should default useDotNotation to true"
            );
}
 
Example #15
Source File: AllureJunitPlatformTest.java    From allure-java with Apache License 2.0 6 votes vote down vote up
@AllureFeatures.MarkerAnnotations
@Issue("189")
@Test
void shouldProcessDynamicTestLabels() {
    final AllureResults results = runClasses(DynamicTests.class);
    final List<TestResult> testResults = results.getTestResults();
    assertThat(testResults)
            .hasSize(3)
            .flatExtracting(TestResult::getLabels)
            .extracting(Label::getValue)
            .contains(
                    "epic1", "epic2", "epic3",
                    "feature1", "feature2", "feature3",
                    "story1", "story2", "story3",
                    "some-owner"
            );
}
 
Example #16
Source File: BehaviorsPluginTest.java    From allure2 with Apache License 2.0 6 votes vote down vote up
@Issue("587")
@Issue("572")
@Test
void shouldSortByStartTimeAsc() {
    final TestResult first = new TestResult()
            .setName("first")
            .setTime(new Time().setStart(10L));
    final TestResult second = new TestResult()
            .setName("second")
            .setTime(new Time().setStart(12L));
    final TestResult timeless = new TestResult()
            .setName("timeless");

    final LaunchResults results = new DefaultLaunchResults(
            new HashSet<>(Arrays.asList(first, second, timeless)),
            Collections.emptyMap(),
            Collections.emptyMap()
    );

    final Tree<TestResult> tree = BehaviorsPlugin.getData(Collections.singletonList(results));

    assertThat(tree.getChildren())
            .extracting(TreeNode::getName)
            .containsExactly("timeless", "first", "second");
}
 
Example #17
Source File: TestIdUtils.java    From frameworkium-core with Apache License 2.0 5 votes vote down vote up
/**
 * Get {@link TmsLink} or {@link Issue} for a method.
 * If both are specified it will return jus the {@link TmsLink} value.
 *
 * @param method the method to check for test ID annotations.
 * @return Optional of the {@link TmsLink} or {@link Issue} value.
 */
public static Optional<String> getIssueOrTmsLinkValue(Method method) {
    TmsLink tcIdAnnotation = method.getAnnotation(TmsLink.class);
    Issue issueAnnotation = method.getAnnotation(Issue.class);

    if (nonNull(tcIdAnnotation)) {
        return Optional.of(tcIdAnnotation.value());
    } else if (nonNull(issueAnnotation)) {
        return Optional.of(issueAnnotation.value());
    } else {
        return Optional.empty();
    }
}
 
Example #18
Source File: TrxPluginTest.java    From allure2 with Apache License 2.0 5 votes vote down vote up
@Issue("596")
@Test
void shouldParseErrorInfo() throws Exception {
    process(
            "trxdata/gh-596.trx",
            "sample.trx"
    );

    final ArgumentCaptor<TestResult> captor = ArgumentCaptor.forClass(TestResult.class);
    verify(visitor, times(1)).visitTestResult(captor.capture());

    assertThat(captor.getAllValues())
            .extracting(TestResult::getStatusMessage, TestResult::getStatusTrace)
            .containsExactly(tuple("Some message", "Some trace"));
}
 
Example #19
Source File: Allure1PluginTest.java    From allure2 with Apache License 2.0 5 votes vote down vote up
@Issue("629")
@Test
void shouldProcessEmptyLists() throws Exception {
    final Set<TestResult> results = process(
            "allure1/empty-lists.xml", generateTestSuiteXmlName()
    ).getResults();

    assertThat(results)
            .hasSize(1);
}
 
Example #20
Source File: CategoriesPluginTest.java    From allure2 with Apache License 2.0 5 votes vote down vote up
@Issue("587")
@Issue("572")
@Test
void shouldSortByStartTimeAsc() {
    final Category category = new Category().setName("some");

    final TestResult first = new TestResult()
            .setName("first")
            .setStatus(Status.FAILED)
            .setTime(new Time().setStart(10L));
    first.addExtraBlock(CATEGORIES, singletonList(category));
    final TestResult second = new TestResult()
            .setName("second")
            .setStatus(Status.FAILED)
            .setTime(new Time().setStart(12L));
    second.addExtraBlock(CATEGORIES, singletonList(category));
    final TestResult timeless = new TestResult()
            .setName("timeless")
            .setStatus(Status.FAILED);
    timeless.addExtraBlock(CATEGORIES, singletonList(category));

    final Tree<TestResult> tree = CategoriesPlugin.getData(
            createSingleLaunchResults(second, first, timeless)
    );

    assertThat(tree.getChildren())
            .flatExtracting("children")
            .flatExtracting("children")
            .extracting("name")
            .containsExactly("timeless", "first", "second");
}
 
Example #21
Source File: PackagesPluginTest.java    From allure2 with Apache License 2.0 5 votes vote down vote up
@Issue("531")
@Test
void shouldProcessTestsInNestedPackages() {
    final Set<TestResult> testResults = new HashSet<>();
    final TestResult first = new TestResult()
            .setName("first")
            .setLabels(singletonList(PACKAGE.label("a.b")));
    final TestResult second = new TestResult()
            .setName("second")
            .setLabels(singletonList(PACKAGE.label("a.b.c")));

    testResults.add(first);
    testResults.add(second);

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

    final PackagesPlugin packagesPlugin = new PackagesPlugin();
    final Tree<TestResult> tree = packagesPlugin.getData(singletonList(results));

    assertThat(tree.getChildren())
            .hasSize(1)
            .extracting("name")
            .containsExactlyInAnyOrder("a.b");

    assertThat(tree.getChildren())
            .flatExtracting("children")
            .extracting("name")
            .containsExactlyInAnyOrder("first", "c");

    assertThat(tree.getChildren())
            .flatExtracting("children")
            .filteredOn("name", "c")
            .flatExtracting("children")
            .extracting("name")
            .containsExactlyInAnyOrder("second");
}
 
Example #22
Source File: StepsAspectsTest.java    From allure-java with Apache License 2.0 5 votes vote down vote up
@Issue("123")
@Test
void shouldProcessEnumPrams() {
    final AllureResults results = runWithinTestContext(() -> paramSteps(FirstParam.PARAM_1, SecondParam.PARAM_2));

    assertThat(results.getTestResults())
            .hasSize(1)
            .flatExtracting(TestResult::getSteps)
            .extracting(StepResult::getName)
            .containsExactly("paramSteps");
}
 
Example #23
Source File: AspectUtilsTest.java    From allure-java with Apache License 2.0 5 votes vote down vote up
@Issue("191")
@Test
void shouldProcessToStringNpe() {
    final MyNpeClass myNpeClass = new MyNpeClass();
    final String string = ObjectUtils.toString(myNpeClass);
    assertThat(string)
            .isEqualTo("<NPE>");
}
 
Example #24
Source File: PackagesPluginTest.java    From allure2 with Apache License 2.0 5 votes vote down vote up
@Issue("587")
@Issue("572")
@Test
void shouldSortByStartTimeAsc() {
    final TestResult first = new TestResult()
            .setName("first")
            .setTime(new Time().setStart(10L));
    final TestResult second = new TestResult()
            .setName("second")
            .setTime(new Time().setStart(100L));
    final TestResult third = new TestResult()
            .setName("third")
            .setTime(new Time().setStart(50L));
    final TestResult timeless = new TestResult()
            .setName("timeless");

    final LaunchResults results = new DefaultLaunchResults(
            new HashSet<>(Arrays.asList(first, second, third, timeless)),
            Collections.emptyMap(),
            Collections.emptyMap()
    );

    final PackagesPlugin packagesPlugin = new PackagesPlugin();
    final Tree<TestResult> tree = packagesPlugin.getData(singletonList(results));

    assertThat(tree.getChildren())
            .extracting("name")
            .containsExactly("timeless", "first", "third", "second");
}
 
Example #25
Source File: LinksOnTestsInherited.java    From allure-java with Apache License 2.0 5 votes vote down vote up
@Override
@Test
@Link("inheritedLink1")
@Link("inheritedLink2")
@Issue("inheritedIssue")
@TmsLink("inheritedTmsLink")
public void shouldHasLinksAsWell() throws Exception {
    super.shouldHasLinksAsWell();
}
 
Example #26
Source File: AllureCucumber2JvmTest.java    From allure-java with Apache License 2.0 5 votes vote down vote up
@AllureFeatures.Base
@Issue("173")
@Issue("164")
@Test
void shouldUseUuid() {
    final AllureResults results = runFeature("features/simple.feature");

    assertThat(results.getTestResults())
            .extracting(TestResult::getUuid)
            .allMatch(uuid -> nonNull(uuid) && uuid.matches("[\\-a-z0-9]+"), "UUID");
}
 
Example #27
Source File: AllureTestNgTest.java    From allure-java with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@AllureFeatures.Parameters
@Issue("129")
@Test
public void shouldNotFailForNullParameters() {
    final AllureResults results = runTestNgSuites("suites/gh-129.xml");

    assertThat(results.getTestResults())
            .flatExtracting(TestResult::getParameters)
            .extracting(Parameter::getName, Parameter::getValue)
            .containsExactlyInAnyOrder(
                    tuple("param", "null")
            );
}
 
Example #28
Source File: AllureTestNgTest.java    From allure-java with Apache License 2.0 5 votes vote down vote up
@AllureFeatures.IgnoredTests
@Issue("49")
@Test
public void shouldDisplayDisabledTests() {
    final AllureResults results = runTestNgSuites("suites/gh-49.xml");

    assertThat(results.getTestResults())
            .extracting(TestResult::getName, TestResult::getStatus)
            .containsExactly(
                    tuple("disabled", null)
            );

}
 
Example #29
Source File: AllureTestNgTest.java    From allure-java with Apache License 2.0 5 votes vote down vote up
@AllureFeatures.Descriptions
@Issue("106")
@Test
public void shouldProcessCyrillicDescriptions() {
    final AllureResults results = runTestNgSuites("suites/gh-106.xml");

    assertThat(results.getTestResults())
            .extracting(TestResult::getName)
            .containsExactlyInAnyOrder("Тест с описанием на русском языке");
}
 
Example #30
Source File: AllureTestNgTest.java    From allure-java with Apache License 2.0 5 votes vote down vote up
@AllureFeatures.Fixtures
@Issue("101")
@Test(description = "Should use fixture description")
public void shouldUseFixtureDescriptions() {
    final AllureResults results = runTestNgSuites("suites/gh-101.xml");

    assertThat(results.getTestResultContainers())
            .flatExtracting(TestResultContainer::getBefores)
            .extracting(FixtureResult::getName)
            .containsExactlyInAnyOrder("Set up method with description");
}