Class ProgressHistoryUpdater

java.lang.Object
com.arc_e_tect.gradle.gherkin.progress.ProgressHistoryUpdater

public class ProgressHistoryUpdater extends Object
Produces the next ScenarioProgressRecord map to persist, from the previously persisted map and the current run's scenarios.

Every current-run scenario keeps (or starts) a record keyed by ScenarioFingerprint.fingerprint(String): whichever of listedAt/definedAt/ implementedAt matches the scenario's current status is stamped with now the first time that status is observed, and is never overwritten afterwards - so a scenario that jumps straight from listed to implemented never gains a definedAt. Every previously persisted record whose fingerprint is no longer present in the current run is kept, unchanged, with removedAt stamped the first time it goes missing. Records are never deleted.

scenarioName and featureTitle are persisted via ScenarioTitles, with any FeatureIndexer-written numeric index prefix stripped - the same stripping ScenarioFingerprint applies to compute the record's key. Without it, a scenario or feature getting renumbered (e.g. because an earlier one was inserted or removed elsewhere in the suite) would silently rewrite these two fields on every affected record's next run, even though neither the scenario's identity nor its actual progress changed - pure numbering churn in a file meant to be committed.

  • Constructor Details

    • ProgressHistoryUpdater

      public ProgressHistoryUpdater()
      Creates a new ProgressHistoryUpdater.
  • Method Details

    • update

      public Map<String,ScenarioProgressRecord> update(Map<String,ScenarioProgressRecord> previous, List<ScenarioInfo> scenarios, List<io.cucumber.cucumberexpressions.Expression> glueCode, Instant now)
      Computes the updated history map to persist.
      Parameters:
      previous - the previously persisted history, keyed by fingerprint; empty on a first run
      scenarios - the current run's scenarios
      glueCode - the current run's step definition patterns, used to classify each scenario
      now - the instant to stamp newly-reached stages and newly-observed removals with
      Returns:
      the updated history map, keyed by fingerprint