added test and implementation for reading tests out of db