Move common setUp functions to a base class

d.o issue: https://www.drupal.org/node/2295979