Setting up Continuous Integration of Protractor using Jenkins

0
0

I am writing automation test scripts using Protractor and now I need to set up the CI for this using Jenkins.

Tasks it needs to perform are:

  1. Starting the selenium standalon server.
  2. Starting the test using conf.js file.
  3. Stopping the selenium standalone server.

Can anyone help in this regard?

  • You must to post comments
0
0

I created a small bash script to do this.

# start selenium
./node_modules/protractor/bin/webdriver-manager start > /dev/null 2>&1 &
# wait until selenium is up
while ! curl http://localhost:4444/wd/hub/status &>/dev/null; do :; done
# run the build
grunt cibuild --force
# stop selenium
curl -s -L http://localhost:4444/selenium-server/driver?cmd=shutDownSeleniumServer > /dev/null 2>&1

This script is invoked from a free-style project in jenkins (Build > Execute shell)

enter image description here

Then the test result report is generated by reading the protractor test results. Hence, you have to produce junit reports from protractor, (look here) :

onPrepare: function() {
// The require statement must be down here, since jasmine-reporters
// needs jasmine to be in the global and protractor does not guarantee
// this until inside the onPrepare function.
require('jasmine-reporters');
jasmine.getEnv().addReporter(
new jasmine.JUnitXmlReporter('xmloutput', true, true));
},

To make the report visible in jenkins i add a post build action in the job: Publish JUnit test result report:

enter image description here

  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Website