main logic for tests