Refactor testing and add --test support