stories icon indicating copy to clipboard operation
stories copied to clipboard

Story should not have repeated steps.

Open proofit404 opened this issue 4 years ago • 2 comments

class Action(Story):
    I.a1s1
    I.a1s2
    I.a1s1 # error

proofit404 avatar Mar 27 '21 22:03 proofit404

Is it good idea? If i need to repeat step more than once? I need to implement the same step several times?

al-stefanitsky-mozdor avatar Dec 09 '21 08:12 al-stefanitsky-mozdor

Hello, thanks for reaching out!

Service objects are intended to be some kind of a pipeline. These pipelines correspond to business processes in real life.

Duplication in story steps means it's a duplication in the business process definition. Which in most cases looks like a general design error.

That's why these rule is here.

On the other hand, if you need to apply same logic to different parts of data - extract that logic from story step definition.

For example, extract User entity class and wrap with it as many different users inside story state as you need.

Hope that make sense.

Have a good day :cocktail: :palm_tree:

Best regards, Artem.

proofit404 avatar Dec 09 '21 11:12 proofit404