Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
fix(scenario): include error messages in XML output
Browse files Browse the repository at this point in the history
Fix the XML output of scenario tests so that it properly includes error
messages from failing specs.
  • Loading branch information
juliemr authored and IgorMinar committed Feb 7, 2013
1 parent 92ca7ef commit d46fe3c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/ngScenario/output/Xml.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ angular.scenario.output('xml', function(context, runner, model) {
if (step.error) {
var error = $('<error></error>');
stepContext.append(error);
error.text(formatException(stepContext.error));
error.text(formatException(step.error));
}
});
});
Expand Down
15 changes: 14 additions & 1 deletion test/ngScenario/output/xmlSpec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

describe('angular.scenario.output.json', function() {
describe('angular.scenario.output.xml', function() {
var output, context;
var runner, model, $window;
var spec, step;
Expand Down Expand Up @@ -33,4 +33,17 @@ describe('angular.scenario.output.json', function() {
expect(context.find('it').attr('status')).toEqual('success');
expect(context.find('it step').attr('status')).toEqual('success');
});

it('should output errors to the XML', function() {
runner.emit('SpecBegin', spec);
runner.emit('StepBegin', spec, step);
runner.emit('StepFailure', spec, step, 'error reason');
runner.emit('StepEnd', spec, step);
runner.emit('SpecEnd', spec);
runner.emit('RunnerEnd');

expect(context.find('it').attr('status')).toEqual('failure');
expect(context.find('it step').attr('status')).toEqual('failure');
expect(context.find('it step').text()).toEqual('error reason');
});
});

0 comments on commit d46fe3c

Please sign in to comment.