Automating everything
Test automation was never so easy without Gulp. Gulp is an open source JavaScript library that provides efficient build creation processes and serves as a task runner. We will use Gulp to automate our unit tests by a single command in terminal.
Let's start by installing all the required packages using the following commands:
npm install gulp-cli -g npm install gulp --save-dev touch test/gulpfile.js gulp --help
Note that you may require root access to install the global package of gulp-cli
. Use sudo
in such cases, for example, sudo npm install gulp-cli -g
. We used --save-dev
to install Gulp locally and save it as a development dependency in our package.json
.
Further, we created a Gulp file in the test
directory. Now, to test
the directory of our app and make sure that we have the following file structure:
Once we've installed the required packages and created a Gulp file, let's start writing some code, as follows:
var gulp = require('gulp'); gulp.task('default', function(...