JavaScript

Test code separation

Posted on by  
Richard Rijnberk

As someone who spends quite some time writing and checking unit and e2e tests I’ve started noticing a trend I’m somewhat confused by. There have been multiple occasions in which I’ve encountered test logic (repeatable and single use) in either test specifications or page objects. So I decided to share my approach to writing and foremost separating my test code into three categories. Those being: Specifications , Sequences and Page Objects. I’ll describe my views on these categories below.

The first category is the one we all use the most. It is the bread and butter of testing and describes our tests. For me this always follows the same general steps.

  • The setup where we set required variables and states,

  • the execution where we call the functionality we’ll be testing and

  • the validation where we check the result and/or side effects.

Continue reading →

shadow-left