aboutsummaryrefslogtreecommitdiffstats
path: root/src/scenario/output/Xml.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/scenario/output/Xml.js')
-rw-r--r--src/scenario/output/Xml.js36
1 files changed, 19 insertions, 17 deletions
diff --git a/src/scenario/output/Xml.js b/src/scenario/output/Xml.js
index 47d98c78..cbc55ee7 100644
--- a/src/scenario/output/Xml.js
+++ b/src/scenario/output/Xml.js
@@ -3,10 +3,11 @@
*/
angular.scenario.output('xml', function(context, runner) {
var model = new angular.scenario.ObjectModel(runner);
-
+ var $ = function(args) {return new context.init(args);};
runner.on('RunnerEnd', function() {
- context.append('<scenario></scenario>');
- serializeXml(context.find('> scenario'), model.value);
+ var scenario = $('<scenario></scenario>');
+ context.append(scenario);
+ serializeXml(scenario, model.value);
});
/**
@@ -17,30 +18,31 @@ angular.scenario.output('xml', function(context, runner) {
*/
function serializeXml(context, tree) {
angular.foreach(tree.children, function(child) {
- context.append('<describe></describe>');
- var describeContext = context.find('> describe:last');
+ var describeContext = $('<describe></describe>');
describeContext.attr('id', child.id);
describeContext.attr('name', child.name);
+ context.append(describeContext);
serializeXml(describeContext, child);
});
- context.append('<its></its>');
- context = context.find('> its');
+ var its = $('<its></its>');
+ context.append(its);
angular.foreach(tree.specs, function(spec) {
- context.append('<it></it>')
- var specContext = context.find('> it:last');
- specContext.attr('id', spec.id);
- specContext.attr('name', spec.name);
- specContext.attr('duration', spec.duration);
- specContext.attr('status', spec.status);
+ var it = $('<it></it>');
+ it.attr('id', spec.id);
+ it.attr('name', spec.name);
+ it.attr('duration', spec.duration);
+ it.attr('status', spec.status);
+ its.append(it);
angular.foreach(spec.steps, function(step) {
- specContext.append('<step></step>');
- var stepContext = specContext.find('> step:last');
+ var stepContext = $('<step></step>');
stepContext.attr('name', step.name);
stepContext.attr('duration', step.duration);
stepContext.attr('status', step.status);
+ it.append(stepContext);
if (step.error) {
- stepContext.append('<error></error');
- stepContext.find('error').text(formatException(step.error));
+ var error = $('<error></error');
+ stepContext.append(error);
+ error.text(formatException(stepContext.error));
}
});
});