Closed prashantv closed 5 months ago
I usually write StateMachine
types specifically to use them in state machine tests, so the only methods they have are the methods that StateMachineActions
expect. These methods can call any kind of helpers required. Can you provide an example explaining why a StateMachine
type would have methods for other scenarios as well?
The primary motivation is to reuse actions and other test helpers across rapid tests, as well as plain tests using *testing.T
or *testing.B
.
In my specific scenario, I wanted to test a very specific set and order of actions in a normal test, and guarantee that runs as part of every run. This was also useful to develop new actions by using a standard test with a specific set of actions.
A couple of other benefits:
rapid.TB
actions without additional wrapper functionsrapid.TB
that allow reuse across actions and normal *testing.T
testsFor cases where a state machine is only used for rapid tests, it's not necessary, but it helps with reusing the same type in other tests.
Merged, thanks!
Thank you!
This allows reuse actions from normal tests that use
testing.TB
.This is helpful for tests where there may be very specific test scenarios where some logic is abstracted into a common action.