From d46fe3c23fa269dcc10249148f2af14f3db6b066 Mon Sep 17 00:00:00 2001 From: Julie Date: Tue, 9 Oct 2012 11:13:26 -0700 Subject: [PATCH] fix(scenario): include error messages in XML output Fix the XML output of scenario tests so that it properly includes error messages from failing specs. --- src/ngScenario/output/Xml.js | 2 +- test/ngScenario/output/xmlSpec.js | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/ngScenario/output/Xml.js b/src/ngScenario/output/Xml.js index 6cd27fe7765f..cdd04f0c7fa1 100644 --- a/src/ngScenario/output/Xml.js +++ b/src/ngScenario/output/Xml.js @@ -43,7 +43,7 @@ angular.scenario.output('xml', function(context, runner, model) { if (step.error) { var error = $(''); stepContext.append(error); - error.text(formatException(stepContext.error)); + error.text(formatException(step.error)); } }); }); diff --git a/test/ngScenario/output/xmlSpec.js b/test/ngScenario/output/xmlSpec.js index 94c3cb5a31f6..32646417cb1d 100644 --- a/test/ngScenario/output/xmlSpec.js +++ b/test/ngScenario/output/xmlSpec.js @@ -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; @@ -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'); + }); });