Extract the tests' access to the database into count method