[test-integration] Use testEnv methods and remove most of the global variables Upstream-commit: 4fdfcb36cd6ab3bdf78be522f43c0c2a2bd5c898 Component: engine