javascriptprotractorrallyjasmine-node

Updating Protractor Test Results in Rally


I want to update test results in rally. I'm currently using the Rally API and have that part working. Where I'm struggling is that in order to update the Test Case I need to capture the ID from the Test Class, this is how I'm currently adding the TC id in the protractor Test Class

describe('homepage', function() {
  browser.params.rallyTC = 179339279884;
  it('should perform a search', function() {
    intPage.performSearch('inspector');
    expect(intPage.getResult()).toContain('Result');
  });
});

First question would be is there a better way of adding the TC id? Then from my config.js file I'm handling test failures or passes in order to update the ALM tool.

if (result.status !== 'passed') {
  console.log('failed');            
  console.log(browser.params.rallyTC);
}

Any recommendations, on how to handle this type of variable capture and result update, would be appreciated.


Solution

  • I got it working now this is my implementation, in my TestClass I set variables to identify rally specific information like the Project, the User and Test Case id. Then I created a rally.api.js where I use the rally-node bindings to handle all my API resquests. Finally I created a new Reporter and added it to Jasmine. The reporter is really simple and watches for spec results and calls rally's api with the appropriate values.

    specDone: function(result) {
            if (result.status !== 'passed') {           
                console.log('failed');  
                rally.createTestResult('Fail');         
            }
            else{           
                console.log('passed');  
                rally.createTestResult('Pass');
            }
        }