While testing a REST API I found myself needing an entire entry from the database to make sure my GET /table/«id» was implemented correctly.
However, I just found a method to retrieve a field from the database, not an entire entry.
As I'm not experienced with testing yet I would like to know some opinions about implementing a grabEntryFromDatabase method in the Db module, so we can use it to get pure information from the db and then use that to test what the system is doing.
Currently I'm using my own models to get the needed information, but this is the same the API is doing and the test is almost redundant...
Also, if there's any better practice on this, please let me know (:
While testing a REST API I found myself needing an entire entry from the database to make sure my
GET /table/«id»was implemented correctly.However, I just found a method to retrieve a field from the database, not an entire entry.
As I'm not experienced with testing yet I would like to know some opinions about implementing a
grabEntryFromDatabasemethod in the Db module, so we can use it to get pure information from the db and then use that to test what the system is doing.Currently I'm using my own models to get the needed information, but this is the same the API is doing and the test is almost redundant...
Also, if there's any better practice on this, please let me know (: