A javascript framework consisted of mocha
, chai
and chai-http
.
Using gulp
to be able to change environment, run all tests, specific tests or specific testsuite with parameters on the command line which suites a jenkins setup well.
- nodejs installed: https://nodejs.org/en/download/
git clone https://github.com/sjansson/javascript-api-testing.git
npm install
- run all tests:
gulp test-api --env <environmentName>
- run a testsuite:
gulp test-api --env <environmentName> --spec <suiteFolder>/*.test.js
- run a specific test:
gulp test-api --env <environmentName> --spec <suiteFolder>/<yourTest>.test.js
- Install the Git Plugin in Jenkins Plugin Manager
- Install the AnsiColor Plugin in Jenkins Plugin Manager
- Create a freestyle job
- Add your git-repository in SCM
- Activate Color ANSI Console Output with CSS in Build Environment
- Add two buildsteps with
execute shell
for linux orwindows batch command
for windows in Build - Type
npm install
in the shell/batch of the first step - Type
node_modules\.bin\gulp test-api --env <yourEnvironment>
in the shell/batch of the second step