Reimplmented beforeAll and afterAll so it works when running a single test. 

Fixes #295