Refactoring tests

optimization is made to avoid loading unneeded context