I'm using jenkins to automate the testing of my node js application? How do I test the queries to the database? How does Jenkins know to build the mongo db database first? How does automated testing work with database?
1 Answers
I don't use Jenkins
for CI
, I tend to use TeamCity
, but I think your questions can be answered independently of which CI technology
you use.
There is no definite answer to your questions, it all depends:
If you are looking to implement full integration tests
, including querying a real database, then I would suggest creating a separate database just for testing like - mydb-test
. You would have to configure your tests to use this database via config etc. In case you want to isolate
your tests from the data access layer
, then you need to mock the data access. This can be done by using a mock library, this will be easier to use depending on how well architected is your application code, where dependency injection IMHO is really important on this matter.

- 1
- 1

- 7,588
- 4
- 35
- 44