Introduction
There are two kind of testing:
- touchy testing
- mock testing
let me explain by an example imagine you have a project that communicates with a database, and you want to test the
part of the code where you write to and read from the database in touchy testing you need to run a database and literally
write to and read from that database to see if it works well, so you do need the database and all the operations are real,>br/> but some people say that whether the database is up and running, or it's down is non of their business, and they want to
test their code not the database, so they use mocking even when testing the database.
Now I want to explain more precisely about storages. - redis: To mock redis and test it miniredis is used
- database: To mock database and test id sqlmock is used
sqlmock is a big shit
It tests actually nothing