Hi,<div><br></div><div>I am building test cases for a middleware app that uses a database to store some data.</div><div><br></div><div>Although I am using MongoDB, my question should be regardless of the database being used.</div>
<div><br></div><div>What would you guys recommend to correctly test database behavior related to my application?</div><div><br></div><div>Should I rely on expecting a working database when the application is installed?</div>
<div><br></div><div>Is it OK to mock MongoDB? (or any other DB being used). I know mocking is OK but might get brittle</div><div>tests if it gets overused.</div><div><br></div><div>Maybe even a combination of both: mock some parts but still have certain tests that will definitely require</div>
<div>an instance of the database running which could potentially prevent version changes that break the app.</div><div><br></div><div>Any recommendations as to how to deal with database functionality testing would be great.</div>
<div><br></div><div><br></div><div>Thanks!</div>