Skip to content

Version 0.11.0

Pre-release
Pre-release
Compare
Choose a tag to compare
@jmalloc jmalloc released this 27 Nov 03:14
· 484 commits to main since this release

This release includes extensive changes to the testing API. It formalizes the concepts of "actions" and "expectations" with the goal of a more consistent API and a greater level of extensibility.

Despite the large number of backwards incompatible changes it is relatively simple to migrate existing tests to the new API. Please see the v0.11.0 migration guide for detailed instructions.

Testing API

Added

  • Add Begin() and BeginContext() functions, used to start a new Test
  • Add ExecuteCommand(), RecordEvent(), AdvanceTime() and Call() functions
  • Add Expect() method to Test
  • Add EnableHandlers() and DisableHandlers() methods to Test
  • Add TimeAdjuster interface, for use with AdvanceTime()
  • Add Action and ActionScope types
  • Add Expectation, Predicate, PredicateScope and PredicateOptions types
  • [BC] Add Failed(), Fatal() and Helper() to the TestingT interface

Changed

  • [BC] Test.Prepare() now accepts ...Action (previously ...dogma.Message)
  • [BC] The function passed to Call() no longer returns an error
  • [BC] Rename WithStartTime() to StartTimeAt()
  • [BC] Rename WithOperationOptions() to WithUnsafeOperationOptions()
  • [BC] Move assert.AllOf(), AnyOf() and NoneOf() to the testkit package
  • [BC] Move assert.Should(), to testkit.ToSatisfy()
  • [BC] Move assert.CommandExecuted(), to testkit.ToExecuteCommand()
  • [BC] Move assert.CommandTypeExecuted(), to testkit.ToExecuteCommandOfType()
  • [BC] Move assert.EventExecuted(), to testkit.ToRecordEvent()
  • [BC] Move assert.EventTypeExecuted(), to testkit.ToRecordEventOfType()

Removed

  • [BC] Remove the Runner type and New() which constructed it
  • [BC] Remove ExecuteCommand(), RecordEvent(), AdvanceTime() and Call() methods from Test
  • [BC] Remove TimeAdvancer function (replaced with TimeAdjustment interface)
  • [BC] Remove WithEngineOptions()
  • [BC] Remove the assert package
  • [BC] Remove the compare package
  • [BC] Remove the render package

Engine

Added

  • Add EnableHandler() operation option

Changed

  • [BC] engine.New() and MustNew() now require a configkit.RichApplication
  • [BC] Moved the engine/fact package to fact
  • [BC] Moved the engine/envelope package to envelope

Removed

  • [BC] Remove the engine/controller package

Fixed

  • Engine.Tick() now properly ignores disabled handlers