Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,21 @@ public void onStart(final ITestContext context) {
.map(ITestNGMethod::getTestClass)
.distinct()
.forEach(this::onBeforeClass);

context.getExcludedMethods().stream()
.filter(ITestNGMethod::isTest)
.filter(method -> !method.getEnabled())
.forEach(method -> createFakeResult(context, method));
}

protected void createFakeResult(final ITestContext context, final ITestNGMethod method) {
final org.testng.internal.TestResult result = new org.testng.internal.TestResult(
new Object(), method, null, context
);
final String uuid = UUID.randomUUID().toString();
final String parentUuid = UUID.randomUUID().toString();
startTestCase(result, parentUuid, uuid);
stopTestCase(uuid, null, null);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1022,6 +1022,20 @@ public void shouldProcessConfigurationFailure() {
.containsExactly("fail");
}

@Feature("Disabled tests")
@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)
);

}

private AllureResults runTestNgSuites(final String... suites) {
final Consumer<TestNG> emptyConfigurer = testNg -> {
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.qameta.allure.testng.samples;

import org.testng.annotations.Test;

/**
* @author charlie (Dmitry Baev).
*/
public class DisabledTest {

@Test(enabled = false)
public void disabled() {
}
}
10 changes: 10 additions & 0 deletions allure-testng/src/test/resources/suites/gh-49.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >

<suite name="Github Issues">
<test name="gh-49">
<classes>
<class name="io.qameta.allure.testng.samples.DisabledTest"/>
</classes>
</test>
</suite>