Using Cucumber "background" feature to make the code more DRY

Change-Id: Idf0efdafbfcde7e46d16fde7f49028e99cb7577c