shlogg · Early preview
Jetthoughts Dev @jetthoughts

Easy System Tests With Best Practices For Maintenance

Make system tests easy to maintain with 4-phase test pattern & single level of abstraction, explicit naming, relevant setup & clear expectations.

Want to make system tests easy to main tain? We have selected some best practice tips to help achieve this.



  
  
  Organize tests in four phases

The Four-Phase Test is a testing pattern, applicable to all programming languages and unit tests (not so much integration tests).
There are four distinct phases of the test. They are executed sequentially.

    test do
      setup
      exercise
      verify
      teardown
    end

    
    

    
    




  
  
  setup

During setup, setup initial state.

    user = User.new(password: 'password')

    
    

    
    




  
  
  exercise

At th...