[TIMOB-12172] Fixed a bug in the test worker and cleaned up some code