added stop script test and refactoring of tests for script hooks.

Change-Id: If27105ccd50be09ba13580362588c11fbcf55d7f