I'm writing the sort of tests which go through a whole user scenario e.g.
- User clicks "edit profile"
- User edits their name
etc.
However, I find myself needing often needing to test small variations on the same workflow. For example (3) could be "User saves changes" or it could be "user cancels changes" etc.
It feels like a serious DRY violation to just have multiple different test cases which are very similar except at a few decision points.
On the other hand, I don't have a good pattern to hand for essentially saying "repeat this test up to stage (2), but then do something different" or "do the same things as in this previous test, but under this slightly different condition", while maintaining the readability that is crucially important in a testing context.
I realise this is quite a general question, but any pointers towards testing patterns that might help in this context would be greatly appreciated.