Returns test results formatted as an XML string.
@param {Object} result The results object created by TestRunner.
@return {String} An XML-formatted string of results.
@method XML
@static
178798
function(results) {

            function serializeToXML(results){
                var xml = "<" + results.type + " name=\"" + xmlEscape(results.name) + "\"";

                if (typeof(results.duration)=="number"){
                    xml += " duration=\"" + results.duration + "\"";
                }

                if (results.type == "test"){
                    xml += " result=\"" + results.result + "\" message=\"" + xmlEscape(results.message) + "\">";
                } else {
                    xml += " passed=\"" + results.passed + "\" failed=\"" + results.failed + "\" ignored=\"" + results.ignored + "\" total=\"" + results.total + "\">";
                    for (var prop in results){
                        if (results.hasOwnProperty(prop)){
                            if (results[prop] && typeof results[prop] == "object" && !(results[prop] instanceof Array)){
                                xml += serializeToXML(results[prop]);
                            }
                        }
                    }
                }

                xml += "</" + results.type + ">";

                return xml;
            }

            return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + serializeToXML(results);

        }
1138425
function GetMML(result) {
  if (!data.mml && !data.mmlNode) return;
  var jax = MathJax.Hub.getAllJax()[0];
  if (data.speakText && !jax.root.alttext) {
    jax.root.alttext = result.speakText;
    var attrNames = jax.root.attrNames;
    if (attrNames && attrNames.indexOf("alttext") === -1) {
      attrNames.push("alttext");
    }
  }
  try {
    var mml = jax.root.toMathML('',jax);
  } catch(err) {
    if (!err.restart) {throw err;} // an actual error
    return MathJax.Callback.After(window.Array(GetMML,result),err.restart);
  }
  if (data.mml) result.mml = mml;
  if (data.mmlNode) result.mmlNode = JSDOM.fragment(mml).firstChild;
}
371162
private List<String> formatResult(Result result, Server server) {
		List<String> resultStrings = new LinkedList<>();

		if (result.getValuePath().isEmpty()) {
			processOneMetric(resultStrings, server, result, result.getValue(), null, null);
		} else {
			processOneMetric(resultStrings, server, result, result.getValue(), tagName, StringUtils.join(result.getValuePath(), '.'));
		}
		return resultStrings;
	}
726792
function collectResults(resultsGlob) {
    var glob = require("glob"),
        fs = require("fs"),
        Q = require('q'),
        JunitConverter = require("./formats/junitConverter"),
        response = {},
        count = 0,
        specs,
        files = [],
        converter,
        result;

    for (var i = 0; i < resultsGlob.length; i++) {
        files = files.concat(glob.sync(resultsGlob[i]));
    }

    var converterCallback = function(output) {
        result = output;
    };

    for (i = 0; i < files.length; i++) {
        if (files[i].indexOf(".xml") !== -1) {
            converter = new JunitConverter(files[i]);
            converter.exec(converterCallback);
        } else {
            try {
                result = JSON.parse(fs.readFileSync(files[i]));
            } catch (err) {
                console.log('Error parsing JSON of ' + files[i]);
                result = {};
            }
        }
        response = mergeResults(result, response);
        count++;
    }
    return Q.fcall(function () {
        return response;
    });
}
301997
function wrapSuccess(result) {
      return {
        url: page.url,
        body: getContent(),
        headers: pageInformation.response.headers,
        status: pageInformation.response.status,
        error: result.error ? helpers.serializeError(result.error) : null,
        data: result.data
      };
    }
43553
function getMessages(result) {
  let messages = [];
  if (result.messages) {
    messages = messages.concat(result.messages);
  }
  if (result.schemaValidationMessages) {
    messages = messages.concat(
      result.schemaValidationMessages.map((m) => `${m.level}: ${m.message}`)
    );
  }
  return messages;
}
303225
function (data) {
            // already a xml
            if (data.documentElement) {
                return data;
            }
            var xml;
            try {
                // Standard
                if (win['DOMParser']) {
                    xml = new DOMParser().parseFromString(data, 'text/xml');
                } else { // IE
                    xml = new ActiveXObject('Microsoft.XMLDOM');
                    xml.async = false;
                    xml.loadXML(data);
                }
            } catch (e) {
                logger.error('parseXML error :');
                logger.error(e);
                xml = undefined;
            }
            if (!xml || !xml.documentElement || xml.getElementsByTagName('parsererror').length) {
                S.error('Invalid XML: ' + data);
            }
            return xml;
        }
16630
@Override
  public URIParsedResult parse(Result result) {
    String rawText = getMassagedText(result);
    // We specifically handle the odd "URL" scheme here for simplicity and add "URI" for fun
    // Assume anything starting this way really means to be a URI
    if (rawText.startsWith("URL:") || rawText.startsWith("URI:")) {
      return new URIParsedResult(rawText.substring(4).trim(), null);
    }
    rawText = rawText.trim();
    if (!isBasicallyValidURI(rawText) || isPossiblyMaliciousURI(rawText)) {
      return null;
    }
    return new URIParsedResult(rawText, null);
  }
661182
function gotResults(results) {
  results.JSONquery = JSON.stringify(results.query, null, 2);
  console.log('gotResults', results);
  updateResults(results);
}
249101
function(result){
  if(!result) return result;
  result.index = result.index + 2;
  var s = result[0];  
  result[0] = s
    .substr(2,s.length-4) // Skip the first two chars ([[) and omit the last ones (]])
    .replace(/\s+/g, '_'); // Every space will be replaced by an underscore
  return result;
}
313413
private List<String> getResultRows(Result<?> result, boolean logResult) {
        List<String> rows = new ArrayList<>();
        if (logResult) {
            for (Map<String, Object> columns : result.getRows()) {
                StringBuilder row = new StringBuilder();
                for (Map.Entry<String, Object> entry : columns.entrySet()) {
                    if (row.length() > 0) {
                        row.append(", ");
                    }
                    row.append(entry.getKey());
                    row.append('=');
                    String stringValue = getLabel(entry.getValue());
                    row.append(stringValue);
                }
                rows.add("  " + row.toString());
            }
        }
        return rows;
    }
454518
function ReturnResult(result) {
  if (errors.length) {
    result.errors = errors;
  }
  var state = data.state;
  if (state) {
    var AMS = MathJax.Extension["TeX/AMSmath"];
    var GLYPH = (MathJax.OutputJax.SVG||{}).BBOX.GLYPH;
    state.AMS.startNumber = AMS.startNumber;
    state.AMS.labels = AMS.labels;
    state.AMS.IDs = AMS.IDs;
    state.mmlID = MathJax.ElementJax.mml.SUPER.ID;
    state.glyphs = GLYPH.glyphs;
    state.defs = GLYPH.defs;
    state.n = GLYPH.n;
    state.ID = ID;
  }
  serverState = STATE.READY;
  callback(result, originalData);
  if (serverState === STATE.READY) StartQueue();
}
703980
function(xmlBody) {

        var parser = new DOMParser();
        var doc = parser.parseFromString(xmlBody, "application/xml");

        var resolver = function(foo) {
            var ii;
            for(ii in this.xmlNamespaces) {
                if (this.xmlNamespaces[ii] === foo) {
                    return ii;
                }
            }
        }.bind(this);

        var responseIterator = doc.evaluate('/d:multistatus/d:response', doc, resolver, XPathResult.ANY_TYPE, null);

        var result = [];
        var responseNode = responseIterator.iterateNext();

        while(responseNode) {

            var response = {
                href : null,
                propStat : []
            };

            response.href = doc.evaluate('string(d:href)', responseNode, resolver, XPathResult.ANY_TYPE, null).stringValue;

            var propStatIterator = doc.evaluate('d:propstat', responseNode, resolver, XPathResult.ANY_TYPE, null);
            var propStatNode = propStatIterator.iterateNext();

            while(propStatNode) {
                var propStat = {
                    status : doc.evaluate('string(d:status)', propStatNode, resolver, XPathResult.ANY_TYPE, null).stringValue,
                    properties : {},
                };

                var propIterator = doc.evaluate('d:prop/*', propStatNode, resolver, XPathResult.ANY_TYPE, null);

                var propNode = propIterator.iterateNext();
                while(propNode) {
                    var content = this._parsePropNode(propNode);
                    propStat.properties['{' + propNode.namespaceURI + '}' + propNode.localName] = content;
                    propNode = propIterator.iterateNext();

                }
                response.propStat.push(propStat);
                propStatNode = propStatIterator.iterateNext();


            }

            result.push(response);
            responseNode = responseIterator.iterateNext();

        }

        return result;

    }
1166375
function generateHTML(testResults) {
        var stepsHtml = '',
            header = '',
            isPassed = false,
            passedScenarios = 0,
            passedSteps = 0,
            stepsNumber = 0,
            scenariosNumber = 0,
            scenariosNumberInFeature = 0,
            passedScenariosNumberInFeature = 0,
            stepsNumberInFeature = 0,
            passedStepsInFeature = 0,
            scenariosHtml = '',
            element,
            step,
            stepDuration = 0;

        html = '';
        for (var i = 0; i < testResults.length; i++) {

            scenariosNumberInFeature = 0;
            passedScenariosNumberInFeature = 0;
            stepsNumberInFeature = 0;
            passedStepsInFeature = 0;
            scenariosHtml = '';
            if (testResults[i].elements) {
                for (var j = 0; j < testResults[i].elements.length; j++) {
                    element = testResults[i].elements[j];
                    if (element.type === 'scenario') {
                        scenariosNumber++;
                        scenariosNumberInFeature++;
                        stepsHtml = '';
                        isPassed = true;
                        for (var k = 0; k < testResults[i].elements[j].steps.length; k++) {
                            step = testResults[i].elements[j].steps[k];

                            if (isEmptyAfterStep(step) || isEmptyBeforeStep(step)) {
                                continue;
                            }

                            if (isAfterStepWithScreenshot(step)) {
                                stepsHtml += getAfterScreenshotStep(step);
                            } else {
                                stepsHtml += getStep(step);
                                stepDuration += (step.result.duration ? step.result.duration : 0);
                                stepsNumber++;
                                stepsNumberInFeature++;
                                if (step.result.status !== statuses.PASSED) {
                                    isPassed = false;
                                } else if (step.result.status === statuses.PASSED) {
                                    passedSteps++;
                                    passedStepsInFeature++;
                                }
                            }
                        }

                        if (isPassed) {
                            passedScenarios++;
                            passedScenariosNumberInFeature++;
                        }
                        scenariosHtml += getScenarioContainer(getScenario(element, isPassed, stepsHtml));
                    }
                }
            }
            html += getFeatureWithScenarios(getFeature(testResults[i], scenariosNumberInFeature, passedScenariosNumberInFeature, stepsNumberInFeature, passedStepsInFeature) + scenariosHtml);
        }
        header = getHeader(scenariosNumber, passedScenarios, stepsNumber, passedSteps, calculateDuration(stepDuration));
        return header + html;
    }
239384
private static Element createResultElement(final Document document) {
        final Element ttResponse = document.createElementNS("http://jaxrx.org/", "result");
        ttResponse.setPrefix("jaxrx");
        return ttResponse;
    }
309360
function formatter (results) {
  const warnings = []
  const errors = []

  results.forEach(result => {
    if (!result.warnings.length) {
      errors.push(result)
      return
    }

    const warningMessages = []
    const errorMessages = []

    result.warnings.forEach(message => {
      if (message.severity === 'warning') {
        warningMessages.push(message)
      } else {
        errorMessages.push(message)
      }
    })

    warnings.push(Object.assign({}, result, { warnings: warningMessages }))
    errors.push(Object.assign({}, result, { warnings: errorMessages }))
  })

  return stringFormatter([].concat(warnings, errors))
}
51013
function(xxx, results) {
        var o, r, lookup = {}
          // map from results to keys
        for (var i = 0, l = results.rows.length; i < l; i++) {
          o = JSON.parse(results.rows.item(i).value)
          o.key = results.rows.item(i).id
          lookup[o.key] = o;
        }
        r = args.map(function(key) {
          return lookup[key];
        });
        if (!that.isArray(keyOrArray)) r = r.length ? r[0] : null
        if (cb) that.lambda(cb).call(that, r)
      }