Add pre-test before running test [PKGS-7388]
Code cleanup and small enhancements