Jenkins is a popular continuous integration server. Now you can automate your vREST test suite with Jenkins Server.
Prerequisite for your Continuous Integration Server is:
- NodeJS and NPM
- For installation, refer https://github.com/joyent/node/wiki/installing-node.js-via-package-manager
Step by Step Guide:
Let's take a sample application (Contacts Application) and step by step guide on how we can integrate vREST with Jenkins Server.
Note: You can find the source code of sample application at Github.
Step 1: Write your automated test suite in vREST
First you need to write test cases for your test application in vREST to ensure the build quality of your web application. Then copy the test case list URL by clicking on button "Copy Current Test Case List URL" available in Continuous Integration section. You can find the test cases for this sample application in vREST here.
Step 2: [Optional] Learn how vrunner command works and get your hands dirty on it by installing it locally first
vrunner is a NodeJS module provided by vREST, helps you to execute vREST test cases via command line. To install this plugin, simply execute the following command
Note: In case of windows machine, omit the sudo keyword in the above command.
Once you install this module on your local machine, you can execute the vREST test cases by executing the following command:
- email: Email ID through which you have registered on vREST
- password: Password of your vREST account
- url: Provide the test case list URL here. You can find the test case list URL by going to your vREST instance and select Test Cases tab. Now click on button "Copy Current Test Case List URL" available in Left hand side, below the "Filters section". Provide the copied URL in this option.
- logger: Use xunit here. Reporter xunit will export the test case report in xml junit style, which can be used in jenkins server to publish the reports in post build step.
- filepath: Absolute path of the log file, into which execution process and result logs will be dumped. If path/file is not present, tool will try to setup that path, and create file automatically. Please note that if file already exists, that will be overwritten. By default it will be the `vrest_logs/logs.xml` in current directory.
- env: [Optional] Provide the environment name which you have defined in vREST (Case-sensitive).
Step 3: Add vrunner command in the build step in Jenkins Project Configuration
In Jenkins Project Configuration, select "Add build step" >> "Execute shell" in the build section and just add the commands shown in the snapshot below in the field "Command". Please replace the email, password, env, url parameters of the command according to your configuration.
Step 4: Publish reports in Jenkins Server
By default, vrunner command writes the report in 'vrest_logs/logs.xml' if logger 'xunit' is used. You may change this path by providing the filepath option in the vrunner command. In Jenkins Project Configuration, select "Add post-build action" >> "Publish JUnit test result report" in the "Post-build Actions" section and add the vrest logs path in field "Test report XMLs".