MongoDB unit testing

huy's Avatar


02 Oct, 2014 04:16 PM


About 1/4 of our unit test (about 250 tests) are mongodb tests. We are currently using an external vendor ( to host our unit test db but because they are on AWS oregon region, the time it takes to go from your server (which is on Azure) to our provider is laggy and results in really really long test time.

I see that you have all flavors of SQL servers available for unit testing. Is it possible to add just a single (fresh?) instance of mongodb on the machine as a service (in your environment setting)?

You guys have an awesome service BTW.


  1. Support Staff 1 Posted by Feodor Fitsner on 02 Oct, 2014 04:35 PM

    Feodor Fitsner's Avatar

    Hi Huy,

    Thanks for the kind words! It's really cool to hear AppVeyor works for your projects!

    MongoDB sounds like a nice addition to AV tools for integration testing. Will take a look.

  2. Support Staff 2 Posted by Feodor Fitsner on 02 Oct, 2014 04:36 PM

    Feodor Fitsner's Avatar
  3. 3 Posted by rhoffman on 06 Nov, 2014 05:16 AM

    rhoffman's Avatar

    I created a powershell Install script (Settings -> Environment -> Install Script -> Select "PS") that:
    * Downloads mongodb to a temp folder
    * Extracts download
    * Installs mongodb as a Windows Service
    * Starts the mongodb service

    Here is the script:

  4. Support Staff 4 Posted by Feodor Fitsner on 06 Nov, 2014 05:23 AM

    Feodor Fitsner's Avatar

    Wow, nice! Thank you!

    Just curious how long does it take to install Mongo this way?

  5. 5 Posted by rhoffman on 06 Nov, 2014 07:07 AM

    rhoffman's Avatar

    See my build:

    The entire build takes 3 minutes 41 seconds. Based on the build log, it last took 1 minute and 25 seconds for the install script to execute. I may be able to cut 4 seconds off of it by shortening the sleep to 1 second (will require some experimentation).

    This was my first experience with appveyor. Really cool and simple. I was surprised with the freedom on the build vm.

  6. Support Staff 6 Posted by Feodor Fitsner on 06 Nov, 2014 02:51 PM

    Feodor Fitsner's Avatar

    Great, thanks!


  7. 7 Posted by huy on 06 Nov, 2014 05:26 PM

    huy's Avatar

    I'm doing the same but instead of downloading the entire zip, I check in only the latest version of mongod.exe to my repo & only installing that. Saves a lot of time because it's only a fraction of that zip file.

    I also have script to shutdown mongo & delete all test data. Not sure if that's necessary for the build.


  8. 8 Posted by sergey on 01 Jul, 2015 03:36 AM

    sergey's Avatar

    Hi Feodor!

    Any update on this? Would be much better to have pre-installed Mongo instead of installing it from external sources.


  9. Support Staff 9 Posted by Feodor Fitsner on 01 Jul, 2015 05:04 AM

    Feodor Fitsner's Avatar

    Well, installing it from downloaded zip is less than 30 seconds. And you don't depend on our updates :)

  10. 10 Posted by Lilith River on 08 Aug, 2015 03:34 PM

    Lilith River's Avatar

    We've been taking this approach for about 9 months, but suddenly mongod fails to start with error 20 - which corresponds to these:

    Message: ERROR: wsastartup failed

    Returned by MongoDB applications on Windows following an error in the WSAStartup function.

    Message: NT Service Error

    Returned by MongoDB applications for Windows due to failures installing, starting or removing the NT Service for the application.

    Any changes that might have broken in?

  11. Support Staff 11 Posted by Feodor Fitsner on 08 Aug, 2015 03:36 PM

    Feodor Fitsner's Avatar

    When did it start happening? Do you use mongo pre-installed on build workers?

    - Feodor

  12. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:58 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac