Last Updated: May 15, 2019
·
4.866K
· tobiastrelle

Travis-CI and MongoDB

It is very easy to use travis-ci w/ projects using MongoDB in unit tests. It took only minutes to prepare my github project ttrelle/spring-batch-mongodb-support.

1) I had to log in to travis-ci, sync my github projects and activate travis for the above mentioned project.

2) Wrote a .travis.yml file:

language: java
services: mongodb

The 2nd option will provide a mongod process on port 27017 (default) during the unit tests.

3) Pushed to github to trigger a travis build.

Et voilá: https://travis-ci.org/ttrelle/spring-batch-mongodb-support

3 Responses
Add your response

Hi Tobias,

thanks for the tip!
Saved my day yesterday when I wanted to make my newly added mongo tests pass on travis.

cheerio, Mike

over 1 year ago ·

Hi Ryan,

I never ran into problems (yet). The Travis lifecycle is as follows:

  • compile the sources
  • start up the needed database(s)
  • run tests

But I have to admit, my github sources are rather static, so the Travis build isn't fired that often.

over 1 year ago ·

This was surprisingly simple, thanks for the tip.

over 1 year ago ·