Java Code Examples for org.gradle.api.tasks.testing.TestDescriptor#getParent()

The following examples show how to use org.gradle.api.tasks.testing.TestDescriptor#getParent() . 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: AbstractTestLogger.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private String getEventPath(TestDescriptor descriptor) {
    List<String> names = Lists.newArrayList();
    TestDescriptor current = descriptor;
    while (current != null) {
        if (isAtomicTestWhoseParentIsNotTheTestClass(current)) {
            // This deals with the fact that in TestNG, there are no class-level events,
            // but we nevertheless want to see the class name. We use "." rather than
            // " > " as a separator to make it clear that the class is not a separate
            // level. This matters when configuring granularity.
            names.add(current.getClassName() + "." + current.getName());
        } else {
            names.add(current.getName());
        }
        current = current.getParent();
    }

    int effectiveDisplayGranularity = displayGranularity == -1
            ? names.size() - 1 : Math.min(displayGranularity, names.size() - 1);
    List<String> displayedNames = Lists.reverse(names).subList(effectiveDisplayGranularity, names.size());
    return Joiner.on(" > ").join(displayedNames) + " ";
}
 
Example 2
Source File: AbstractTestLogger.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private String getEventPath(TestDescriptor descriptor) {
    List<String> names = Lists.newArrayList();
    TestDescriptor current = descriptor;
    while (current != null) {
        if (isAtomicTestWhoseParentIsNotTheTestClass(current)) {
            // This deals with the fact that in TestNG, there are no class-level events,
            // but we nevertheless want to see the class name. We use "." rather than
            // " > " as a separator to make it clear that the class is not a separate
            // level. This matters when configuring granularity.
            names.add(current.getClassName() + "." + current.getName());
        } else {
            names.add(current.getName());
        }
        current = current.getParent();
    }

    int effectiveDisplayGranularity = displayGranularity == -1
            ? names.size() - 1 : Math.min(displayGranularity, names.size() - 1);
    List<String> displayedNames = Lists.reverse(names).subList(effectiveDisplayGranularity, names.size());
    return Joiner.on(" > ").join(displayedNames) + " ";
}
 
Example 3
Source File: AbstractTestLogger.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private String getEventPath(TestDescriptor descriptor) {
    List<String> names = Lists.newArrayList();
    TestDescriptor current = descriptor;
    while (current != null) {
        if (isAtomicTestWhoseParentIsNotTheTestClass(current)) {
            // This deals with the fact that in TestNG, there are no class-level events,
            // but we nevertheless want to see the class name. We use "." rather than
            // " > " as a separator to make it clear that the class is not a separate
            // level. This matters when configuring granularity.
            names.add(current.getClassName() + "." + current.getName());
        } else {
            names.add(current.getName());
        }
        current = current.getParent();
    }

    int effectiveDisplayGranularity = displayGranularity == -1
            ? names.size() - 1 : Math.min(displayGranularity, names.size() - 1);
    List<String> displayedNames = Lists.reverse(names).subList(effectiveDisplayGranularity, names.size());
    return Joiner.on(" > ").join(displayedNames) + " ";
}
 
Example 4
Source File: ErrorReportingTestListener.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
private OutputHandler handlerFor(TestDescriptor descriptor) {
   // Attach output of leaves (individual tests) to their parent.
   if (!descriptor.isComposite()) {
      descriptor = descriptor.getParent();
   }
   return outputHandlers.computeIfAbsent(TestKey.of(descriptor), (key) -> new OutputHandler());
}
 
Example 5
Source File: TestCountLogger.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void afterSuite(TestDescriptor suite, TestResult result) {
    if (suite.getParent() == null) {
        if (failedTests > 0) {
            logger.error(TextUtil.getPlatformLineSeparator() + summary());
        }
        progressLogger.completed();

        if (result.getResultType() == TestResult.ResultType.FAILURE) {
            hadFailures = true;
        }
    }
}
 
Example 6
Source File: TestCountLogger.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void beforeSuite(TestDescriptor suite) {
    if (suite.getParent() == null) {
        progressLogger = factory.newOperation(TestCountLogger.class);
        progressLogger.setDescription("Run tests");
        progressLogger.started();
    }
}
 
Example 7
Source File: TestCountLogger.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void afterSuite(TestDescriptor suite, TestResult result) {
    if (suite.getParent() == null) {
        if (failedTests > 0) {
            logger.error(TextUtil.getPlatformLineSeparator() + summary());
        }
        progressLogger.completed();

        if (result.getResultType() == TestResult.ResultType.FAILURE) {
            hadFailures = true;
        }
    }
}
 
Example 8
Source File: TestCountLogger.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void beforeSuite(TestDescriptor suite) {
    if (suite.getParent() == null) {
        progressLogger = factory.newOperation(TestCountLogger.class);
        progressLogger.setDescription("Run tests");
        progressLogger.started();
    }
}
 
Example 9
Source File: TestCountLogger.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void afterSuite(TestDescriptor suite, TestResult result) {
    if (suite.getParent() == null) {
        if (failedTests > 0) {
            logger.error(TextUtil.getPlatformLineSeparator() + summary());
        }
        progressLogger.completed();

        if (result.getResultType() == TestResult.ResultType.FAILURE) {
            hadFailures = true;
        }
    }
}
 
Example 10
Source File: TestCountLogger.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void beforeSuite(TestDescriptor suite) {
    if (suite.getParent() == null) {
        progressLogger = factory.newOperation(TestCountLogger.class);
        progressLogger.setDescription("Run tests");
        progressLogger.started();
    }
}
 
Example 11
Source File: TestCountLogger.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void afterSuite(TestDescriptor suite, TestResult result) {
    if (suite.getParent() == null) {
        if (failedTests > 0) {
            logger.error(TextUtil.getPlatformLineSeparator() + summary());
        }
        progressLogger.completed();

        if (result.getResultType() == TestResult.ResultType.FAILURE) {
            hadFailures = true;
        }
    }
}
 
Example 12
Source File: TestCountLogger.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void beforeSuite(TestDescriptor suite) {
    if (suite.getParent() == null) {
        progressLogger = factory.newOperation(TestCountLogger.class);
        progressLogger.setDescription("Run tests");
        progressLogger.started();
    }
}
 
Example 13
Source File: NoMatchingTestsReporter.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void afterSuite(TestDescriptor suite, TestResult result) {
    if (suite.getParent() == null && result.getTestCount() == 0) {
        throw new GradleException(message);
    }
}
 
Example 14
Source File: NoMatchingTestsReporter.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void afterSuite(TestDescriptor suite, TestResult result) {
    if (suite.getParent() == null && result.getTestCount() == 0) {
        throw new GradleException(message);
    }
}
 
Example 15
Source File: AbstractTestLogger.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private boolean isAtomicTestWhoseParentIsNotTheTestClass(TestDescriptor current) {
    return !current.isComposite() && current.getClassName() != null && (current.getParent() == null
            || !current.getClassName().equals(current.getParent().getName()));
}
 
Example 16
Source File: AbstractTestLogger.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private boolean isAtomicTestWhoseParentIsNotTheTestClass(TestDescriptor current) {
    return !current.isComposite() && current.getClassName() != null && (current.getParent() == null
            || !current.getClassName().equals(current.getParent().getName()));
}
 
Example 17
Source File: NoMatchingTestsReporter.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void afterSuite(TestDescriptor suite, TestResult result) {
    if (suite.getParent() == null && result.getTestCount() == 0) {
        throw new GradleException(message);
    }
}
 
Example 18
Source File: NoMatchingTestsReporter.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void afterSuite(TestDescriptor suite, TestResult result) {
    if (suite.getParent() == null && result.getTestCount() == 0) {
        throw new GradleException(message);
    }
}
 
Example 19
Source File: AbstractTestLogger.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private boolean isAtomicTestWhoseParentIsNotTheTestClass(TestDescriptor current) {
    return !current.isComposite() && current.getClassName() != null && (current.getParent() == null
            || !current.getClassName().equals(current.getParent().getName()));
}
 
Example 20
Source File: AbstractTestLogger.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private boolean isAtomicTestWhoseParentIsNotTheTestClass(TestDescriptor current) {
    return !current.isComposite() && current.getClassName() != null && (current.getParent() == null
            || !current.getClassName().equals(current.getParent().getName()));
}