Page tree

You are on the Xray Server documentation. If you are looking for Xray Cloud documentation, you can find it in this page

Skip to end of metadata
Go to start of metadata


In this tutorial, we will create some tests in JavaScript using Jasmine and Protractor.


  • protractor
  • jasmine
  • jasmine-reporters


exports.config = {
  directConnect: true,
  // Capabilities to be passed to the webdriver instance.
  capabilities: {
    'browserName': 'chrome'
  // Framework to use. Jasmine is recommended.
  framework: 'jasmine',
  // Spec patterns are relative to the current working directory when
  // protractor is called.
  specs: ['example_spec.js'],
  // Options to be passed to Jasmine.
  jasmineNodeOpts: {
    defaultTimeoutInterval: 30000

  onPrepare: function() {
    var jasmineReporters = require('jasmine-reporters');
    var junitReporter = new jasmineReporters.JUnitXmlReporter({
      // setup the output path for the junit reports
      savePath: 'output/',
      // conslidate all true:
      //   output/junitresults.xml
      // conslidate all set to false:
      //   output/junitresults-example1.xml
      //   output/junitresults-example2.xml
      consolidateAll: false

describe('angularjs homepage', function() {
  it('should greet the named user', function() {
    var greeting = element(by.binding('yourName'));
    expect(greeting.getText()).toEqual('Hello Julie!');
  describe('todo list', function() {
    var todoList;
    beforeEach(function() {
      todoList = element.all(by.repeater('todo in todoList.todos'));
    it('should list todos', function() {
      expect(todoList.get(1).getText()).toEqual('build an angular app');
    it('should add a todo', function() {
      var addTodo = element(by.model('todoList.todoText'));
      var addButton = element(by.css('[value="add"]'));
      addTodo.sendKeys('write a protractor test');;
      expect(todoList.get(2).getText()).toEqual('write a protractor test');

After running the tests and generating the JUnit XML report (e.g., junitresults-angularjshomepage.xml), it can be imported to Xray (either by the REST API or through the Import Execution Results action within the Test Execution).

 protractor  conf.js

JUnit's Test Case is mapped to a Generic Test in Jira, and the Generic Test Definition field contains the name of the test concatenated with the alias of each test case "assert" statement.

The Execution Details of the Generic Test contains information about the Test Suite, which in this case corresponds to the description of the first "describe".