Adapted test to missing Cmdline entry
Cmdline might not be defined (bnc#861465)
DRY-ed testcase

- Moved repeated code to a function