mardi 18 juillet 2017

Node Testing: how to run bash commands after mocha test cases

I'm using Mocha and Selenium to do an e2e test for my node web app. Now the problem is, I want to tear down databases after the execution of all test cases.

Backend uses two databases - mongo and postgres. I created new empty testing databases of each, just for the e2e testing. During the testing some records are inserted into databases. So, at the end of testing (when mocha test cases which invoke selenium are all executed), I want to tear down the test databases and create new ones. These operations are apparently done by bash commands.

So, is this a good practice and if so, how can I achieve this, like writing bash commands in js file(which execute the mocha test cases)?

Aucun commentaire:

Enregistrer un commentaire