上QQ阅读APP看书,第一时间看更新
Unit testing a deployed application
Once the application is deployed, we can run the unit test on it. In order to try out some unit tests, I have created three unit tests in the test folder, and we will be testing them using Mocha. Let's create another job in Jenkins for setting up unit testing. Again, it would be a freestyle job in Jenkins, as shown in the following screenshot:
We add the Git repository path to Jenkins where our test cases are residing, as shown in the following screenshot:
Then we add an execute shell to run the unit test using Mocha, as shown in the following screenshot:
As you can see in the following screenshot, our test cases are passing, which proves that our functions are running perfectly fine: