Class UnifiedTestResultCollector

java.lang.Object
io.github.mov2day.unifiedtest.collector.UnifiedTestResultCollector
All Implemented Interfaces:
ITestResultCollector, org.gradle.api.tasks.testing.TestListener

public class UnifiedTestResultCollector extends Object implements org.gradle.api.tasks.testing.TestListener, ITestResultCollector
Collects and stores test results from various test frameworks. Implements TestListener to receive test execution events.
  • Constructor Details

    • UnifiedTestResultCollector

      public UnifiedTestResultCollector()
      Default constructor required for ServiceLoader.
  • Method Details

    • beforeSuite

      public void beforeSuite(org.gradle.api.tasks.testing.TestDescriptor suite)
      Specified by:
      beforeSuite in interface org.gradle.api.tasks.testing.TestListener
    • afterSuite

      public void afterSuite(org.gradle.api.tasks.testing.TestDescriptor suite, org.gradle.api.tasks.testing.TestResult result)
      Specified by:
      afterSuite in interface org.gradle.api.tasks.testing.TestListener
    • beforeTest

      public void beforeTest(org.gradle.api.tasks.testing.TestDescriptor testDescriptor)
      Specified by:
      beforeTest in interface org.gradle.api.tasks.testing.TestListener
    • afterTest

      public void afterTest(org.gradle.api.tasks.testing.TestDescriptor testDescriptor, org.gradle.api.tasks.testing.TestResult result)
      Specified by:
      afterTest in interface org.gradle.api.tasks.testing.TestListener
    • setResultCallback

      public void setResultCallback(Consumer<UnifiedTestResult> callback)
      Sets a callback to be notified when new test results are collected.
      Parameters:
      callback - the callback to be notified
    • addResult

      public void addResult(UnifiedTestResult result)
      Adds a test result to the collection.
      Specified by:
      addResult in interface ITestResultCollector
      Parameters:
      result - the test result to add
    • hasResult

      public boolean hasResult(String className, String testName)
      Checks if a result exists for the specified test.
      Specified by:
      hasResult in interface ITestResultCollector
      Parameters:
      className - the test class name
      testName - the test method name
      Returns:
      true if a result exists for this test
    • getResults

      public List<UnifiedTestResult> getResults()
      Gets all collected test results.
      Specified by:
      getResults in interface ITestResultCollector
      Returns:
      list of all test results