Skip to content

Latest commit

 

History

History
53 lines (35 loc) · 997 Bytes

VDR301.md

File metadata and controls

53 lines (35 loc) · 997 Bytes

VDR301. Steps name should be in right order

The Vedro framework categorizes steps into three types:

  • “given” - arrange steps, preparing data,
  • “when” - the main act,
  • “then”, “and” and “but” - asserts

By their meaning steps should be ordered: preparing data after the main act or asserting something before the main act seems to be useless.

❌ Anti-pattern

class Scenario(vedro.Scenario):
    subject = "scenario subject"

    def when(self):
        pass

    def and(self):
        pass

    def given(self):
        pass

    def then(self):
        pass

✅Best practice

class Scenario(vedro.Scenario):
    subject = "scenario subject"
    
    def given(self):
        pass

    def when(self):
        pass

    def then(self):
        pass

    def and(self):
        pass

Additional links