tests: add abstract layer for handling traps